首页 > 解决方案 > R splm:没有外生回归变量的空间面板

问题描述

我想估计空间面板自回归模型

y_{t} = a + \rho W y_{t} + \epsilon_{t}

其中a是单个固定效应的向量。我splm在 R 中使用了优秀的包。

请注意,我在这里没有任何自变量X- 如果我包含一些回归X量没有问题,但我想知道如何splm在没有自变量的情况下指定模型。

library(splm)
library("spdep")
data("Produc", package = "Ecdat")
data("usaww")
usalw <- mat2listw(usaww)

# this works well since I have independent regressors
spml(formula = log(gsp) ~ log(pcap), data = Produc,
     listw = usaww, lag = TRUE, spatial.error = "none", model = "within",
     effect = "twoways")

 # this does not work
 spml(formula = log(gsp) ~ ., data = Produc,
      listw = usaww, lag = TRUE, spatial.error = "none", 
      model = "within", effect = "individual")

标签: r

解决方案


要估计“空”模型(仅截距),公式必须为 y ~ 1。这目前适用于随机或无个体效应,“内部”(固定效应)估计器需要修复。获得 FE 估计的解决方法:显式贬低数据

    library(plm)
    spml(formula = Within(log(gsp)) ~ 1, data = Produc,
         listw = usaww, lag = TRUE, spatial.error = "none", 
         model = "pooling")

推荐阅读