Estimate a regime-dependent VAR (i.e. a state-dependent VAR), with an exogenous state indicator, of the specification: $$Y_{t+1} = X_t \beta_{s_t} + \epsilon_t$$ where t is the time index, Y is the set of outcome vectors, X the design matrix (of p lagged values of Y), and s is a mutually exclusive state of the world observed at time t. When the regime vector is not supplied by the user, then a two-state regime series is estimated via random forest.
RVAR( data, horizon = 10, freq = "month", type = "const", p = 1, lag.ic = NULL, lag.max = NULL, regime = NULL, regime.method = "rf", regime.n = 2, structure = "short", instrument = NULL, instrumented = NULL )
data | data.frame, matrix, ts, xts, zoo: Endogenous regressors |
---|---|
horizon | int: forecast horizons |
freq | string: frequency of data ('day', 'week', 'month', 'quarter', or 'year') |
type | string: type of deterministic terms to add ('none', 'const', 'trend', or 'both') |
p | int: lags |
lag.ic | string: information criterion to choose the optimal number of lags ('AIC' or 'BIC') |
lag.max | int: maximum number of lags to test in lag selection |
regime | string: name or regime assignment vector in the design matrix (data) |
regime.method | string: regime assignment technique ('rf', 'kmeans', 'EM', or 'BP') |
regime.n | int: number of regimes to estimate (applies to kmeans and EM) |
structure | string: type of structural identification strategy to use in model analysis (NA, 'short', 'IV', or 'IV-short') |
instrument | string: name of instrumental variable contained in the data matrix |
instrumented | string: name of variable to be instrumented in IV and IV-short procedure; default is the first non-date variable in data |
List of lists, where each regime is a list with items:
data: data.frame with endogenous variables and 'date' column.
model: list with data.frame of model coefficients (in psuedo-companion form), data.frame of coefficient standard errors, integer of lags p, integer of horizons, string of frequency, string of deterministic term type, numeric of log-likelihood, regime indicator
forecasts: list of data.frames per horizon; data.frame with column for date (day the forecast was made), forecast.date (the date being forecasted), target (variable forecasted), and forecast
residuals: list of data.frames per horizon; data.frame of residuals
structure: string denoting which structural identification strategy will be used in analysis (or NA)
instrument: data.frame with 'date' column and 'instrument' column (or NULL)
instrumented: string denoting which column will be instrumted in 'IV' and 'IV-short' strategies (or NULL)
The regime-dependent VAR is a generalization of the popular threshold VAR - which trades off estimating a threshold value for an endogenous variable for accepting an exogenous regime that can be based on information from inside or outside of the system, with or without parametric assumptions, and with or without timing restrictions. Moreover, the RVAR may be extended to include structural shocks, including the use of instrumental variables.
State dependence. The RVAR augments the traditional VAR by allowing state-dependence in the coefficient matrix. The RVAR differs from the more common threshold VAR (TVAR), due
to the fact that states are exegonesouly determined. As a result, the states (i.e. regimes) do not need to be based on information inside the model, moreover, regimes can be
determined by any process the user determines best fits their needs. For example, regimes based on NBER dated recessions and expansions are based on a judgmental process
considering hundreds of series, potentially none of which are in the VAR being modeled. Alternatively, a user may use unsupervised machine learning to assign regimes - this is
the process the sovereign::regimes
function facilitates.
Structural shocks. See Sims (1980) for details regarding the baseline vector-autoregression (VAR) model. The VAR may be augmented to become a structural VAR (SVAR) with one of three different structural identification strategies:
short-term impact restrictions via Cholesky decomposition, see Christiano et al (1999) for details (structure = 'short')
external instrument identification, i.e. a Proxy-SVAR strategy, see Mertens and Ravn (2013) for details (structure = 'IV')
or a combination of short-term and IV identification via Lunsford (2015) (structure = 'IV-short')
Note that including structure does not change the estimation of model coefficients or forecasts, but does change impulse response functions, forecast error variance decomposition, and historical decompositions. Historical decompositions will not be available for models using the 'IV' structure. Additionally note that only one instrument may be used in this estimation routine.
Christiano, Lawrence, Martin Eichenbaum, and Charles Evans "Monetary policy shocks: What have we learned and to what end?" Handbook of Macroeconomics, Vol 1, Part A, 1999.
Lunsford, Kurt "Identifying Structural VARs with a Proxy Variable and a Test for a Weak Proxy" 2015.
Mertens, Karel and Morten Ravn "The Dynamic Effects of Personal and Corporate Income Tax Changes in the United States" 2013.
Sims, Christopher "Macroeconomics and Reality" 1980.
# \donttest{ # simple time series AA = c(1:100) + rnorm(100) BB = c(1:100) + rnorm(100) CC = AA + BB + rnorm(100) date = seq.Date(from = as.Date('2000-01-01'), by = 'month', length.out = 100) Data = data.frame(date = date, AA, BB, CC) Data = dplyr::mutate(Data, reg = dplyr::if_else(AA > median(AA), 1, 0)) # estimate regime-dependent VAR rvar = sovereign::RVAR( data = Data, horizon = 10, freq = 'month', regime.method = 'rf', regime.n = 2, lag.ic = 'BIC', lag.max = 4)#> Warning: NAs introduced by coercion#> Warning: NAs introduced by coercion#> Warning: NAs introduced by coercion#> Warning: NAs introduced by coercion