r - 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)
解决方案
推荐阅读
- excel - Pulling multiple criteria from another cell
- python - How to split a string based on the
tag using beautifulsoup - android - 有没有办法在没有受支持的设备的情况下开发 ARCore?
- ios - 快速将图像上传到 FTP 服务器
- java - 在没有 View Resolver 的情况下重定向到 spring-boot-starter-webflux 中的外部绝对 URL
- c# - 如何使用 Windows 服务调用浏览器选项卡
- android - 使用 Firebase 在我的 android 应用程序中验证两种类型的用户(学生和司机)的最佳方法是什么
- jquery - 我想从 gridview 中拖动一行并将其放在 treeview 上
- python-3.x - python3上numpy中float32数字的矩阵乘法不稳定性
- laravel-5.7 - Laravel 内部 API 调用控制器重定向到 localhost 后