首页 > 解决方案 > R spml 和 plm:为什么在空间固定效应中有截距?

问题描述

我正在将空间面板自回归模型与没有空间项的面板回归进行比较。对于这两个模型,我都估计了个体的固定效应。我很惊讶spml包输出带有截距项的固定效果。在进行“正常”固定效果面板回归时,情况并非如此。

我从未见过以固定效果报告截距。这样做有什么原因spml吗?plm与包装的固定效果相比,固定效果的解释是否发生变化?

这是我的意思的一个例子:

library(splm)
library(plm)

df <- data.frame(y = c(10,20,30,40,15,17,25,37), x = c(10,5,20,10,12,7,18,11))
df$time <- rep(c(1,2), each = 4)
df$ind <- rep(1:4, 2)
df <- df[,c("ind","time", "y", "x")]
df

# matrix for spatial estimation - Spatial Panel Autoregressive Model
W <- matrix( c( 0,0,1,1,
                0,0,1,1,
                1,1,0,5,
                0,1,10,0), nrow = 4)
W <- sweep(W, 1, rowSums(W), "/")
listw <- mat2listw(W, style = "W")

# spatial estimation
res_spatial <- spml(y ~ x, data = df, listw = listw, effect = "individual",
                    model="within", spatial.error="none", lag = T)

# panel estimation without spatial lags
res <- plm(y ~ x, data = cbind(df),  effect = "individual", model="within")

# FIXED EFFECTS WITHOUT INTERCEPT
summary(fixef(res))

# FIXED EFFECTS WITH INTERCEPT -> WHY??
effects.splm(res_spatial)

标签: rspatialplmspml

解决方案


推荐阅读