如何分析具有两个以上变量的脉冲响应函数?

问题描述 投票:0回答:1

我正在 R 中使用 vars 包运行脉冲响应函数。

我的数据有 3 个变量,通货膨胀(巴西 CPI,或 IPCA)、汇率和产出缺口。

我的目标是计算汇率传递(最大影响和滞后),并且我正在遵循学术建议来添加产出缺口(作为带有HP过滤器的月度工业生产)。

我感兴趣的传递是汇率->CPI。我对产出缺口感兴趣的只是它影响这种传递关系的方式。所以我把代码写成:

model_irf  <- vars::irf(model_var,  
                          impulse = "Exchange Rate", 
                          response = "CPI", 
                          n.ahead = 12, 
                          cumulative = TRUE) 

这给出了变量“CPI”t+12 对变量“汇率”单位变化的预期响应。

enter image description here

我认为(从宏观经济理论来看)产出缺口会影响传递的幅度,因此在产出缺口较大的时期,企业提价的空间较小;在我编写的这个模型中不可见的关系。

我的问题是:产出缺口与我计算的IRF有何关系? (或者如果模型是错误的,我应该以不同的方式编写它来测试这个假设)

非常感谢您的宝贵时间!

r var economics
1个回答
0
投票

这里不需要

cumulative
,但建模时需要

  • runs = 1000, seed = 12345
    重复采样并计算其统计特性,
  • 还可以识别 VAR 模型的冲击 - 使用正交脉冲响应 (OIR) -
    ortho=TRUE
    ,之前分解模型残差的 VaR-covar 矩阵,以从该矩阵的对角线外元素捕获协方差交互作用及其变化(在主对角线上)

示例代码可以看这里

# Download data
## quarterly, seasonally adjusted time series for West German fixed investment, disposable income, and consumption expenditures in billions of DM from 1960Q1 to 1982Q4.

#d <- read.table("http://www.jmulti.de/download/datasets/e1.dat", skip = 6, header = TRUE)
#write.table(x, file = "foo.csv", sep = ",", col.names = NA)
d<-read.table("foo.csv", header = TRUE, sep = ",", row.names = 1)

# Only use the first 76 observations so that there are 73 observations
# left for the estimated VAR(2) model after taking first differences.
data(d[1:76, ])
print(d)

# Convert to time series object
data <- ts(d, start = c(1960, 1), frequency = 4)

# Take logs and differences
data <- diff(log(data))

# Plot data
plot(data,  main = "Dataset E1 from Lutkepohl (2007)")

# MODEL
# Load package
#install.packages("vars")
library(vars)

# Estimate model
model <- VAR(data, p = 2, type = "const")

# Look at summary statistics
summary(model)

# Calculate summary statistics
model_summary <- summary(model)

# Obtain variance-covariance matrix
model_summary$covres

# A common approach to identify the shocks of a VAR model is to use orthogonal impulse respones (OIR). The basic idea is to decompose the variance-covariance matrix
t(chol(model_summary$covres))

# In R the irf function of the vars package can be used to optain OIRs by setting the argument ortho = TRUE:
oir <- irf(model, impulse = "income", response = "cons",
             n.ahead = 8, ortho = TRUE, runs = 1000, seed = 12345)

plot(oir)

enter image description here

我的问题是:产出缺口与我计算的IRF有何关系?

  • 响应中查看上升(下降)后脉冲的上升(下降)周期,脉冲响应分析可视化根据给定时间序列统计定义的周期 enter image description here
© www.soinside.com 2019 - 2024. All rights reserved.