Description Usage Arguments Details Value Examples
Fit a linear model via penalized maximum likelihood. The regularization path is computed for the elasticnet penalty at a grid of values for the regularization parameter lambda, using coordinate descent algorithm.
1 2 | elnet_coord(X, y, alpha = 1, lambda.length = 100, maxit = 10000,
eps = 1e-05)
|
X |
input matrix, of dimension nobs x nvars; each row is an observation vector. |
y |
response variable. |
alpha |
The elasticnet mixing parameter, with 0≤ α ≤ 1. The penalty is defined as (1-α)/2||β||_2^2+α ||β||_1 α=1 is the lasso penalty, and α=0 the ridge penalty. |
lambda.length |
The length of |
maxit |
Maximum number of passes over the data for all lambda values; default is 10^5. |
eps |
Convergence threshold for coordinate descent. Each inner coordinate-descent loop continues until the maximum change in the objective after any coefficient update is less than |
The sequence of models implied by lambda
is fit by coordinate descent. The objective function is
1/2 RSS/nobs + λ* penalty
.
beta
a list of fitted coefficients corresponding to the decreasing lambda
sequence.
lambda
the actural sequence of lambda
values used. When alpha=0, the largest lambda reported does not quite give the zero coefficients reported (lambda=inf would in principle). Instead, the largest lambda for alpha=0.01 is used, and the sequence of lambda values is derived from this.
1 2 3 4 5 | # Gaussian
x=matrix(rnorm(100*20),100,20)
y=rnorm(100)
fit1=elnet_coord(x,y)
plotpath(fit1,x)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.