Learn R Programming

Compack (version 0.1.0)

coef.compCL: extracts model estimated coefficients from a "compCL" object.

Description

gets the coefficients at the requested values for lam from a fitted "compCL" object.

Usage

# S3 method for compCL
coef(object, s = NULL, ...)

Arguments

object

fitted "compCL" object.

s

value(s) of the penalty parameter lam at which coefficients are requested. Default (NULL) is the entire sequence used to create the model.

...

Not used.

Value

The coefficients at the requested tuning parameter values in s.

Details

s is a vector of lambda values at which the coefficients are requested. If s is not in the lam sequence used for fitting the model, the coef function will use linear interpolation, so the function should be used with caution.

References

Lin, W., Shi, P., Peng, R. and Li, H. (2014) Variable selection in regression with compositional covariates, https://academic.oup.com/biomet/article/101/4/785/1775476. Biometrika 101 785-979.

See Also

compCL and predict, plot and print methods for "compCL" object.

Examples

Run this code
# NOT RUN {
Comp_data = comp_Model(n = 50, p = 30)
Comp_fit = compCL(y = Comp_data$y, Z = Comp_data$X.comp, Zc = Comp_data$Zc,
                  intercept = Comp_data$intercept)
coef(Comp_fit)
coef(Comp_fit, s = Comp_fit$lam[50])
coef(Comp_fit, s = c(1, 0.5, 0.1))

# }

Run the code above in your browser using DataLab