Learn R Programming

CSUV (version 0.1.1)

csuv: Get the fitted results from Combined Selection and Uncertainty Visualiser (CSUV) method

Description

Get the fitted results from Combined Selection and Uncertainty Visualiser (CSUV) method

Usage

csuv(
  X,
  Y,
  intercept,
  method.names = NULL,
  coef.est.method = lm.ols,
  B = 100,
  q = 0,
  fit.percent = 0.5,
  selection.criterion = "mse",
  num.core = 1,
  all.fits = 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 in CSUV. Choose among "lasso", "elastic", "relaxo", "mcp" and "scad". Default is to use all methods listed above

coef.est.method

method to estimate the coefficients of covariates after variable selection. User can provide his/her function. Default is ordinary least square

B

number of subsampling. Default is 100

q

percentile of fitted models used per each subsampling in CSUV, according to the selection criterion on out-of-sample data in ascending order. Default is q = 0 (only the fitted model with the lowest MSE in a subsampling data is used)

fit.percent

percentage of observations used in fitting in CSUV

selection.criterion

= c("mse", "ebic"). Measure to select fitted models in subsampling dataset. "mse" is mean square error and "ebic" is extended BIC. Default is mse

num.core

number of cores to use. Default is 1 (i.e. no parallel running)

all.fits

(optional) all fitted models. If all.fits is provided, then CSUV will use the fitted models in all.fitted instead of fitting using subsampling data

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

a list, which includes estimated coefficients (est.b), subsampling fitted models (mod.collection), number of times a method is selected (method.freq), relative frequency of each covariate (variable.freq), covariates ordered by relative frequency (variable.order).

Examples

Run this code
# NOT RUN {
X = matrix(rnorm(1000), nrow = 100)
Y = rowSums(X[,1:3])+rnorm(100)
mod.0 = csuv(X, Y, intercept = FALSE, q = 0, method.names = NULL)
print(mod.0)
mod.5 = csuv(X, Y, intercept = FALSE, q = 5, all.fits = mod.0$all.fits)
print(mod.5)
# }

Run the code above in your browser using DataLab