predict.glmnetr {glmnetr}R Documentation

Get predicteds or coefficients using a glmnetr output object

Description

Give predicteds based upon a glmnetr() output object. Because the glmnetr() function has no cross validation information, lambda and gamma must be specified. To choose lambda and gamma based upon cross validation one may use the cv.glmnetr() or nested.glmnetr() and the corresponding predict() functions.

Usage

## S3 method for class 'glmnetr'
predict(object, xs_new = NULL, lam = NULL, gam = NULL, ...)

Arguments

object

A glmnetr output object

xs_new

A desing matrix for predictions

lam

The value for lambda for determining the lasso fit. Required.

gam

The value for gamma for determining the lasso fit. Required.

...

Additional arguments passed to the predict function.

Value

Coefficients or predictions using a glmnetr output object. When outputting coefficients (beta), creates a list with the first element, beta_, including 0 and non-0 terms and the second element, beta, including only non 0 terms.

See Also

glmnetr , cv.glmnetr , nested.glmnetr

Examples


set.seed(82545037)
sim.data=glmnetr.simdata(nrows=200, ncols=100, beta=NULL)
xs=sim.data$xs 
y_=sim.data$yt
event=sim.data$event
glmnetr.fit = glmnetr( xs, NULL, y_, event, family="cox")
betas = predict(glmnetr.fit,NULL,exp(-2),0.5 )
betas$beta



[Package glmnetr version 0.5-1 Index]