Skip to contents

Extracts weights from an object of class [transreg].

Usage

# S3 method for class 'transreg'
weights(object, stack = NULL, ...)

Arguments

object

object of class `transreg`

stack

character "sta" (standard stacking) or "sim" (simultaneous stacking)

...

(not applicable)

Value

Returns weights. The output is a numerical vector with one entry for each source of co-data.

References

Armin Rauschenberger, Zied Landoulsi, Mark A. van de Wiel, and Enrico Glaab (2023). "Penalised regression with multiple sets of prior effects". Bioinformatics 39(12):btad680. doi:10.1093/bioinformatics/btad680 . (Click here to access PDF.)

See also

This function is about weights for sources of prior effects. To extract weights for features (estimated regression coefficients), use [coef()].

Examples

#--- simulation ---
set.seed(1)
n <- 100; p <- 500
X <- matrix(rnorm(n=n*p),nrow=n,ncol=p)
beta <- rnorm(p)
prior <- cbind(beta+rnorm(p),beta+rnorm(p),rnorm(p),rnorm(p))
y <- X %*% beta

#--- example ---
object <- transreg(y=y,X=X,prior=prior)
weights(object)
#> [1] 0.5647605 0.6181596 0.0000000 0.1233377