Skip to contents

This function computes the Akaike Information Criterion (AIC), Bayesian Information Criterion (BIC), and Extended Bayesian Information Criterion (EBIC) for a given matrix of predictors X, a matrix of outcomes Y, and a vector of lambda hyperparameters for Lasso regularization.

Usage

SearchVARLasso(YStd, XStd, lambdas, 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.

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

List with the following elements:

  • criteria: Matrix with columns for lambda, AIC, BIC, and EBIC values.

  • fit: List of matrices containing the estimated autoregressive and cross-regression coefficients for each lambda.

Author

Ivan Jacob Agaloos Pesigan

Examples

YStd <- StdMat(dat_p2_yx$Y)
XStd <- StdMat(dat_p2_yx$X[, -1])
lambdas <- 10^seq(-5, 5, length.out = 100)
search <- SearchVARLasso(YStd = YStd, XStd = XStd, lambdas = lambdas,
  max_iter = 10000, tol = 1e-5)
plot(x = 1:nrow(search$criteria), y = search$criteria[, 4],
  type = "b", xlab = "lambda", ylab = "EBIC")