2

I used a fixed effects and a first difference estimation. To decide which is more efficient Wooldridge proposes a specific test that is incorporated in the plm package via the following function:

 pwfdtest(Y~X1+X2+..., data=...)

However, running this results in an error message for me stating:

> pwfdtest(DepVar~ExplVar1+ExplVar2, data = data)
Error in `$<-.data.frame`(`*tmp*`, "FDres", value = c(-1.18517291896221,  : 
  replacement has 521293 rows, data has 621829
In addition: Warning message:
In id - c(NA, id[1:(N - 1)]) :
  longer object length is not a multiple of shorter object length

I tried to look up if anyone has experienced this error before posting, but I couldn't find the answer.

Sometimes, I came across people asking for a minimum working example, but mine is not working at all. However, the example from the plm package does work.

Please note that this is my first research conducted as well as the first time I have used R. So bear with me.

Best wishes Alex

EDIT:

I read that the traceback() function might be somewhat useful. However it mostly just spat out various number of which I can not even reach the top (?) Anyway, last lines of these numbers are:

 -1.65868856541809, 2.89084861854684, -1.68650260853188, 0.655681663187397, 
   -0.677329685017227, 0.993684102310348, 1.33441048058398, -2.0526651614649, 
   -1.64392358708552, 2.58673448155514, 0.952616064091869, -0.909754051474562, 
   0.815593306056627, -0.0542364686765445, 0.0184515528912868))
2: pwfdtest.panelmodel(fd1)
1: pwfdtest(fd1)

EDIT2:

My first guess was that the NA might be troubling, so I reduced my panel only to the dependent variable and one explanatory variable. Beforehand, I checked if there were any NA, which were not. Yet a smiliar error message:

Error in `$<-.data.frame`(`*tmp*`, FDres, value = c(-1.18517291896221,  : 
  replacement has 521293 rows, data has 621829
In addition: Warning message:
In id - c(NA, id[1:(N - 1)]) :
  longer object length is not a multiple of shorter object length

EDIT3:

I think I might have found the problem: unbalanced panel. And it makes somewhat sense I guess... Yet there does not seem to be a solution for it in the traditional sense, it simply does not work.

So if anyone is interested what I did:

I further reduced my panel to only 300 individuals and less years. I named the individuals 1-300 and drumroll it worked. However, after changing some of the individuals names to, for example 555 or 556 it gave me the same error as before.

I am not very proficient with these things, but I my uneducated guess is that the test simply does not work on unbalanced panels.

barnari
  • 21
  • 2
  • 1) Please indicate which version of package `plm` you are using. 2) What class is `data`? Is it a `pdata.frame`? If not, are the index variables in the first two columns of the data frame? – Helix123 Dec 16 '18 at 10:19
  • I am pretty sure this is fixed in plm version 1.7-0, from the NEWS file: "pwfdtest: fixed error when one individual has one observation only." – Helix123 Jan 04 '19 at 13:15

0 Answers0