coef.cv.compCL {Compack}R Documentation

Extract estimated coefficients from a "cv.compCL" object.

Description

This function gets coefficients from a compCL object, using the stored "compCL.fit" object.

Usage

## S3 method for class 'cv.compCL'
coef(object, trim = FALSE, s = c("lam.min", "lam.1se"), ...)

Arguments

object

fitted "cv.compCL" object.

trim

whether to use the trimmed result. Default is FASLE.

s

value(s) of the penalty parameter lam at which coefficients are requested.

  • s="lam.min" (default) stored in the cv.compCL object, which gives value of lam that achieves the minimum cross-vadilation error.

  • s="lambda.min" which gives the largest value of lam such that 1 standard error above the minimum of the cross-validation errors is achieved.

  • If s is numeric, it is taken as the value(s) of lam to be used.

  • If s = NULL, the whole sequence of lam stored in the cv.compCGL object is used.

...

not used.

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.

Value

The coefficients at the requested tuning parameter values in s.

Author(s)

Zhe Sun and Kun Chen

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

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

Examples

p = 30
n = 50
beta = c(1, -0.8, 0.6, 0, 0, -1.5, -0.5, 1.2)
beta = c(beta, rep(0, times = p - length(beta)))
Comp_data = comp_Model(n = n, p = p, beta = beta, intercept = FALSE)
cvm1 <- cv.compCL(y = Comp_data$y, Z = Comp_data$X.comp,
                  Zc = Comp_data$Zc, intercept = Comp_data$intercept)
coef(cvm1)
coef(cvm1, s = NULL)
coef(cvm1, s = c(1, 0.5, 0.1))


[Package Compack version 0.1.0 Index]