Fig2.7 | R Documentation |
Reproduces Figure 2.7 from the book; if you specify any options, your results may look different.
Fig2.7()
Fig2.7()
# Default plot
attach_data(pollution)
cvfit <- cv.glmnet(std(X), y) # Standardize design matrix
plot(cvfit)
# Range of lambda values within 1 SE of minimum
lmin <- which(cvfit$lambda==cvfit$lambda.min)
range(cvfit$lambda[which(cvfit$cvm < cvfit$cvup[lmin])])
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.