MFVAR#
- class cultivars.multivariate.reduced_form.mixed_frequency.MFVAR(coefficients, sigma_u, *, kinds, period, intercept=None, weights=None, names=None)[source]
Bases:
objectA latent high-frequency VAR observed through temporal aggregation.
The model is \(z_t = c + A_1 z_{t-1} + \dots + A_p z_{t-p} + u_t\) at the high frequency; what is observed is \(z\) itself for some variables and a weighted sub-period sum for others, on a calendar expressed as
nanin the sample rather than as a time-varying observation matrix. The state stacks \(\max(p, m)\) lags of \(z_t\), deep enough that a reading spanning \(m\) sub-periods is a fixed linear function of the current state, so the observation matrix is constant and the filter’s missing-value masking does the rest.This class does not estimate. The omission is a finding, not an unfinished feature. Simulating a three-variable monthly VAR with one variable observed only as a quarterly average and estimating by EM:
T|A err|Sigma11|S err|control
0.051
1.100
0.060
1500
0.129
2.629
1.469
6000
0.183
3.104
1.944
against a truth of
Sigma11 = 1.160. The control row is the identical estimator with nothing aggregated, so the machinery is sound. The error in the aggregated rows grows with the sample: this is convergence to a wrong limit, not sampling noise, and the likelihood confirms it – the wrong answer scores about a hundred log-points above the truth. The mechanism is that a quarterly reading constrains a three-month average, and a high monthly innovation variance with weaker persistence is nearly observationally equivalent to a low one with stronger persistence.Priors do not rescue it. A Minnesota prior shrinks
Aand cannot reach the unidentified direction, which lives inSigma. An inverse-Wishart prior onSigmaanchored at an aggregation-implied scale fails for a sharper reason: the correct anchor requires the high-frequency persistence, which is precisely what is not identified. Anchoring even at the true value needs a prior worth half the sample to recover the cell.The route to an estimated mixed-frequency VAR is Gibbs sampling over
(A, Sigma)jointly with a proper prior – integrating rather than maximizing, as Schorfheide and Song do – which belongs tocultivars.bayesonce a sampling backend exists. Until then, supply parameters and filter:from_result()takes them from a VAR fitted on whatever high-frequency sample exists,smooth()infers the latent path,nowcast()reads off its last period.- Variables:
_coefficients – The validated
(order, k, k)autoregressive stack._sigma_u – The validated, symmetrized
(k, k)innovation covariance._intercept – The
(k,)latent intercept, orNone._kinds – One frequency role per variable.
_period – Sub-periods per low-frequency period.
_weights – Per-variable explicit sub-period weights, or
None._names – Variable labels.
See also
MFVARResult– the recordsmooth()returns.MIDASVAR– the low-frequency model, which estimates.VAR– the estimator whose parameters this class borrows, and the right model when every variable is observed at the high frequency.state_space– the Kalman filter and simulation smoother the inference runs on.
References
Mariano, R. S., & Murasawa, Y. (2003). A new coincident index of business cycles based on monthly and quarterly series. Journal of Applied Econometrics, 18(4), 427-443.
Schorfheide, F., & Song, D. (2015). Real-time forecasting with a mixed-frequency VAR. Journal of Business & Economic Statistics, 33(3), 366-380.
Ghysels, E. (2016). Macroeconomics and the reality of mixed frequency data. Journal of Econometrics, 193(2), 294-314.
Example
>>> import numpy as np >>> A = np.array([[[0.5, 0.1], [0.0, 0.4]]]) >>> S = np.eye(2) >>> y = np.full((24, 2), np.nan) >>> rng = np.random.default_rng(0) >>> y[:, 0] = rng.standard_normal(24) >>> y[2::3, 1] = rng.standard_normal(8) >>> res = MFVAR(A, S, kinds=["high", "flow"], period=3).smooth(y) >>> res.endog.shape (24, 2)
Private attributes#
Private methods#
Assemble the observable form. |