View source: R/summary.cv.glmnetr_240608.R
predict.glmnetr | R Documentation |
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.
## S3 method for class 'glmnetr'
predict(object, xs_new = NULL, lam = NULL, gam = NULL, ...)
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. |
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.
glmnetr
, cv.glmnetr
, nested.glmnetr
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
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.