Compute elastic net Sestimates (PENSE estimates) along a grid of penalization levels with optional penalty loadings for adaptive elastic net.
pense( x, y, alpha, nlambda = 50, nlambda_enpy = 10, lambda, lambda_min_ratio, enpy_lambda, penalty_loadings, intercept = TRUE, bdp = 0.25, cc, add_zero_based = TRUE, enpy_specific = FALSE, other_starts, eps = 1e06, explore_solutions = 10, explore_tol = 0.1, max_solutions = 10, comparison_tol = sqrt(eps), sparse = FALSE, ncores = 1, standardize = TRUE, algorithm_opts = mm_algorithm_options(), mscale_opts = mscale_algorithm_options(), enpy_opts = enpy_options(), cv_k = deprecated(), cv_objective = deprecated(), ... )
x 


y  vector of response values of length 
alpha  elastic net penalty mixing parameter with \(0 \le \alpha \le 1\). 
nlambda  number of penalization levels. 
nlambda_enpy  number of penalization levels where the ENPY initial estimate is computed. 
lambda  optional usersupplied sequence of penalization levels. If given and not 
lambda_min_ratio  Smallest value of the penalization level as a fraction of the largest level (i.e., the
smallest value for which all coefficients are zero). The default depends on the sample
size relative to the number of variables and 
enpy_lambda  optional usersupplied sequence of penalization levels at which ENPY initial estimates are
computed. If given and not 
penalty_loadings  a vector of positive penalty loadings (a.k.a. weights) for different penalization of each
coefficient. Only allowed for 
intercept  include an intercept in the model. 
bdp  desired breakdown point of the estimator, between 0 and 0.5. 
cc  tuning constant for the Sestimator. Default is to chosen based on the breakdown point 
add_zero_based  also consider the 0based regularization path. See details for a description. 
enpy_specific  use the ENPY initial estimates only at the penalization level they are computed for. See details for a description. 
other_starts  a list of other staring points, created by 
eps  numerical tolerance. 
explore_solutions  number of solutions to compute up to the desired precision 
explore_tol  numerical tolerance for exploring possible solutions. Should be (much) looser than 
max_solutions  only retain up to 
comparison_tol  numeric tolerance to determine if two solutions are equal. The comparison is first done
on the absolute difference in the value of the objective function at the solution
If this is less than 
sparse  use sparse coefficient vectors. 
ncores  number of CPU cores to use in parallel. By default, only one CPU core is used. May not be supported on your platform, in which case a warning is given. 
standardize  logical flag to standardize the 
algorithm_opts  options for the MM algorithm to compute the estimates. See 
mscale_opts  options for the Mscale estimation. See 
enpy_opts  options for the ENPY initial estimates, created with the

cv_k, cv_objective  deprecated and ignored. See 
...  ignored. See the section on deprecated parameters below. 
a listlike object with the following items
lambda
the sequence of penalization levels.
estimates
a list of estimates. Each estimate contains the following information:
intercept
intercept estimate.
beta
beta (slope) estimate.
lambda
penalization level at which the estimate is computed.
alpha
alpha hyperparameter at which the estimate is computed.
objf_value
value of the objective function at the solution.
statuscode
if > 0
the algorithm experienced issues when computing the estimate.
status
optional status message from the algorithm.
call
the original call.
The function supports several different strategies to compute, and use the provided starting points for optimizing the PENSE objective function.
Starting points are computed internally but can also be supplied via other_starts
.
By default, starting points are computed internally by the ENPY procedure for penalization levels supplied
in enpy_lambda
(or the automatically generated grid of length nlambda_enpy
).
By default, starting points computed by the ENPY procedure are shared for all penalization levels in lambda
(or the automatically generated grid of length nlambda
).
If the starting points should be specific to the penalization level the starting points' penalization level,
set the enpy_specific
argument to TRUE
.
In addition to ENPY initial estimates, the algorithm can also use the "0based" strategy if
add_zero_based = TRUE
(by default). Here, the 0vector is used to start the optimization at the largest
penalization level in lambda
. At subsequent penalization levels, the solution at the previous penalization level
is also used as starting point.
At every penalization level, all starting points are explored using the loose numerical tolerance explore_tol
.
Only the best explore_solutions
are computed to the stringent numerical tolerance eps
.
Finally, only the best max_solutions
are retained and carried forward as starting points for the subsequent
penalization level.
Starting with version 2.0.0, crossvalidation is performed by separate function pense_cv()
.
Arguments related crossvalidation cause an error when supplied to pense()
.
Furthermore, the following arguments are deprecated as of version 2.0.0:
initial
, warm_reset
, cl
, options
, init_options
, en_options
.
If pense()
is called with any of these arguments, warnings detail how to replace them.
pense_cv()
for selecting hyperparameters via crossvalidation.
coef.pense_fit()
for extracting coefficient estimates.
plot.pense_fit()
for plotting the regularization path.
Other functions to compute robust estimates:
regmest()
# 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[40])#> (Intercept) lag.quarterly.revenue price.index #> 6.6475338 0.2411667 0.6985229 #> income.level market.potential #> 0.7098337 0.9619783# What penalization level leads to good prediction performance? 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.8411184 0.2115870 0.7062462 #> income.level market.potential #> 0.6956763 1.0835638# ... or at the penalization level with prediction error # statistically indistinguishable from the minimum. coef(cv_results, lambda = 'se')#> (Intercept) lag.quarterly.revenue price.index #> 10.2047807 0.2111069 0.6464577 #> income.level market.potential #> 0.6199943 1.2792788