如何计算R中每个区域(空间模型,面板数据)的直接和间接影响?

时间:2019-09-16 13:10:51

标签: r spatial spdep

我有一个关于spdep包的问题,​​“ impacts”功能(在R中)。我已经估算了空间模型(面板数据)。使用此函数,我可以计算平均直接影响和平均间接影响(按区域平均)。但是我不希望他们被平均。我希望每个区域都有直接和间接的影响。我该怎么办?

> gns_fe<-spml(funX, data=df, listw = weights,listw2 = weights, model="within", effect="individual", spatial.error="b", lag=T, default = F)
> impac_GNS_FE <- impacts(gns_fe, listw = weights_st, time = 1000)
> summary(impac_GNS_FE, zstats=TRUE, short=F)
Impact measures (lag, trace):
                                       Direct     Indirect                 Total
price                             -0.13653493  0.024507844 -0.112027083
income                             0.13062002 -0.023446127  0.107173897
pop                                0.86042639 -0.154445433  0.705980952
dwell                              0.15945992 -0.028622851  0.130837067
weather                            0.05858390 -0.010515735  0.048068165
t                                  0.03604723 -0.006470432  0.029576799
slag(df$price, listw = weights)   -0.08925007  0.016020274 -0.073229800
slag(df$income, listw = weights)   0.05205918 -0.009344556  0.042714623
slag(df$pop, listw = weights)     -0.41416704  0.074342452 -0.339824584
slag(df$dwell, listw = weights)    0.13408215 -0.024067573  0.110014573
slag(df$weather, listw = weights)  0.01038779 -0.001864595  0.008523197

我看到价格有1个直接影响,但我需要81个(因为我有81个区域)。

0 个答案:

没有答案