Learn R Programming

Compack (version 0.1.0)

predict.compCL: Make predictions based on a "compCL" object.

Description

Make predictions based on a fitted "compCL" object.

Usage

# S3 method for compCL
predict(object, Znew, Zcnew = NULL, s = NULL, ...)

Arguments

object

fitted "compCL" object.

Znew

z matrix as in compCL with new compositional data or categorical data.

Zcnew

Zc matrix as in compCL with new data for other covariates. Default is NULL

s

value(s) of the penalty parameter lam at which predictions are required. Default is the entire sequence used in the fitted object.

not used.

Value

predicted values at the requested values of s.

Details

s is the vector at which predictions are requested. If s is not in the lambda sequence used for fitting the model, the predict function uses linear interpolation.

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 coef, predict and plot methods for "compCL" object.

Examples

Run this code
# NOT RUN {
Comp_data = comp_Model(n = 50, p = 30)
Comp_data2 = comp_Model(n = 30, p = 30, beta = Comp_data$beta)
m1 = compCL(y = Comp_data$y, Z = Comp_data$X.comp,
            Zc = Comp_data$Zc, intercept = Comp_data$intercept)
predict(m1, Znew = Comp_data2$X.comp, Zcnew = Comp_data2$Zc)
predict(m1, Znew = Comp_data2$X.comp, Zcnew = Comp_data2$Zc, s = c(1, 0.5, 0.1))

# }

Run the code above in your browser using DataLab