Description Usage Arguments Details Value Author(s) References See Also Examples
k-fold cross-validation for compCL; produce a plot and return
optimal values of lam
.
1 2 |
y |
response vector with length n. |
Z |
|
Zc |
|
intercept |
whether to include an intercept.
Default is |
lam |
a user supplied lambda sequence.
If |
nfolds |
number of folds, default is 10. The smallest allowable value is |
foldid |
an optional vector of values between 1 and the sample size |
trim |
percentage to be trimmed off the prediction errors from either side; default is 0. |
keep |
If |
... |
other arguments that can be passed to |
cross-validation and fit full data with selected model.
an object of S3 class "cv.compCL"
is returned, which is a list constaining:
compCL.fit |
a fitted |
lam |
the sequence of |
Ftrim |
a list of cross-validation results without trimming:
|
Ttrim |
a list of cross-validation result with |
foldid |
the values of |
Zhe Sun and Kun Chen
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
compCL
and cv.compCL
,
and coef
,
predict
and
plot
methods for "cv.compCL"
object.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | 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)
plot(cvm1)
coef(cvm1)
## selection by "lam.min" criterion
which(abs(coef(cvm1, s = "lam.min")[1:p]) > 0)
## selection by "lam.1se" criterion
which(abs(coef(cvm1, s= "lam.1se")[1:p]) > 0)
Comp_data2 = comp_Model(n = 30, p = p, beta = Comp_data$beta, intercept = FALSE)
y_hat = predict(cvm1, Znew = Comp_data2$X.comp, Zcnew = Comp_data2$Zc)
plot(Comp_data2$y, y_hat,
xlab = "Observed response", ylab = "Predicted response")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.