thetafit: Nodewise LASSO regressions to fit the precision matrix Theta.

View source: R/thetafit.R

thetafitR Documentation

Nodewise LASSO regressions to fit the precision matrix Θ.

Description

Fits the precision matrix Θ by running nodewise LASSO regressions.

Usage

thetafit(x, parallel = FALSE, ncores = getOption("mc.cores", NULL), 
         intercept = FALSE, K = 20, l = 5, seed = NULL, verbose = FALSE, 
         registerpar = TRUE, ...)

Arguments

x

T by p data matrix, where T and p respectively denote the sample size and the number of regressors.

parallel

if TRUE, use parallel foreach to fit nodewise LASSO regressions. Parallel registered within the function.

ncores

number of cores used in parallelization

intercept

whether intercept be fitted (TRUE) or set to zero (FALSE). Default is FALSE.

K

number of folds of the cv loop. Default set to 20.

l

the gap used to drop observations round test set data. See tscv.sglfit for more details.

seed

set a value for seed to control results replication, i.e. set.seed(seed) is used. seed is stored in the output list. Default set to as.numeric(Sys.Date()).

verbose

if TRUE, prints progress bar. Default set to FALSE.

registerpar

if TRUE, register parallelization using registerDoParallel. Default set to TRUE.

...

Other arguments that can be passed to tscv.sglfit.

Details

The function runs tscv.sglfit p times by regressing j-th covariate on all other covariates excluding j-th covariate. The precision matrix is then constructed based on LASSO estimates. Each nodewise LASSO regression tuning parameter λ is optimized using time series cross-validation. See tscv.sglfit for more details on cross-validation implementation.

Value

thetafit object.

Author(s)

Jonas Striaukas

Examples

 
set.seed(1)
x = matrix(rnorm(100 * 20), 100, 20)
thetafit(x = x, parallel = FALSE)


jstriaukas/midasml documentation built on Oct. 5, 2022, 12:18 a.m.