如何使用FELM()函数在回归模型中指定群集

发布于 2025-01-23 05:53:30 字数 562 浏览 3 评论 0原文

如何使用FELM()函数在回归模型中指定群集: 我一直在尝试和尝试,但我无法正常工作。有人知道我的代码怎么了吗?这是我一直在尝试使用的代码。

newreg <- felm(log(Price2) ~ Detached.house + Semi.detached.house + Attached.houses - Apartment +
  Stock.apartment + Housing.cooperative - Sole.owner + Age +
  BRA + Bedrooms + Balcony + Lotsize + Sentrum + Alna + Vestre.Aker + Nordstrand + Marka +  
  Ullern + Østensjø + Søndre.Nordstrand + Stovner + Nordre.Aker + Bjerke + 
  Grorud + Gamle.Oslo + St..Hanshaugen + Grünerløkka + Sagene - Frogner|0|0|, data=Data)

我要做的是使用FELM()函数自动产生星际合伙人的群集标准错误。

how can I specify the cluster in the regression model with felm() function:
I have been trying and trying but I can't make it work. Does anyone know what is wrong with my code? This is the code I have been trying to use.

newreg <- felm(log(Price2) ~ Detached.house + Semi.detached.house + Attached.houses - Apartment +
  Stock.apartment + Housing.cooperative - Sole.owner + Age +
  BRA + Bedrooms + Balcony + Lotsize + Sentrum + Alna + Vestre.Aker + Nordstrand + Marka +  
  Ullern + Østensjø + Søndre.Nordstrand + Stovner + Nordre.Aker + Bjerke + 
  Grorud + Gamle.Oslo + St..Hanshaugen + Grünerløkka + Sagene - Frogner|0|0|, data=Data)

what I am trying to do is automatically produced the clustered standard errors in stargazer with the felm() function.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

幼儿园老大 2025-01-30 05:53:30

帮助文件说:

公式规范是响应变量,然后是四部分公式。第一部分由普通协变量组成,第二部分由要预测的因素组成。第三部分是IV规格。第四部分是标准错误的集群规范。即类似y〜x1 + x2 | F1 + F2 | (Q | W〜X3+X4)| clu1 + clu2其中y是响应,x1,x2是普通的协变量,f1,f2是要预测的因素,q和w是由x3和x4仪器的协变量,clu1,clu1,clu2是用于计算的因素集群强大的标准错误。

因此,我想这将是:

newreg <- felm(log(Price2) ~ Detached.house + Semi.detached.house + Attached.houses - Apartment +
  Stock.apartment + Housing.cooperative - Sole.owner + Age +
  BRA + Bedrooms + Balcony + Lotsize + Sentrum + Alna + Vestre.Aker + Nordstrand + Marka +  
  Ullern + Østensjø + Søndre.Nordstrand + Stovner + Nordre.Aker + Bjerke + 
  Grorud + Gamle.Oslo + St..Hanshaugen + Grünerløkka + Sagene - Frogner|0|0|cluster_var, data=Data)

cluster_var是您要聚集的变量的名称。没有数据,我无法测试它。

The help file says:

The formula specification is a response variable followed by a four part formula. The first part consists of ordinary covariates, the second part consists of factors to be projected out. The third part is an IV-specification. The fourth part is a cluster specification for the standard errors. I.e. something like y ~ x1 + x2 | f1 + f2 | (Q|W ~ x3+x4) | clu1 + clu2 where y is the response, x1,x2 are ordinary covariates, f1,f2 are factors to be projected out, Q and W are covariates which are instrumented by x3 and x4, and clu1,clu2 are factors to be used for computing cluster robust standard errors.

So, I would imagine it would be something like:

newreg <- felm(log(Price2) ~ Detached.house + Semi.detached.house + Attached.houses - Apartment +
  Stock.apartment + Housing.cooperative - Sole.owner + Age +
  BRA + Bedrooms + Balcony + Lotsize + Sentrum + Alna + Vestre.Aker + Nordstrand + Marka +  
  Ullern + Østensjø + Søndre.Nordstrand + Stovner + Nordre.Aker + Bjerke + 
  Grorud + Gamle.Oslo + St..Hanshaugen + Grünerløkka + Sagene - Frogner|0|0|cluster_var, data=Data)

where cluster_var is the name of the variable you want to cluster on. Without the data, I can't test it, though.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文