I am estimating the following panel data twoways fixed effect model:
y = alfa*y.lag + beta1*z + beta2*z^2 + theta*id + gamma*t (1)
where id
is the individual effect, t
is the time effect. I am using the {plm} package in r, therefore the code goes like this
require(plm)
fe.full <- plm(y ~ lag(y, 1) + z +z2, data = mdt, model= "within", effect="twoways")
Now I need to "extract" the predicted value for y. I know it can be done by doing predict(fe.full)
, however I need to do that by hand for comparing it with other models specifications. Summing alfa*y.lag + beta1*z + beta2*z^2
is not enough since I have to consider the coefficients for id
and t
. I know that the former can be obtained as fixef(fe.full)
. However I dont know how to extract the value for the time effect. In Stata coefficients for time are displayed in the summary of the model. In R I was not able to manage that. I also tried to sum the coefficients for time taken from Stata to the value of X*coeff + fixef(fe.full)
obtained in R, but still the output is not equal to the value given by predict(fe.full)
. So I am doing something wrong, I guess.
Therefore the question is : how can I compute manually the sum of the right hand side of equation (1) starting from a plm
object ?