coef.transreg | R Documentation |
Extracts coefficients from an object of class [transreg].
## S3 method for class 'transreg'
coef(object, stack = NULL, ...)
object |
object of class 'transreg' |
stack |
character "sta" (standard stacking) or "sim" (simultaneous stacking) |
... |
(not applicable) |
Returns estimated coefficients. The output is a list with two slots: slot 'alpha' with the estimated intercept (scalar), and slot 'beta' with the estimated slopes (vector).
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. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1093/bioinformatics/btad680")}. (Click here to access PDF.)
Methods for objects of class [transreg]
include coef
and predict
.
#--- simulation ---
set.seed(1)
n <- 100; p <- 500
X <- matrix(rnorm(n=n*p),nrow=n,ncol=p)
beta <- rnorm(p)
prior <- beta + rnorm(p)
y <- X %*% beta
#--- glmnet (without prior effects) ---
object <- glmnet::cv.glmnet(y=y,x=X,alpha=0)
beta_hat <- coef(object,s="lambda.min")[-1]
mean((beta-beta_hat)^2)
#--- transreg (with prior effects) ---
object <- transreg(y=y,X=X,prior=prior,alpha=0)
beta_hat <- coef(object)$beta
mean((beta-beta_hat)^2) # decrease in MSE?
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.