lm.compare.method: Get fitted models by fitting some variable selection methods

Description Usage Arguments Value Examples

View source: R/fit_helper.r

Description

Get fitted models by fitting some variable selection methods

Usage

1
lm.compare.method(X, Y, intercept, method.names = NULL, log.level = NULL)

Arguments

X

covariates (n times p matrix, n: number of entries, p: number of covariates)

Y

response (vector with n entries)

intercept

TRUE to fit the data with an intercept, FALSE to fit the data without an intercept

method.names

vector of method names to be used for fitting. Choose among "lasso", "elastic", "relaxo", "mcp" and "scad". Default is to fit the data using all methods listed above

log.level

log level to set. Default is NULL, which means no change in log level. See the function CSUV::set.log.level for more details

Value

estimated coefficients in a form of matrix. Each row corresponds to a method and each column corresponds to a covariate, with the first column corresponds to the intercept

Examples

1
2
3
4
X = matrix(rnorm(1000), nrow = 100)
Y = rowSums(X[,1:3])+rnorm(100)
compare.mod = lm.compare.method(X, Y, intercept = FALSE)
print(compare.mod)

CSUV documentation built on Oct. 23, 2020, 5:49 p.m.

Related to lm.compare.method in CSUV...