cv_corrected_lasso: Cross-validated Corrected lasso

View source: R/cv_corrected_lasso.R

cv_corrected_lassoR Documentation

Cross-validated Corrected lasso

Description

Cross-validated Corrected lasso

Usage

cv_corrected_lasso(
  W,
  y,
  sigmaUU,
  n_folds = 10,
  family = "gaussian",
  radii = NULL,
  no_radii = 100,
  alpha = 0.1,
  maxits = 5000,
  tol = 1e-12
)

Arguments

W

Design matrix, measured with error.

y

Vector of the continuous response value.

sigmaUU

Covariance matrix of the measurement error.

n_folds

Number of folds to use in cross-validation. Default is 100.

family

Only "gaussian" is implemented at the moment.

radii

Optional vector containing the set of radii of the l1-ball onto which the solution is projected.

no_radii

Length of vector radii, i.e., the number of regularization parameters to fit the corrected lasso for.

alpha

Optional step size of the projected gradient descent algorithm. Default is 0.1.

maxits

Optional maximum number of iterations of the project gradient descent algorithm for each radius. Default is 5000.

tol

Iteration tolerance for change in sum of squares of beta. Defaults to 1e-12.

Details

Corrected version of the lasso for the case of linear regression, estimated using cross-validation. The method does require an estimate of the measurement error covariance matrix.

Value

An object of class "cv_corrected_lasso".

References

\insertRef

loh2012hdme

\insertRef

sorensen2015hdme

Examples

# Gaussian
set.seed(100)
n <- 100; p <- 50 # Problem dimensions
# True (latent) variables
X <- matrix(rnorm(n * p), nrow = n)
# Measurement error covariance matrix
# (typically estimated by replicate measurements)
sigmaUU <- diag(x = 0.2, nrow = p, ncol = p)
# Measurement matrix (this is the one we observe)
W <- X + rnorm(n, sd = sqrt(diag(sigmaUU)))
# Coefficient
beta <- c(seq(from = 0.1, to = 1, length.out = 5), rep(0, p-5))
# Response
y <- X %*% beta + rnorm(n, sd = 1)
# Run the corrected lasso
cvfit <- cv_corrected_lasso(W, y, sigmaUU, no_radii = 5, n_folds = 3)
plot(cvfit)
print(cvfit)
# Run the standard lasso using the radius found by cross-validation
fit <- corrected_lasso(W, y, sigmaUU, family = "gaussian",
radii = cvfit$radius_min)
coef(fit)
plot(fit)

hdme documentation built on May 31, 2023, 5:44 p.m.