r - 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")
解决方案
要估计“空”模型(仅截距),公式必须为 y ~ 1。这目前适用于随机或无个体效应,“内部”(固定效应)估计器需要修复。获得 FE 估计的解决方法:显式贬低数据
library(plm)
spml(formula = Within(log(gsp)) ~ 1, data = Produc,
listw = usaww, lag = TRUE, spatial.error = "none",
model = "pooling")
推荐阅读
- php - 带有 php curl 和基本身份验证的 http 请求
- sql-server - 用破折号在同一号码中查找最新条目?
- azure - ADF 表达式将数组转换为逗号分隔的字符串
- sqlite - 如何反序列化 Dart 中映射列表的字符串表示形式
- python-3.x - 为什么 PulP 在 lowBound 设置为零时为混合问题返回负值?
- kubernetes - 无法在 Incubator Helm 图表中更改 kafka broker-id?
- javascript - 如何在 JavaScript 中检查元素的 innerHTML 的属性是否为 null?
- javascript - 尝试使用特定字符串和布尔值解决 If/else 问题
- java - 是否可以让 JUnit5 Extension 实现由扩展类实现的接口?
- lua - Lua 中逗号分隔的 return 语句如何充当函数调用?