extended.lasso | R Documentation |
This function takes a matrix of candidate predictors X and a vector of response variables Y and performs lasso regression.
extended.lasso(X, Y, lambda = NULL, ytype = "continuous")
X |
an n by p matrix of candidate predictors. |
Y |
an n by 1 vector of responses |
lambda |
an optional lambda value. If no lambda is provided, an optimal lambda is automatically determined using glmnet::cv.glmnet(alpha=1). |
ytype |
description as to whether or not the response variable y is binary or continuous. Defaults to 'continuous'. |
n <- 200 p <- 500 s <- 10 beta <- rep(0, p) beta[1:s] <- runif(s, 1/3, 1) x <- rmvnorm(n = n, mean = rep(0, p), method = "svd") signal <- sqrt(mean((x %*% beta)^2)) sigma <- as.numeric(signal / sqrt(10)) # SNR=10 y <- x %*% beta + rnorm(n) extended.lasso(x,y)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.