Plot the coefficient path for fitted penalized elastic net S- or LS-estimates of regression.
# S3 method for class 'pense_fit'
plot(x, alpha, ...)
Other functions for plotting and printing:
plot.pense_cvfit()
,
prediction_performance()
,
summary.pense_cvfit()
# Compute the PENSE regularization path for Freeny's revenue data
# (see ?freeny)
data(freeny)
x <- as.matrix(freeny[ , 2:5])
regpath <- pense(x, freeny$y, alpha = 0.5)
plot(regpath)
# Extract the coefficients at a certain penalization level
coef(regpath, lambda = regpath$lambda[[1]][[40]])
#> (Intercept) lag.quarterly.revenue price.index
#> -7.9064997 0.2125014 -0.7070107
#> income.level market.potential
#> 0.7141099 1.0796662
# What penalization level leads to good prediction performance?
set.seed(123)
cv_results <- pense_cv(x, freeny$y, alpha = 0.5,
cv_repl = 2, cv_k = 4)
plot(cv_results, se_mult = 1)
# Extract the coefficients at the penalization level with
# smallest prediction error ...
coef(cv_results)
#> (Intercept) lag.quarterly.revenue price.index
#> -7.9064997 0.2125014 -0.7070107
#> income.level market.potential
#> 0.7141099 1.0796662
# ... or at the penalization level with prediction error
# statistically indistinguishable from the minimum.
coef(cv_results, lambda = '1-se')
#> (Intercept) lag.quarterly.revenue price.index
#> -7.8652589 0.2141280 -0.7053433
#> income.level market.potential
#> 0.7126978 1.0754335