I have a question about plm
package.
My code is:
fixedmodel <- plm(formula=Inv_ret~Firm.size+leverage+Risk+Liquidity+Equity,
data=datanewp, model="within")
In the plm vignette
the authors write:
This is called the fixed effects (a.k.a. within or least squares dummy
variables) model, usually estimated by ols on transformed data, and
gives consistent estimates for beta.
I wonder then if plm
package assumes that least squares dummy variable
model is estimated with model="within
in the plm
package? In other words, if wihin
is actually least squares dummy variable
model in plm?
On the other hand, if I refer to some other site they write:
There are several strategies for estimating a fixed effect model. The
least squares dummy variable model (LSDV) uses dummy variables,
whereas the “within” estimation does not. These strategies, of course,
produce the identical parameter estimates of regressors (nondummy
independent variables).
So I guess the authors of plm
package mean that they actually use within
model but compute the unique group specific intercepts from within
transformation later. Am I correct?
Best Answer
The two estimators are computed differently, but are numerically identical, so essentially it doesn't matter. The within estimator is computationally easier since it keeps the size of the design matrix in check, and I would think that is how the within estimator is implemented. Here is some R code to demonstrate this
Or, if you prefer, some Stata code,
A proof using the Frisch-Waugh-Lovell theorem can easily be given. Note one crucial point that for a large number of groups, that is, $n\to \infty$, the estimates of the coefficients on the group dummies are not consistent.