cultivars.multivariate.nonlinear.time_varying#
Time-varying-parameter VARs: drift instead of switching, posteriors instead of dates.
Where the regime families let parameters jump between a few states, here they drift: the stacked coefficient vector follows a random walk, and under stochastic volatility so do the log variances,
so every date has its own VAR and its own covariance (the homoskedastic model holds \(\Sigma_t = \Sigma\)). This is the Cogley-Sargent / Primiceri (2005) workhorse for questions like whether monetary policy transmission itself has changed – questions a constant-parameter model cannot even pose.
Two commitments shape the surface. First, estimation is Bayesian by
necessity, not preference: an unrestricted coefficient path has more
parameters than observations, and what disciplines it is the prior on how
fast parameters may drift. Following Primiceri, a training sample is
split off the front, its OLS estimates calibrate the coefficient prior and
the drift scale k_drift (his \(k_Q\)) and the volatility scale
k_vol (his \(k_W\)), and it is then discarded rather than used
twice. Those two scales are the model’s findings in disguise: at the
defaults of 0.01 a coefficient that drifts by several tenths, or a
volatility that triples, over a few hundred observations is reported as
nearly flat, so the results compare each path’s movement with its own
band and the user is expected to vary the scales. The sampler is Gibbs on
the package’s own state-space substrate: every coefficient-path draw is
one Durbin-Koopman simulation-smoother call, the covariance blocks are
conjugate inverse-Wisharts, and the stochastic-volatility block is
Kim-Shephard-Chib, with the log-volatility innovation covariance
\(W\) diagonal as in Cogley and Sargent rather than Primiceri’s full
matrix. Second, under SV the innovation covariance is parameterized
through a constant unit-lower-triangular \(A\) in the order of
names, which is why the SV model’s structural interpretation is
settled at estimation time (see TVPSVAR) and why its
sigma_u is the time-averaged covariance rather than any one date’s.
Being posteriors, the results report uncertainty rather than test statistics: coefficient and volatility paths come with posterior bands, and there is deliberately no likelihood, information criterion, or parameter count on these results – a Gibbs posterior has none to report, and numbers shaped like them would be wrong. Structural responses at a date freeze that date’s posterior means and are read as the transmission prevailing there.
Layout. TVPVAR and TVPVARSV validate on
_TimeVaryingVectorAutoRegressionModel in _internals, which
resolves the training split, builds the Kronecker-stacked observation
matrices, calibrates the priors by OLS on the training rows, and in
_fit_tvp runs the sampler: a _LinearGaussianStateSpace from the
state-space layer supplies the simulation smoother, _draw_inverse_wishart
and _draw_triangular_volatility_block from _core._samplers the
covariance and volatility blocks, and a _TimeVaryingFit is packed.
TVPVARResult and TVPVARSVResult take their summary from
_SummaryMixin and their chain diagnostics from _ConvergenceMixin;
TVPSVAR reads either into a TVPSVARResult through
companion_matrix(). The constant-coefficient
posteriors these paths relax are in
bayesian and
volatility; the models whose
parameters switch rather than drift are the rest of this package and
markov_switching.
References
Primiceri, G. E. (2005). Time varying structural vector autoregressions and monetary policy. Review of Economic Studies, 72(3), 821-852.
Del Negro, M., & Primiceri, G. E. (2015). Time varying structural vector autoregressions and monetary policy: A corrigendum. Review of Economic Studies, 82(4), 1342-1345.
Cogley, T., & Sargent, T. J. (2005). Drifts and volatilities: Monetary policies and outcomes in the post WWII US. Review of Economic Dynamics, 8(2), 262-302.
Kim, S., Shephard, N., & Chib, S. (1998). Stochastic volatility: Likelihood inference and comparison with ARCH models. Review of Economic Studies, 65(3), 361-393.
Durbin, J., & Koopman, S. J. (2002). A simple and efficient simulation smoother for state space time series analysis. Biometrika, 89(3), 603-616.
Example
Drift and volatility change in one system: the own-lag coefficient of
y1 climbs over the sample while the shocks grow louder. With the
scales loosened the SV fit sees both, and the structural impact of
the first shock at the end of the sample exceeds its impact at the
start:
>>> import numpy as np
>>> rng = np.random.default_rng(0)
>>> n = 200
>>> y = np.zeros((n, 2))
>>> for t in range(1, n):
... a = 0.2 + 0.6 * t / n
... scale = 0.5 + 1.0 * t / n
... y[t, 0] = a * y[t - 1, 0] + scale * rng.standard_normal()
... y[t, 1] = 0.4 * y[t - 1, 1] + 0.3 * y[t - 1, 0] + rng.standard_normal()
>>> res = TVPVARSV(y, order=1, training=40).fit(
... n_draws=60, n_burn=20, k_drift=0.2, k_vol=0.1, seed=0
... )
>>> path = res.coefficient_path("y1", "y1.L1")[:, 1]
>>> vol = res.volatility_path("y1")[:, 1]
>>> bool(path[-1] - path[0] > 0.2), bool(vol[-1] / vol[0] > 1.5)
(True, True)
>>> svar = TVPSVAR(res).identify()
>>> bool(svar.impact(res.nobs - 1)[0, 0] > svar.impact(0)[0, 0])
True
>>> svar.irf(4, t=res.nobs - 1).shape
(5, 2, 2)
Classes#
Recursive structural interpretation of a fitted TVP-VAR, per date. |
|
Time-varying-parameter VAR with constant innovation covariance. |
|
Time-varying-parameter VAR with stochastic volatility, after Primiceri (2005). |
|
A structurally interpreted TVP-VAR: one recursive declaration, a path of answers. |
|
A fitted time-varying-parameter VAR, homoskedastic innovations. |
|
A fitted TVP-VAR with stochastic volatility, after Primiceri (2005). |