Learn R Programming

convergenceDFM (version 0.1.4)

choose_var_lag: Select optimal VAR lag order with multiple criteria

Description

Determines the optimal lag order for a Vector Autoregression model using information criteria, stability checks, serial correlation tests, and optional out-of-sample validation.

Usage

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
)

Value

List with components:

p

Selected optimal lag order.

fit

Fitted VAR model object of class varest.

roots_ok

Logical indicating if stability condition is satisfied.

serial_ok

Logical indicating if serial correlation test passed.

oos_mse

Out-of-sample mean squared error (if oos_eval = TRUE).

Arguments

F_combined

Numeric matrix (T x K) of factor scores to be modeled.

lag.max

Integer. Maximum lag order to consider. Default is 4.

type

Character string. Type of deterministic terms: "const" (default), "trend", "both", or "none".

p_pref

Character vector. Preferred information criteria for initial selection. Default is c("SC(n)", "HQ(n)").

alpha

Numeric. Significance level for serial correlation test. Default is 0.05.

oos_eval

Logical. Should out-of-sample evaluation be performed? Default is TRUE.

oos_start

Numeric. Proportion of sample to use for training in OOS validation. Default is 0.7.

verbose

Logical; print progress information. Default TRUE.

Details

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.