View source: R/plot.cv.glmnetr_250503.R
plot.glmnetr | R Documentation |
Plot the relaxed lasso, elastic net or ridge model coefficients from a nested.glmnetr() output object. One may specify a value for gamma. If gamma is unspecified (NULL), then the plot will be for the gamma which minimizes loss.
## S3 method for class 'glmnetr'
plot(
x,
type = "lasso",
alpha = NULL,
gamma = NULL,
lambda.lo = NULL,
title = NULL,
comment = TRUE,
...
)
x |
A nested.glmnetr output object. |
type |
one of c("lasso", "elastic", "ridge") to plot the deviance curves of the respective model fit. Default is "lasso". |
alpha |
A specific level of alpha for plotting. By default alpha.min will be used such that the triplet (alpha.min, gamma.min, lambda.min) minimizes the model deviance. |
gamma |
A specific level of gamma for plotting. By default gamma.min will be used such that the pair (gamma.min, lambda.min) minimzes the model deviance. |
lambda.lo |
A lower limit of lambda for plotting. |
title |
A title for the plot |
comment |
Default of TRUE to write to console information on gamma and lambda selected for output. FALSE will suppress this write to console. |
... |
Additional arguments passed to the plot function. |
This program returns a plot to the graphics window, and may provide some numerical information to the R Console. If gamma is not specified, then the gamma.min from the deviance minimizing (lambda.min, gamma.min) pair will be used, and the minimizing lambda.min will be indicated by a vertical line. Also, if one specifies gamma=0, the lambda which minimizes deviance for the restricted set of models where gamma=0 will indicated by a vertical line.
plot.cv.glmnetr
, plot.nested.glmnetr
set.seed(82545037)
sim.data=glmnetr.simdata(nrows=200, ncols=100, beta=NULL)
xs=sim.data$xs
yt=sim.data$yt
yg=sim.data$yt
event=sim.data$event
glmnetr.fit = nested.glmnetr(xs, start=NULL, yg, event=event, family="gaussian",
resample=0, folds_n=4)
plot(glmnetr.fit, type="lasso")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.