[R] Panel Data Estimators (within, between, Random Effects estimator)
ronggui
ronggui.huang at gmail.com
Mon May 8 13:04:00 CEST 2006
Some time ago,I wrote some simple functions to do the
fixed/between/random effects regression.If you want the code,pls drop
me a line.
2006/5/8, David STADELMANN <david.stadelmann at unifr.ch>:
> Dear R Users,
>
> Here is another probelm/question.
>
> I would like to run some panel regressions with R. Therefore I have
> combined several time periods of data for different individuals in my
> database.
>
> I have already run pooled OLS but I would need to calculate a Fixed
> Effects Estimator (within estimator). Unfortunately I couldn't find
> anything like that in the RSearch and I suppose that lme (in package
> nlme) is not the answer.
>
> Is there any defined function to calculate panel data estimators like
> Fixed Effects Estimators (within), a between estimator or a Random
> Effects estimator. For more details on the estimators I would like to
> use see: Cameron, A. C.; Trivedi, P. K.: "Microeconometrics. Methods and
> Applications", Cambridge University Press, 2005, pp. 695-809.
One way to get the fixed effects estimator is using dummy regression
by adding factor(id) in the right side to the formula.(the id is panel
ID variable).Just be aware that the R-sqare from dummy regression is
overestimated.If I remember correctly,you can get the R-sqare by
calculate the square of the correlation between response variable and
the predicted value.
And package nlme can do the random effects by ML/REML methods.(Maybe
not axactly what you want).This is achieved by gls function by
specifying the cor argument.
The following example is from Wooldrige(1999),Introductory Econometrics.
summary(gls(lwage~educ+black+hisp+exper+expersq+married+union,cor=corCompSymm(form=~1|nr),data=wagepan,method="ML"))
It is the same as the Stata command:
xtreg lwage educ black hisp exper expersq married union,i(nr) mle
I hope it helps.
> Thanks for your help.
> David Stadelmann
>
> --
> ######################################
> David Stadelmann
> Seminar f¨¹r Finanzwissenschaft
> Universit¨¦ de Fribourg
> Bureau F410
> Bd de P¨¦rolles 90
> CH-1700 Fribourg
> SCHWEIZ
>
> Tel: +41 (026) 300 93 82
> Fax: +41 (026) 300 96 78
> Tel (priv): +41 (044) 586 78 99
> Mob (priv): +41 (076) 542 33 48
> Email: david.stadelmann at unifr.ch
> Internet: http://www.unifr.ch/finwiss
> Internet (priv): http://david.stadelmann-online.com
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
>
--
»ÆÈÙ¹ó
Deparment of Sociology
Fudan University
More information about the R-help
mailing list