absolute.order | R Documentation |
This function orders the predictors by decreasing order of the magnitude of the estimated regression coefficient.
absolute.order(beta)
beta |
A vector of estimated regression coefficients. |
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)
beta.lasso = coef(cv.glmnet(X, y))[-1]
lasso.order = absolute.order(beta.lasso)
### ncvreg fit
library(ncvreg)
beta.scad = c(coef(cv.ncvreg(X, y))[-1])
scad.order = absolute.order(beta.scad)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.