In this paper we extend two general methods of moment estimators to panel vector autoregression models (PVAR) with p lags of endogenous variables, predetermined and strictly exogenous variables. First, the first difference GMM estimator (Holtz-Eakin et al., 1988; Arellano and Bond, 1991) is extended to this general PVAR model. Second, we do the same for the system GMM estimator (Blundell and Bond, 1998). We implement these estimators in the R package panelvar. In addition to the GMM-estimators we contribute to the literature by providing specification tests (Hansen overidentification test, lag selection criterion and stability test of the PVAR polynomial) and classical structural analysis for PVAR models such as orthogonal and generalized impulse response functions, bootstrapped confidence intervals for impulse response analysis and forecast error variance decompositions. Finally, we implement the first difference and the forward orthogonal transformation to remove the fixed effects.
在Rstudio中安装package步骤:“Tools” -> “Install packages” -> "Install from Package Archive File" 然后选择zip
Examples with Cigar Data
We apply our package to the Cigar data set which was used by Baltagi and Levin (1992), Baltagi, Griffin, and Xiong (2000) and Croissant and Millo (2008). The data set covers variables that are relevant for cigarette demand in 46 American states over the period 1963 to 1992. These variables include price, sales, population, population over 16 years, consumer price inflation and minimum price. Especially, the availability of price and quantity are a classical example for vector autoregression models.
library(panelvar)data(Cigar)ex1_cigar_data <- pvargmm(dependent_vars = c("log_sales", "log_price"), lags = 1, predet_vars = c("log_ndi"), exog_vars = c("cpi", "log_pop16"), transformation = "fod", data = Cigar, panel_identifier= c("state", "year"), steps = c("twostep"), system_instruments = TRUE, max_instr_dependent_vars = 10, max_instr_predet_vars = 10, min_instr_dependent_vars = 2L, min_instr_predet_vars = 1L, collapse = TRUE)summary(ex1_cigar_data)Dynamic Panel VAR estimation, twostep GMM
Transformation: Forward orthogonal deviations
Group variable: state
Time variable: year
Number of observations = 1380
Number of groups = 46
Obs per group: min = 30
Obs per group: avg = 30
Obs per group: max = 30
fod_log_sales | fod_log_price | ||
fod_lag1_log_sales | 0.8517*** | -0.0350** | |
(0.0231) | (0.0136) | ||
fod_lag1_log_price | -0.0981*** | 0.8512*** | |
(0.0185) | (0.0147) | ||
fod_log_ndi | 0.1172*** | 0.0561*** | |
(0.0203) | (0.0137) | ||
fod_cpi | -0.0011*** | 0.0017*** | |
(0.0003) | (0.0002) | ||
fod_log_pop16 | -0.0050 | 0.0000 | |
(0.0041) | (0.0020) | ||
const | 0.1930*** | 0.2080*** | |
(0.0110) | (0.0058) | ||
[size=0.8em]p < 0.001, p < 0.01, p < 0.05 |
Hansen test of overid. restrictions: chi2(56) = 39.69 Prob > chi2 = 0.951
(Robust, but weakened by many instruments.)
Next, we test the stability of the autoregressive process:
stab_ex1_cigar_data <- stability(ex1_cigar_data)print(stab_ex1_cigar_data)## Eigenvalue stability condition:## ## Eigenvalue Modulus## 1 0.9100521 0.9100521## 2 0.7928343 0.7928343## ## All the eigenvalues lie inside the unit circle.## PVAR satisfies stability condition.plot(stab_ex1_cigar_data)
In vector autoregression models researchers are often interested in impuls response analysis. Recently, researcher prefer the generalized impuls response analysis (GIRF) introduced by Pesaran and Shin (1998) to orthogonal impuls response analysis (OIRF) as it is independent of the ordering of the endogenous variables. However, GIRF and OIRF are closely related. Lin (2006) states that when <span class="MathJax" id="MathJax-Element-7-Frame" tabindex="0" data-mathml="Σϵ" role="presentation" style="display: inline; line-height: normal; word-spacing: normal; word-wrap: normal; white-space: nowrap; float: none; direction: ltr; max-width: none; max-height: none; min-width: 0px; min-height: 0px; border: 0px; position: relative;">ΣϵΣϵ is diagonal OIRF and GIRF are the same. The GIRF of the effect of an unit shock to the r-th equation is the same as that of an orthogonal impulse response but different for other shocks. Hence, the GIRF can easily computed by using OIRF with each variable as the leading one.
ex1_cigar_data_girf <- girf(ex1_cigar_data, n.ahead = 12, ma_approx_steps= 12)ex1_cigar_data_oirf <- oirf(ex1_cigar_data, n.ahead = 12)plot(ex1_cigar_data_girf, ex1_cigar_data_bs)