regPenalized: Penalized high dimensional regresssion

Description Usage Arguments Value Examples

Description

This function uses a particular penalized regression "MCP", "SCAD", or "lasso" and cross validation to find the regression variables and cofficients, and generate prediction (on a testing design matrix), selected variable support, a solution path. The function relies on ncvreg package. Intercept is considered.

Usage

1
regPenalized(dat, hd_method, dfmax = NULL, X_test = NULL)

Arguments

dat

List containing design Matrix X and observations Vector y

hd_method

Strong ("MCP", "SCAD", "lasso") indicating the method in use

dfmax

Integer of maximum number of variables to select, default to the number of variables

X_test

Matrix of design (for testing)

Value

pre_opt Vector of predicted observations of size 'number of test size' x 1

supp_opt Vector of indices of the selected variables

Beta Matrix of estimated coefficients along solution path, of size ('number of variables' + 1) x 'number of lambdas'

fit Object of from package 'ncvreg' that can be used to predict

Examples

1
2
3
4
5
6
7
8
9
n <- 150
p <- 200
X <- genDesignMat(n,p,0.5)
beta <- rep(0, p)
beta[c(99,199)] = c(10, 5)
mu <- X %*% as.matrix(beta, ncol=1)
y <- mu + stats::rnorm(n)
dat <- list(X = X, y= y)
res <- regPenalized(dat, c("MCP", "SCAD", "lasso"))

JieGroup/bc documentation built on June 1, 2019, 12:48 p.m.