[R] Error using PGMM function in the PLM package
Taylor White
taylorgentrywhite at gmail.com
Mon Apr 9 03:28:50 CEST 2012
Good day fellow R users:
I have routinely received the following message when attempting to
estimate a GMM model for a somewhat square panel (N = 20, T = 9-27,
Obs = 338) using the pgmm function in the plm package:
Error in function (..., deparse.level = 1) :
number of rows of matrices must match (see arg 2)
So far, I am not wedded to a particular GMM model but what I have used
thus far is similar to the Anderson - Hsaio estimator such that
Y(t) = Y(t-2) + X(t-1) + u(i) + e(it)
where Y(t-2) is the dependent variable lagged twice; X(t-1) is a
series of lagged (more or less) exogenous regressors; u(i) is the
individual (country) error component; and e(it) is the idiosyncratic
error.
The within estimator in plm works just fine for what it's worth (see
script file). Basically, I was hoping to run the same basic model
using pgmm. So far, I've tried to run different types of models using
the pgmm function as well as have trimmed the data by adding more
lagged versions of the dependent variable and subsequently trimming
the dataset (in case there is sensitivity to NA observations) to no
avail.
I'm pretty familiar with R and the plm package in particular but less
so with GMM estimation so I don't know if the issue relates to the
software, the code I have written, or with how my data relates to GMM
estimation (i.e. the theoretical/mathematical underpinnings of such a
method). I have done a decent amount of work in trying to wrap my
head around GMM and I don't see exactly what the problem could be so
I'm reaching out to folks who know better. There was an earlier post
on a similar topic
(https://stat.ethz.ch/pipermail/r-help/2010-July/245807.html) but that
issue appears to have been corrected with an amendment to the plm
package.
The links to my my (trimmed) dataset and R code are below.
Thanks to all in advance for your help.
Taylor White
Research Assistant, UCLA
taylorgentrywhite at gmail.com
Link to dataset:
https://docs.google.com/open?id=0B5VZMvsirgHCajdxWVI0aVVRQ2F0a3Q4V0NiaDlrdw
Link to the script used to run the regressions:
https://docs.google.com/open?id=0B5VZMvsirgHCamt3UG9yWlJUNEcwelp4UFVGNnhaQQ
More information about the R-help
mailing list