View source: R/estimate_pvarife.R
| pvarife | R Documentation |
Jointly estimates VAR coefficients \beta, latent common factors
F, and factor loadings \Lambda for a panel vector autoregression
with interactive fixed effects, following the iterative algorithm of
Tugan (2021) based on Bai (2009).
pvarife(y, n_lags, n_factors, n_out = 50L, n_in = 10L, balanced_init = TRUE)
y |
A numeric array of dimension |
n_lags |
Positive integer. Lag order |
n_factors |
Positive integer. Number of interactive fixed effects |
n_out |
Positive integer. Number of outer iterations (default 50).
Corresponds to |
n_in |
Positive integer. Number of inner PCA/EM iterations per outer
step (default 10). Corresponds to |
balanced_init |
Logical. If |
The model is
y_{i,t} = \sum_{l=1}^{\ell} \Theta_l y_{i,t-l} + F_t \lambda_i + e_{i,t},
where y_{i,t} is a K \times 1 vector of endogenous variables for
unit i at time t, F_t is an r \times 1 vector of
unobservable common factors, \lambda_i is a unit-specific loading
vector, and e_{i,t} is an idiosyncratic error.
The algorithm alternates between:
An inner loop that extracts factors and loadings via PCA (principal components on the residual cross-product matrix) and imputes missing observations (EM step of Bai 2009).
An outer loop that updates \beta via least squares
after projecting out the estimated factors (using M_F = I - F(F'F)^{-1}F').
An object of class "pvarife_result", which is a list with:
Coefficient vector of length K + K^2 \ell.
The first K elements are equation-specific intercepts; the
remaining K^2 \ell elements are VAR lag coefficients stacked
as [\Theta_1, \Theta_2, \ldots, \Theta_\ell]' (column-major).
Factor matrix of dimension T \times r (one row per
time period; analogous to MATLAB f).
Block-diagonal factor matrix of dimension
TK \times Kr, built as I_K \otimes f_t'.
Matrix of dimension Kr \times I (factor loadings
per unit, stacked by variable).
Reduced-form error covariance matrix (K \times K).
Array of residuals TK \times 1 \times I (NA at
unobserved positions).
Stacked outcome/regressor arrays (TK \times 1 \times I
and TK \times (K + K^2\ell) \times I).
Pooled outcome/regressor matrices (complete-case rows only).
Integer matrix TK \times I: 1 = observed, 0 = missing.
Integer vector of length I: number of observed
time periods per unit (analogous to MATLAB TC).
Integer vector of length I: n\_time\_i \times K
(analogous to MATLAB TNC).
Dimensions.
Tugan, M. (2021). Panel VAR models with interactive fixed effects. Econometrics Journal, 24, 225–246. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1093/ectj/utaa021")}
Bai, J. (2009). Panel data models with interactive fixed effects. Econometrica, 77(4), 1229–1279.
sim <- sim_pvarife(n_units = 30, n_time = 20, n_vars = 2,
n_lags = 1, n_factors = 1, seed = 1)
fit <- pvarife(sim$y, n_lags = 1, n_factors = 1, n_out = 5, n_in = 3)
print(fit)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.