目前(版本 1.2-10,2012-05-05)似乎不支持不平衡的情况。编辑:不平衡面板数据的问题在 CRAN 上的 plm 版本 2.2-2 中得到解决(2020-02-21)。
其余的答案是假设版本 1.2-10:
我查看了代码,最终的数据准备行(无论您的初始参数是什么)如下:
object <- as.data.frame(split(object, id))
如果您通过不平衡面板,这条线将通过重复相同的值使其平衡。如果您的不平衡面板的时间序列长度相互分开,那么甚至不会产生错误消息。这是来自最纯页面的示例:
> data(Grunfeld)
> purtest(inv ~ 1, data = Grunfeld, index = "firm", pmax = 4, test = "madwu")
Maddala-Wu Unit-Root Test (ex. var. : Individual Intercepts )
data: inv ~ 1
chisq = 47.5818, df = 20, p-value = 0.0004868
alternative hypothesis: stationarity
这个面板是平衡的:
> unique(table(Grunfeld$firm))
[1] 20
使其失衡:
> gr <- subset(Grunfeld, !(firm %in% c(3,4,5) & year <1945))
面板中两个不同的时间序列长度:
> unique(table(gr$firm))
[1] 20 10
没有错误信息:
> purtest(inv ~ 1, data = gr, index = "firm", pmax = 4, test = "madwu")
Maddala-Wu Unit-Root Test (ex. var. : Individual Intercepts )
data: inv ~ 1
chisq = 86.2132, df = 20, p-value = 3.379e-10
alternative hypothesis: stationarity
另一个不平衡的面板:
> gr <- subset(Grunfeld, !(firm %in% c(3,4,5) & year <1940))
> unique(table(gr$firm))
[1] 20 15
和错误信息:
> purtest(inv ~ 1, data = gr, index = "firm", pmax = 4, test = "madwu")
Erreur dans data.frame(`1` = c(317.6, 391.8, 410.6, 257.7, 330.8, 461.2, :
arguments imply differing number of rows: 20, 15