Skip to contents

Fit Vector Autoregressive (VAR) Model Parameters using Lasso Regularization with Lambda Search

Usage

FitVARLassoSearch(YStd, XStd, lambdas, crit, max_iter, tol)

Arguments

YStd

Numeric matrix. Matrix of standardized dependent variables (Y).

XStd

Numeric matrix. Matrix of standardized predictors (X). XStd should not include a vector of ones in column one.

lambdas

Numeric vector. Lasso hyperparameter. The regularization strength controlling the sparsity.

crit

Character string. Information criteria to use. Valid values include "aic", "bic", and "ebic".

max_iter

Integer. The maximum number of iterations for the coordinate descent algorithm (e.g., max_iter = 10000).

tol

Numeric. Convergence tolerance. The algorithm stops when the change in coefficients between iterations is below this tolerance (e.g., tol = 1e-5).

Value

Matrix of estimated autoregressive and cross-regression coefficients.

Author

Ivan Jacob Agaloos Pesigan

Examples

YStd <- StdMat(dat_p2_yx$Y)
XStd <- StdMat(dat_p2_yx$X[, -1]) # remove the constant column
lambdas <- LambdaSeq(
  YStd = YStd,
  XStd = XStd,
  n_lambdas = 100
)
FitVARLassoSearch(
  YStd = YStd,
  XStd = XStd,
  lambdas = lambdas,
  crit = "ebic",
  max_iter = 1000,
  tol = 1e-5
)
#>           [,1]     [,2]     [,3]       [,4]      [,5]      [,6]
#> [1,] 0.3429428 0.000000 0.000000 0.08487819 0.0000000 0.0000000
#> [2,] 0.0000000 0.457026 0.000000 0.00000000 0.2120426 0.0000000
#> [3,] 0.0000000 0.000000 0.588127 0.00000000 0.0000000 0.2737749