首页 > 解决方案 > 1 - diaghat 中的错误:二元运算符的非数字参数

问题描述

我想运行一个双向固定效应模型,然后纠正标准错误。

mod3 = plm(Dir ~ Dist +Trade + GDP_sim +GDP +   
         GDP_capita_constant +Openess + GDP_g + Endowments + 
         US_PTA + Japan_PTA + FDI + Population+ Democracy+Rule_of_Law+Values+sim+ 
         WTO, data= dfPTA, index = c("Country", "Year"),
       model = "within",
       effect = "twoway")

这很好用。

但是,在运行此行时

m.2wfe.scc <- coeftest(mod3, vcov = vcovSCC(mod3, type = "HC3", cluster = "group"))

我收到以下错误消息

Error in 1 - diaghat : non-numeric argument to binary operator

我所有的变量都是数字或整数(国家除外)。

有趣的是,我可以跑

mod4 = plm(Dir ~ Dist + Trade + GDP_sim +GDP +   
         GDP_capita_constant+Population+FDI, data= dfPTA, index = c("Country", "Year"),
       model = "within",
       effect = "twoway")
m.2wfe.scc <- coeftest(mod4, vcov = vcovSCC(mod4, type = "HC3", cluster = "group"))

它有效。Alltough 我没有看到子集变量和完整模型之间的区别。

有任何想法吗?

标签: rbinaryoperator-keywordplm

解决方案


推荐阅读