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.
Examples
### 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)
#> Error in library(ncvreg): there is no package called ‘ncvreg’
fit.scad = ncvreg(X, y)
#> Error in ncvreg(X, y): could not find function "ncvreg"
scad.order = path.order(fit.scad)
#> Error: object 'fit.scad' not found