library("MASS")
pdf("ridge_regression.pdf", width=10, height=6)
par(mfrow=c(1,2))
lmr <- lm.ridge(GNP.deflator ~ ., longley, lambda = seq(0,0.05,0.0001))
plot(lmr)
title("Ridge traces")
plot(lmr$lambda, lmr$GCV, type="l", xlab=expression(lambda), ylab="Mean squared error", main="Generalized crossvalidation")
abline(v=lmr$lambda[which.min(lmr$GCV)], col="red")
dev.off()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.