# [R] pgmm (Blundell-Bond) sample needed

Millo Giovanni Giovanni_Millo at Generali.com
Fri Mar 27 14:11:01 CET 2009

```Dear Ivo,

##############################

Was: Message: 70
Date: Thu, 26 Mar 2009 21:39:19 +0000
From: ivowel at gmail.com
Subject: [R] pgmm (Blundell-Bond) sample needed
To: r-help <r-help at stat.math.ethz.ch>
Content-Type: text/plain

Dear R Experts---

Sorry for all the questions yesterday and today. I am trying to use Yves
Croissant's pgmm function in the plm package with Blundell-Bond moments. I
have read the Blundell-Bond paper, and want to run the simplest model
first, d[i,t] = a*d[i,t-1] + fixed[i] + u[i,t] . no third conditioning
variables yet. the full set of moment conditions recommended for
system-GMM, which is (T-1)*(T-2)/2+(T-3), in which the u's interact with
all possible lagged y's and delta y's.

I believe that pgmm operates by demanding that "firm" (i) and "year" (t) be
the first two columns in the data set.

#### Almost correct: this is the easiest way. Else you can supply data organized as you like but then you have to specify who the index is. See vignette("plm"), § 4

library(plm)
NF=20; NT=10
d= data.frame( firm= rep(1:NF, each=NT), year= rep( 1:NT, NF),
x=rnorm(NF*NT) );

# the following fails, because dynformula magic is required; learned this
the hard way
# v=pgmm( x ~ lag(x), data=d, gmm.inst=~x, lag.gmm=c(2,99),
transformation="ld" )

#### The reason for 'dynformula magic' is that lags in panel data are only well defined in conjunction with the group and time indices; therefore in 'plm' lags (and first differences) are best supplied through a 'dynformula' interface inside a model. else you get the standard time-series lag, which is incorrect here.

formula= dynformula( x ~ 1, list(1)); # this creates x ~ lag(x)
v=pgmm( formula, data=d, gmm.inst=~x, lag.gmm=c(2,99), transformation="ld" )

Error in solve.default(suml(Vi)) :
system is computationally singular: reciprocal condition number =
8.20734e-20

obviously, I am confused.

#### You should not, as you yourself state that "the full set of moment conditions recommended for
system-GMM [...] is (T-1)*(T-2)/2+(T-3)". If T=10 then you have the equivalent of 9*8/2+7 = 43 "regressors" (instruments). That's why N=20 is way too little. The original Arellano and Bond example in "UKEmpl" (which is actually called 'EmplUK'!) has N=140, T=9. I already pointed this out in another r-help post, not many days ago (March 9th, 17:59).

#### May I suggest you give a further look at Arellano's panel data book? This would probably clarify how the instrumments are constructed (by the way, that's also what I am currently reading in my spare time). See also Greene, Econometric analysis, § 18.5 and the Z matrix in particular. (Yves Croissant has put this down nicely in the package vignette as well).

when I execute the same command on the included
UKEmpl data set, it works. however, my inputs would seem perfectly
reasonable. I would hope that the procedure could produce a lag(x)
coefficient estimate of around 0, and then call it a day.

#### would be nice; but your troubles aren't over yet :^)

could someone please tell me how to instruct pgmm to just estimate this
simplest of all BB models?

#### OK, you found out by yourself. Just for the benefit of other list readers, I reproduce the lines you sent us by private email (comments are mine):
> lagformula= dynformula(x ~ 1, list(1))
> # reproduces x~lag(x, 1) in standard OLS parlance
> v=pgmm(lagformula, data=d, gmm.inst=~x, lag.gmm=c(1,99), transformation="ld" )
> # means the GMM-system estimator
> # where you use both "l"evels and "d"ifferences as instruments.

[My ultimate goal is to replicate what another author has run via "xtabond2
d ld, gmm(L.(d), lag(1 3)) robust" in Stata; if you know the magic of
moving this statement into pgmm syntax, I would be even more grateful.
Right now, I am so stuck on square 1 that I do not know how to move towards
figuring out where I ultimately need to go.]

#### GMM are a tricky subject I still don't master. I'll try to figure out what both Stata and plm do with the instruments and let you know.
#### Anyway, the 'plm' equivalent of Stata's "Robust" option, which uses the Windmeijer correction if I'm not mistaken, is to specify a robust covariance via vcovHC().

#### Now to your second message:

#####################################

Was: Message: 82
Date: Thu, 26 Mar 2009 21:45:49 -0400
From: ivo welch <ivowel at gmail.com>
Subject: Re: [R] pgmm (blundell-bond) help needed
To: r-help <r-help at stat.math.ethz.ch>
Message-ID:
<50d1c22d0903261845m7d8b321fq97faab26542a0cc at mail.gmail.com>
Content-Type: text/plain; charset=ISO-8859-1

I have been playing with more examples, and I now know that with
larger NF's my example code actually produces a result, instead of a
singular matrix error.  interestingly, stata's xtabond2 command seems
ok with these sorts of data sets.  either R has more stringent
requirements, or stata is too casual.

#### I'll have a look at what Stata does, as far as it is possible. Stata has a very good reputation for accuracy, yet commercial software has a general tendency to remove problems and give "results" whenever possible.

in any case, I find it strange
that Blundell-Bond would not work on data sets in which N=20 and T=10,
and there is only one parameter to estimate.  there should be more
than enough degrees of freedom.

#### Nope. See above.

Best wishes,
Giovanni

Giovanni Millo
Research Dept.,
Assicurazioni Generali SpA
Via Machiavelli 4,
34132 Trieste (Italy)
tel. +39 040 671184
fax  +39 040 671160

Ai sensi del D.Lgs. 196/2003 si precisa che le informazi...{{dropped:13}}

```