Determines the optimal lag order for a Vector Autoregression model using information criteria, stability checks, serial correlation tests, and optional out-of-sample validation.
choose_var_lag(
F_combined,
lag.max = 4,
type = "const",
p_pref = c("SC(n)", "HQ(n)"),
alpha = 0.05,
oos_eval = TRUE,
oos_start = 0.7,
verbose = TRUE
)List with components:
pSelected optimal lag order.
fitFitted VAR model object of class varest.
roots_okLogical indicating if stability condition is satisfied.
serial_okLogical indicating if serial correlation test passed.
oos_mseOut-of-sample mean squared error (if oos_eval = TRUE).
Numeric matrix (T x K) of factor scores to be modeled.
Integer. Maximum lag order to consider. Default is 4.
Character string. Type of deterministic terms: "const" (default), "trend", "both", or "none".
Character vector. Preferred information criteria for initial
selection. Default is c("SC(n)", "HQ(n)").
Numeric. Significance level for serial correlation test. Default is 0.05.
Logical. Should out-of-sample evaluation be performed? Default is TRUE.
Numeric. Proportion of sample to use for training in OOS validation. Default is 0.7.
Logical; print progress information. Default TRUE.
The function combines multiple selection criteria: (1) information criteria (AIC, BIC, HQ), (2) VAR stability (eigenvalue modulus < 1), (3) Portmanteau test for serial correlation, and (4) out-of-sample forecast performance. Returns the model that best balances these considerations.