coefpath.Rd
Visualize the coefficient path resulting from the elastic net
coefpath(model, ...) # S3 method for glmnet coefpath(model, xlab = "Log Lambda", ylab = "Coefficients", showLegend = c("onmouseover", "auto", "always", "follow", "never"), annotate = TRUE, elementID = NULL, ...) # S3 method for cv.glmnet coefpath(model, xlab = "Log Lambda", ylab = "Coefficients", showLegend = c("onmouseover", "auto", "always", "follow", "never"), annotate = TRUE, colorMin = "black", strokePatternMin = "dotted", labelMin = "lambda.min", locMin = c("bottom", "top"), color1se = "black", strokePattern1se = "dotted", label1se = "lambda.1se", loc1se = c("bottom", "top"), ...)
model | A |
---|---|
... | Arguments passed on to |
xlab | x-axis label |
ylab | y-axis label |
showLegend | When to display the legend. Specify "always" to always show the legend. Specify "onmouseover" to only display it when a user mouses over the chart. Specify "follow" to have the legend show as overlay to the chart which follows the mouse. The default behavior is "auto", which results in "always" when more than one series is plotted and "onmouseover" when only a single series is plotted. |
annotate | If |
elementID | Unique identified for dygraph, if |
colorMin | Color for line showing lambda.min |
strokePatternMin | Stroke pattern for line showing lambda.min |
labelMin | Label for line showing lambda.min |
locMin | Location for line showing lambda.min, can be 'bottom' or 'top' |
color1se | Color for line showing lambda.1se |
strokePattern1se | Stroke pattern for line showing lambda.1se |
label1se | Label for line showing lambda.1se |
loc1se | Location for line showing lambda.1se, can be 'bottom' or 'top' |
A dygraphs object
This is a replacement plot for visualizing the coefficient path resulting from the elastic net. This allows for interactively inspecting the plot so it is easier to disambiguate the coefficients.
library(glmnet)#>#>library(ggplot2) library(useful) data(diamonds) diaX <- useful::build.x(price ~ carat + cut + x - 1, data=diamonds, contrasts = TRUE) diaY <- useful::build.y(price ~ carat + cut + x - 1, data=diamonds) modG1 <- glmnet(x=diaX, y=diaY) coefpath(modG1)#>#> #>