# [R] Problem with the collapse option in pgmm function in the plm package

Nina Schönfelder Nina.Schoenfelder at FernUni-Hagen.de
Wed Nov 6 12:44:48 CET 2013

```Hi all,
I am working with the "Wages" data from plm package to learn something
about the pgmm function (Arellano&Bond estimator, Blundell&Bond estimator).
In the following regression, I assume that the variable lwage is the
lagged dependent regressor and the variable wks is weak exogenous, so I
can use the lags 1 and up as instruments for wks.
Everything is fine, as long as I set the option "collapse = FALSE" for
collapsing the instruments.

> library(plm)
> ## with Wages data from plm-package
> data("Wages", package = "plm")
> Wag <- pdata.frame(Wages, 595)

> ## No collapsing of instruments
> z1<-pgmm(lwage~lag(lwage,1) + wks     | lag(lwage,2:99)+ lag(wks,1:99),
data=Wag, effect="twoway", collapse = FALSE,
model="onestep",transformation = "d")
>tail(z1\$W,1)

>## With collapsing the instruments
> z1<-pgmm(lwage~lag(lwage,1) + wks   | lag(lwage,2:99)+ lag(wks,1:99),
data=Wag, effect="twoway", collapse = TRUE,
model="onestep",transformation = "d")
>tail(z1\$W,1)
Es gab 50 oder mehr Warnungen (Anzeige der ersten 50 mit warnings())
> warnings()
Warnmeldungen:
1: In matrix(unlist(u), nrow = nrow(u[[1]])) :
Datenlänge [61] ist kein Teiler oder Vielfaches der Anzahl der Zeilen [5]
2: In matrix(unlist(u), nrow = nrow(u[[1]])) :
Datenlänge [61] ist kein Teiler oder Vielfaches der Anzahl der Zeilen [5]

> tail(z1\$W,1)
\$`595`
[,1]    [,2]    [,3]    [,4]    [,5] [,6] [,7] [,8] [,9] [,10]
[,11] [,12]
[1,] 5.68698 0.00000 0.00000 0.00000 0.00000   52   50   49   50 0
0     0
[2,] 5.85793 5.68698 0.00000 0.00000 0.00000   50    0   50   50 52
0     0
[3,] 5.95324 5.85793 5.68698 0.00000 0.00000   50   52    0   49 50
0     0
[4,] 6.06379 5.95324 5.85793 5.68698 0.00000   49   50    0    0 50
52     0
[5,] 6.21461 6.06379 5.95324 5.85793 5.68698   50   50   52    0 0
50     0
[,13] [,14] [,15] [,16] [,17] [,18]
[1,] 52.00000     1     0     0     0     0
[2,]  5.68698    -1     1     0     0     0
[3,]  5.85793     0    -1     1     0     0
[4,]  5.95324     0     0    -1     1     0
[5,]  6.06379     0     0     0    -1     1

As you can see, the instrument matrix looks very strange for the weak
exogenous variable, i.e. the columns 6 to 13. Is that a bug in pgmm, or
did I miss something?

Thanks for suggestions!

Nina Schönfelder

-----
FernUniversität in Hagen
Fakultät für Wirtschaftswissenschaft
Lehrstuhl für Volkswirtschaftslehre,
insbes. Makroökonomik
58084 Hagen
E-Mail: Nina.Schoenfelder at FernUni-Hagen.de

```