sis_lasso: Sure independence screening followed by lasso

Description Usage Arguments Value Examples

View source: R/sis_lasso.R

Description

Sure independence screening followed by lasso

Usage

1
2
3
4
5
6
7
8
9
sis_lasso(
  x,
  y,
  num_keep = NULL,
  lam_min_ratio = ifelse(nrow(x) < ncol(x), 0.01, 1e-04),
  nfold = 5,
  foldid = NULL,
  ...
)

Arguments

x

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

y

A response vector of size n.

num_keep

Number of variables to keep in the screening phase

...

other arguments to be passed to the glmnet calls, such as alpha or penalty.factor

Value

An object of S3 class "cv.hier".

n

The sample size.

p

The number of main effects.

fit

The whole cv.glmnet fit object.

compact

A compact representation of the selected variables. compact has three columns, with the first two columns representing the indices of a selected variable (main effects with first index = 0), and the last column representing the estimate of coefficients.

Examples

1
2
3
4
5
6
7
set.seed(123)
n <- 100
p <- 200
# dense input
x <- matrix(rnorm(n * p), n, p)
y <- x[, 1] - 2 * x[, 2] + 3 * x[, 1] * x[, 3] - 4 * x[, 4] * x[, 5] + rnorm(n)
mod <- hier_lasso(x = x, y = y)

hugogogo/sprintr documentation built on Dec. 14, 2021, 6:07 p.m.