Skip to contents

Extracts coefficients from multi-task or transfer learning regression model.

Usage

# S3 method for class 'sparselink'
coef(object, ...)

Arguments

object

object of class "sparselink" (generated by function sparselink)

...

(not applicable)

Value

Returns estimated coefficients. The output is a list with two slots: slot alpha with the estimated intercept (vector of length \(q\)), and slot beta with the estimated slopes (matrix with \(p\) rows and \(q\) columns).

References

Armin Rauschenberger, Petr N. Nazarov, and Enrico Glaab (2025). "Estimating sparse regression models in multi-task learning and transfer learning through adaptive penalisation". Under revision. https://hdl.handle.net/10993/63425

See also

Use sparselink to fit the model and predict to make predictions.

Examples

family <- "gaussian"
type <- "multiple" #  try "multiple" or "transfer"
if(type=="multiple"){
 data <- sim_data_multi(family=family)
} else if(type=="transfer"){
 data <- sim_data_trans(family=family)
}
object <- sparselink(x=data$X_train,y=data$y_train,family=family)
#> mode: transfer learning, alpha.init=0.95 (elastic net), alpha=1 (lasso)
#> Warning: Option grouped=FALSE enforced in cv.glmnet, since < 3 observations per fold
#> Warning: Option grouped=FALSE enforced in cv.glmnet, since < 3 observations per fold
#> Warning: Option grouped=FALSE enforced in cv.glmnet, since < 3 observations per fold
coef <- coef(object=object)