predict.creNet: Predict Responses for New Observations Using Fitted creSGL...

Description Usage Arguments Details Value Author(s) References See Also Examples

View source: R/predict.creNet.R

Description

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

Usage

1
predict(obj, newX, lam=NULL, standardize=c("train","self"))

Arguments

obj

A fitted object of class creSGL or cv.creSGL

newX

A matrix of new covariates

lam

The indexes of lambda values to be used for prediction

standardize

The standardization method for newX

Details

The matrix newX should have the same number of columns as the covariate matrix used to obtain obj. The argument standardize specifies how newX should be standardized. For the choice "train", the means and variances attached to obj are used. For the choice "self", the own means and variances of newX are used.

Value

A vector or matrix of predicted responses. Each column corresponds to a value of lambda.

Author(s)

Kourosh Zarringhalam and David Degras

Modified from SGL package: Noah Simon, Jerome Friedman, Trevor Hastie, and Rob Tibshirani

Maintainer: Kourosh Zarringhalam <[email protected]>

References

Simon, N., Friedman, J., Hastie T., and Tibshirani, R. (2011) A Sparse-Group Lasso,
http://web.stanford.edu/~hastie/Papers/SGLpaper.pdf

See Also

SGL and cvSGL.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
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)
y = ifelse((exp(y) / (1 + exp(y))) > 0.5, 1, 0)
data = list(x = X, y = y)
weights = rep(1, size.groups)
Fit = creSGL(data, index, weights, type = "logit", maxit = 1000, thresh = 0.001, 
		min.frac = 0.05, nlam = 100, gamma = 0.8, standardize = TRUE, verbose = FALSE,
		step = 1, reset = 10, alphas = 0.05, lambdas = NULL)
X.new = matrix(rnorm(n * p), ncol = p, nrow = n)
predict(Fit, X.new, 5)

kouroshz/creNet documentation built on Feb. 25, 2018, 12:41 p.m.