我想估计空间面板自回归模型
y_{t} = a + \rho W y_{t} + \epsilon_{t}
其中a
是各个固定效果的向量。我在R中使用了出色的splm
软件包。
请注意,这里没有任何自变量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")
答案 0 :(得分:1)
要估计“空”模型(仅拦截),公式必须为y〜1。当前,该模型可用于随机效应或无个体效应,“内部”(固定效应)估计器需要修正。 一种获取FE估算值的解决方法:对数据进行显式定义
library(plm)
spml(formula = Within(log(gsp)) ~ 1, data = Produc,
listw = usaww, lag = TRUE, spatial.error = "none",
model = "pooling")