Learn R Programming

MESS (version 0.5.12)

adaptive.weights: Compute weights for use with adaptive lasso.

Description

Fast computation of weights needed for adaptive lasso based on Gaussian family data.

Usage

adaptive.weights(x, y, nu = 1, weight.method = c("multivariate", "univariate"))

Value

Returns a list with two elements:

weights

the computed weights

nu

the value of nu used for the computations

Arguments

x

input matrix, of dimension nobs x nvars; each row is an observation vector.

y

response variable.

nu

non-negative tuning parameter

weight.method

Should the weights be computed for multivariate regression model (only possible when the number of observations is larger than the number of parameters) or by individual marginal/"univariate" regression coefficients.

Author

Claus Ekstrom claus@rprimer.dk

Details

The weights returned are 1/abs(beta_hat)^nu where the beta-parameters are estimated from the corresponding linear model (either multivariate or univariate).

References

Xou, H (2006). The Adaptive Lasso and Its Oracle Properties. JASA, Vol. 101.

See Also

glmnet

Examples

Run this code

set.seed(1)
x <- matrix(rnorm(50000), nrow=50)
y <- rnorm(50, mean=x[,1])
weights <- adaptive.weights(x, y)

if (requireNamespace("glmnet", quietly = TRUE)) {
    res <- glmnet::glmnet(x, y, penalty.factor=weights$weights)
    head(res)
}

Run the code above in your browser using DataLab