Aaron M. Swoboda
2009-Jan-21 00:05 UTC
[R] trouble switching to 'plm' from 'xtabond' and Stata
Hello, I am switching to R from Stata and I am having particular trouble with the transition from Stata's 'xtabond' and 'ivreg' commands to the "plm" package. I am trying to replicate some of the dynamic panel data work using the UK Employment data in Arellano and Bond (1991) and available as 'EmplUK' under the 'plm' package. I have been reading "Panel Data Econometrics in R: The plm Package" by Croissant and Millo available at http://cran.r-project.org/web/packages/plm/vignettes/plm.pdf and "How to Do xtabond2: An Introduction to 'Difference' and 'System' GMM in Stata" by David Roodman available at http://www.cgdev.org/content/publications/detail/11619 . Roodman provides a very clear exposition of how to use Stata to analyze the UK Employment Data. I am trying to replicate Roodman's results for the UK Employment data using R instead of Stata but I am having limited success. Using: >library('plm') >data("EmplUK", package = "plm") >emp.plm <- plm(dynformula(emp ~ wage + capital + output, lag = list(2, 1, 2, 2), log = TRUE), EmplUK, effect = "time") >summary(emp.plm) I am able to perfectly replicate Roodman's "naive model" (on page 17) regressing Log(Employment) on its own first and second lags as well as current and first lags of log(wages) and current/first/second lags of capital and output. Roodman uses the Stata command "regress n nL1 nL2 w wL1 k kL1 kL2 ys ysL1 ysL2 yr*" (n=employment, w=wages, k=capital, ys=output, yr*=year dummy variables, and nL1=first Lag of employment). I am unable to replicate other results. Specifically, I cannot even replicate the Least Squares Dummy Variable model with effects for both time and firm (in Stata: xi: regress n nL1 nL2 w wL1 k kL1 kL2 ys ysL1 ysL2 yr* i.id) In R I tried: >emp.lsdv <- plm(dynformula(emp ~ wage + capital + output, lag = list(2, 1, 2, 2), log = TRUE), EmplUK, model="within", effect = "twoways") >summary(emp.lsdv) but the coefficients do not match up with results shown on p 18 of Roodman. Can someone help point out what I am doing incorrectly? Can anyone help me implement a First Differences model that also includes Year specific effects? First Differencing eliminates the individual effects, but I should still be able to add year specific effects, no? When I run the commands: >emp.fd <- plm(dynformula(emp ~ wage + capital + output, lag = list(2, 1, 2, 2), log = TRUE), EmplUK, model="fd", effect = "time") >summary(emp.fd) the output says it is running a "time" effect First-Difference Model, but I am unable to extract any time effects, nor can I find any differences with the output from: >emp.fdid <- plm(dynformula(emp ~ wage + capital + output, lag = list(2, 1, 2, 2), log = TRUE), EmplUK, model="fd", effect = "individual") >summary(emp.fdid) What am I missing? Even the degrees of freedom appear the same to me. Eventually, I would like to understand how to implement instrumental variables in the dynamic panel setting using General Method of Moments using R rather than Stata, but it seems I have quite a ways to go to better understand how 'plm' works. Any other resources anyone could point me to would be appreciated. Thanks, Aaron