Learn R Programming

SGL (version 1.3)

predictSGL: Outputs Predicted Responses from an SGL Model for New Observations

Description

Outputs predicted response values for new user input observations at a specified lambda value

Usage

predictSGL(x, newX, lam)

Arguments

x

fitted "SGL" object

newX

covariate matrix for new observations whose responses we wish to predict

lam

the index of the lambda value for the model with which we desire to predict

Details

Predicted outcomes are given

References

Simon, N., Friedman, J., Hastie T., and Tibshirani, R. (2011) A Sparse-Group Lasso, http://faculty.washington.edu/nrsimon/SGLpaper.pdf

See Also

SGL and cvSGL.

Examples

Run this code
# NOT RUN {
n = 50; p = 100; size.groups = 10
index <- ceiling(1:p / size.groups)
X = matrix(rnorm(n * p), ncol = p, nrow = n)
beta = (-2:2)
y = X[,1:5] %*% beta + 0.1*rnorm(n)
data = list(x = X, y = y)
Fit = SGL(data, index, type = "linear")
X.new = matrix(rnorm(n * p), ncol = p, nrow = n)
predictSGL(Fit, X.new, 5)
# }

Run the code above in your browser using DataLab