plm 模型“内部"- R 中的警告消息 [英] plm model "within" - Warning messages in R
本文介绍了plm 模型“内部"- R 中的警告消息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在运行此 plm 模型时遇到问题:
i have a problem running this plm model:
我的数据是(示例):
country=c(1,1,1,2,2,2,3,3,3)
year=c(1,2,3,1,2,3,1,2,3)
a=c(1,4,6,3,5,8,4,5,7)
b=c(8,5,7,2,7,4,9,7,1)
matrix=cbind(country, year, a, b)
matrix=plm.data(matrix)
我运行以下回归:
reg=plm(a~year+b, data=matrix, index=NULL, model="within")
summary(reg)
并收到以下警告消息:[1]
and get following warning message:[1]
Warning messages:
1: In if (is.na(le)) { :
the condition has length > 1 and only the first element will be used
2: In if (is.na(le)) " __no length(.)__ " else if (give.length) { :
the condition has length > 1 and only the first element will be used
3: In if (le > 0) paste0("[1:", paste(le), "]") else "(0)" :
the condition has length > 1 and only the first element will be used
怎么了?
推荐答案
这是因为 str
检查其对象的长度,而 plm
使用来自 plm
的扩展公式代码>公式代码>包.现在,Formula:::length.Formula
返回一个向量而不是一个数字,这会导致警告,如 simon_icl 所述.虽然您自己可能不会调用 str
,但您的 IDE(例如 RStudio)可能会使用它来显示工作区中对象的对象结构.
This is because str
checks the length of its object, and plm
uses extended formulas from the Formula
package. Now, Formula:::length.Formula
returns a vector rather than a number, which causes the warning, as explained by simon_icl. While you may not call str
yourself, perhaps your IDE, say RStudio, may use it to show the object structure of objects in the workspace.
这篇关于plm 模型“内部"- R 中的警告消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文