path.order | R Documentation |
This function determines an ordering of the predictors based on the regularization path of the penalized regression; in particular, the predictors are ordered based on the order in which the coefficients are included in the model as the penalty strength decreases.
path.order(fit)
fit |
The output of a function such as |
An ordering of the predictors.
### generate synthetic data
set.seed(1)
n = 200
p = 300
X = matrix(rnorm(n*p),n,p)
beta = double(p)
beta[1:10] = 1:10
y = X %*% beta + rnorm(n)
### glmnet fit
library(glmnet)
fit.lasso = glmnet(X, y)
lasso.order = path.order(fit.lasso)
### ncvreg fit
library(ncvreg)
fit.scad = ncvreg(X, y)
scad.order = path.order(fit.scad)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.