[R] PGMM help - Strange Errors when Fitting Models

nowfocus averyhaviv at hotmail.com
Sat Mar 13 02:04:35 CET 2010


Hello,

I've been trying to fit Arrellano-Bond model with pgmm but I am getting very
strange errors.  I've looked around and found no reference to them.

I've specified the model in dozens of different ways, and each seems to give
me a new kind of error.  This leads me to believe this has to do with the
way the data is specified, but I can't see anything thats wrong with.  My
computer runs the sample codes just fine, something wrong on my end, but I
can't see it for the life of me.

Another possible issue is that I only have 3 time periods, but this should
leave me with the first time period to use as an instrument.

Below is my full code, along with 4 different pgmm attempts, with 4
different errors.  My data is available here if anyone wants to try it:
http://dl.dropbox.com/u/3053463/did_dpd.dta

Also, likely unrelated, but dynformula has some strange behaviour
dynformula(value~value, lag.form=list(value = 1),diff.form=list(TRUE))
Gives: diff(value) ~ diff(diff(value), 1) + diff(value, 1)
Where I would have thought it would give this: diff(value) ~ diff(value, 1)


Thanks for your time.

library(foreign)
library(plm)
#Loading the data
data = read.dta("did_dpd.dta")
individual = rep(c(1:6230),3)
panelData = data.frame(individual)
#Getting the panelData ready by adding in time and individual incidies
panelData$time = c(rep(1,6230),rep(2,6230),rep(3,6230))
panelData$value = c(data$y_1990,data$y_1991,data$y_1992)
#Treating some other variables
panelData$treatment= rep(1-data$control,3)
panelData$interaction = panelData$treatment*(panelData$time==3)

panelData = pdata.frame(panelData,
index=c("individual","time"),drop.index=TRUE)
#Fitting the models
form = dynformula(value~1, lag.form=list(value = 1),diff.form=list(FALSE))

AHIV = pgmm(formula =
formula(form),data=panelData,gmm.inst=~value,lag.gmm=list(c(2,2)),transformation="d")
# Gives Error "Error in G[i, i + 1] <- -1 : subscript out of bounds",
something to do with the translation matrix?

AHIV = pgmm(formula =
formula(form),data=panelData,gmm.inst=~value,lag.gmm=list(c(2,2)),transformation="ld")
# Gives Error "Error in rownames(x)[1] <- time.names[prems - 1] : 
  replacement has length zero"

AHIV = pgmm(formula =
formula(form),data=panelData,gmm.inst=~value,lag.gmm=list(c(2,2)),effect
="twoways",transformation="d")
# Gives Error in dimnames(time.dummies) <- list(time.names,
time.names[(time.lost +  : 
  'dimnames' applied to non-array
-- 
View this message in context: http://n4.nabble.com/PGMM-help-Strange-Errors-when-Fitting-Models-tp1591343p1591343.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list