nlasso_path {natural}R Documentation

Fit a linear model with natural lasso

Description

Calculate a solution path of the natural lasso estimate (of error standard deviation) with a list of tuning parameter values. In particular, this function solves the lasso problems and returns the lasso objective function values as estimates of the error variance: \hat{\sigma}^2_{\lambda} = \min_{\beta} ||y - X \beta||_2^2 / n + 2 \lambda ||\beta||_1. The output also includes a path of naive estimates and a path of degree of freedom adjusted estimates of the error standard deviation.

Usage

nlasso_path(x, y, lambda = NULL, nlam = 100, flmin = 0.01,
  thresh = 1e-08, intercept = TRUE, glmnet_output = NULL)

Arguments

x

An n by p design matrix. Each row is an observation of p features.

y

A response vector of size n.

lambda

A user specified list of tuning parameter. Default to be NULL, and the program will compute its own lambda path based on nlam and flmin.

nlam

The number of lambda values. Default value is 100.

flmin

The ratio of the smallest and the largest values in lambda. The largest value in lambda is usually the smallest value for which all coefficients are set to zero. Default to be 1e-2.

thresh

Threshold value for the underlying optimization algorithm to claim convergence. Default to be 1e-8.

intercept

Indicator of whether intercept should be fitted. Default to be TRUE.

glmnet_output

Should the estimate be computed using a user-specified output from glmnet. If not NULL, it should be the output from glmnet call with standardize = TRUE, and then the arguments lambda, nlam, flmin, thresh, and intercept will be ignored. Default to be NULL, in which case the function will call glmnet internally.

Value

A list object containing:

n and p:

The dimension of the problem.

lambda:

The path of tuning parameters used.

beta:

Matrix of estimates of the regression coefficients, in the original scale. The matrix is of size p by nlam. The j-th column represents the estimate of coefficient corresponding to the j-th tuning parameter in lambda.

a0:

Estimate of intercept. A vector of length nlam.

sig_obj_path:

Natural lasso estimates of the error standard deviation. A vector of length nlam.

sig_naive_path:

Naive estimates of the error standard deviation based on lasso regression, i.e., ||y - X \hat{\beta}||_2 / \sqrt n. A vector of length nlam.

sig_df_path:

Degree-of-freedom adjusted estimate of standard deviation of the error. A vector of length nlam. See Reid, et, al (2016).

type:

whether the output is of a natural or an organic lasso.

See Also

nlasso_cv

Examples

set.seed(123)
sim <- make_sparse_model(n = 50, p = 200, alpha = 0.6, rho = 0.6, snr = 2, nsim = 1)
nl_path <- nlasso_path(x = sim$x, y = sim$y[, 1])

[Package natural version 0.9.0 Index]