I'm trying to understand the difference between XTREG and PLM. First, I have looked at this answered question:
But when I try the code provided by the answerer, I get different answers from R and Stata. The STATA results match those of the answerer, but the R results do not.
I have an inkling for why. When I execute that code in R, R doesn't create lags within the grouping variable, it creates lags overall. For example, if there are 50 states and 17 years, when including a lag in the regression, I will lose 50 observations: the first year for each state. In STATA, the sample size reduces accordingly. In R, the sample size reduces by 1. This is because its not identifying the "state" grouping variable. So, does anyone have an idea of what is going on here?