View source: R/postsurvplots.R
plot.glmnetsurvcv | R Documentation |
Plots the cross-validation curve, and upper and lower standard deviation curves, as a function of the optimal lambdas. Also, plots the solution path as a function of optimal lambdas (or randomly picked fold, if refit = FALSE
) or l1
-norm.
## S3 method for class 'glmnetsurvcv' plot( x, ..., type = c("cve", "fit"), xvar = c("lambda", "l1"), show_nzero = FALSE, seed = 1234 )
x |
fitted |
... |
for future implementations |
type |
which plot to return. |
xvar |
only if |
show_nzero |
logical. Whether to show number of nonzero coefficients on the plot. Default is |
seed |
random number generator. Important if |
To plot solution path corresponding to optimal alpha and lambda, set refit = TRUE
in glmnetsurvcv
. The plot is a ggplot
object, hence can be be customized further.
a ggplot
object.
library(ggplot2) data(veteran, package="survival") # Using a vector of alphas = (0.8, 1) cv1 <- glmnetsurvcv(Surv(time, status) ~ factor(trt) + karno + diagtime + age + prior , data = veteran , alpha = c(0.8, 1) , refit = TRUE ) # Plot cross-validation curves plot(cv1, type = "cve") # Plot plot(cv1, type = "fit")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.