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 ?