0

I estimated a two-way (meaning individual and time FE) fixed effects model with the plm package. The code I used for my regression is :

my_plm_model <- plm(Y ~ X, data = my_data, model = "withtin", effect = "twoways")

and I want to check whether a linear model is what's best suited for my data. In order to do this, I want to construct a residual vs. fitted values plot like step 2 of this page.

I tried the same formula as the website :

plot(fitted(my_plm_model), res)

With res containing my model's residuals, and I get the following error message :

Error in match.arg(plot) : 'arg' must be NULL or a character vector

When I try the same command with a linear model with the lm command, the plot shows up just fine, so I suppose that the problem is that the command doesn't take plm regressions into account.

What would be the solution to get this plot ? If there is non, is there any other way I could check that my regression fulfills the linearity assumption ?

  • 3
    please share data and code so others can help – Mike Apr 26 '23 at 19:10
  • I shared the code I used to get my regression, but I don't see what else I could share ? The data itself doesn't matter, it could be any unbalanced panel dataset. All I want to do is plot the residuals of a `plm` type regression, I don't think the details matter. Do they ? – Muller I. Apr 27 '23 at 08:33
  • its matters quiet a lot because we can't reproduce the error you are seeing so any answer we would give would just be a guess. the more specific and detailed you can be in your question will yield much better answers for you. Here is a post to brush up on: https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example – Mike Apr 27 '23 at 13:15

0 Answers0