[go: up one dir, main page]

0% found this document useful (0 votes)
8 views22 pages

pdynmc-pres-in-a-nutshell

Download as pdf or txt
Download as pdf or txt
Download as pdf or txt
You are on page 1/ 22

R-Package “pdynmc”:

GMM Estimation of Dynamic Panel Data Models


Based on Nonlinear Moment Conditions

Markus Fritsch, Andrew Pua, Joachim Schnurbus

University of Passau & Xiamen University

June 11, 2021


Outline

1 Introduction

2 GMM estimation

3 A short note on nonlinear moment conditions

4 Package pdynmc — a first tour

5 Conclusion

2 / 22
What is pdynmc?
pdynmc → panel data
pdynmc → (linear) dynamic models ⇒ GMM
pdynmc → (linear and/or) nonlinear moment conditions (w.r.t. αj , βk )

pdynmc is intended to efficiently estimate models like

yi ,t = α1 yi ,t −1 + . . . + αp yi ,t −p
+ β1 xi∗,t ∗ ,1 + . . . + βq xi∗,t ∗ ,q + ηi + εi ,t
| {z }
ui ,t

where
x ∗ means that we allow for endogenous, predetermined, and/or
exogenous covariates (could also be time/etc. dummies), and
t ∗ means that arbitrary lags of the covariates can be included.

3 / 22
Key features of pdynmc (and conclusion)

pdynmc allows for GMM estimation of linear dynamic panel data models
based on linear and/or nonlinear moment conditions and provides the
following features:

R-package ⇒ open source.


Comprehensive control over all configuration/specification decisions.
Can handle arbitrary unbalancedness (given moment conditions can be
derived).
State-of-the-art estimation (iterated GMM, Hansen & Lee, 2020) of
linear dynamic panel data models.
Specification tests and analysis of stability of coefficient estimates.
Panel structure analysis (visualizations and figures).

4 / 22
GMM estimation, moment conditions, assumptions

GMM estimation is performed by minimizing the objective function

L = m0 · W · m

where
m is the sample analogon to the population moment conditions E (·),
W is the (moment condition) weighting matrix.

The moment conditions are derived from different (sets of) assumptions.

5 / 22
Sets of assumptions

A1 (Ahn & Schmidt, 1995):

The data are independently distributed across i ,


E (ηi ) = 0, i = 1, ..., n,
E (εi ,t ) = 0, i = 1, ..., n, t = 2, ..., T ,
E (εi ,t · ηi ) = 0, i = 1, ..., n, t = 2, ..., T ,
E (εi ,t · εi ,s ) = 0, i = 1, ..., n, t 6= s,
E (yi ,1 · εi ,t ) = 0, i = 1, ..., n, t = 2, ..., T ,
T
n → ∞, while T is fixed, such that → 0.
n

A2 (Arellano, 2003; Kiviet, 2007; Bun & Sarafidis, 2015):

E (∆yi ,t · ηi ) = 0, i = 1, . . . , n.
6 / 22
Moment conditions are derived w.r.t.

Equation in levels

yi ,t = α1 yi ,t −1 + . . . + αp yi ,t −p
+ β1 xi∗,t ∗ ,1 + . . . + βq xi∗,t ∗ ,q + ηi + εi ,t
| {z }
ui ,t

Equation in (first) differences

∆yi ,t = α1 ∆yi ,t −1 + . . . + αp ∆yi ,t −p


+ β1 ∆xi∗,t ∗ ,1 + . . . + βq ∆xi∗,t ∗ ,q + ∆εi ,t

7 / 22
Standard moment conditions
under A1
Linear moment conditions w.r.t. equation in differences

E (yi ,s · ∆ui ,t ) = 0, t = 3, . . . , T ; s = 1, . . . , t − 2. (MYD)

Nonlinear moment conditions

E (ui ,t · ∆ui ,t −1 ) = 0, t = 4, . . . , T . (MN)


E (ui ,T · ∆ui ,t −1 ) = 0, t = 4, . . . , T . (MNAS)

under A1 & A2
Linear moment conditions w.r.t. equation in levels

E (∆yi ,t −1 · ui ,t ) = 0, t = 3, . . . , T . (MYL)

8 / 22
Moment conditions from covariates
Linear moment conditions w.r.t. equation in differences
T
!
X
E ∆xit ∆uit =0 for exogenous x . (MFCD)
t =2

Alternatively E (xi ,s · ∆ui ,t ) = 0, t = 3, . . . , T , (MXD)


where s = 1, . . . , t − 2, for endogenous x ,
s = 1, . . . , t − 1, for predetermined x ,
s = 1, . . . , T , for strictly exogenous x .

Linear moment conditions w.r.t. equation in levels


T
!
X
E xit uit =0 for exogenous x . (MFCL)
t =1

Alternatively E (∆xi ,v · ui ,t ) = 0, (MXL)


where v = t − 1; t = 3, . . . , T , for endogenous x ,
v = t ; t = 2, . . . , T , otherwise.

Note: MXD/MXL require analogous assumptions to A1 and/or A2 w.r.t. x.


9 / 22
Why we should care about nonlinear moment conditions

When the lag parameter is close to one, ...

. . . linear moment conditions derived from A1 fail to identify the lag parameter.

. . . additional linear moment conditions derived from A2


provide a remedy, but:
A2 may be suspect in many contexts (e.g., Arellano’s worker example).

. . . nonlinear moment conditions from A1 can


identify the lag parameter ⇒ estimate consistently.
serve as robustness check ⇒ A2 valid?

10 / 22
Installing and loading package

### Install CRAN-Version

install.packages("pdynmc")

### Install most recent version from Github

install.packages("devtools")
library(devtools)
install_github("markusfritsch/pdynmc")

### Load installed package

library(pdynmc)

Note: Copy & paste the code to R should work.

11 / 22
Load and adjust example data set

Employment and Wages in the United Kingdom


(Arellano & Bond, 1991)

data(EmplUK, package = "plm")


dat <- EmplUK
dat[,c(4:7)] <- log(dat[,c(4:7)])
names(dat)[4:7] <- c("n", "w", "k", "ys")

12 / 22
Function data.info

data.info(
dat,
i.name = "firm",
t.name = "year"
)

yields

Unbalanced panel data set with 1031 rows and


the following time period frequencies:
1976 1977 1978 1979 1980 1981 1982 1983 1984
80 138 140 140 140 140 140 78 35

13 / 22
Function strucUPD.plot
strucUPD.plot(
dat,
i.name = "firm",
t.name = "year"
)
140

Ti
yields 9
8
120

7
100
80
firm

60
40
20

1976 1977 1978 1979 1980 1981 1982 1983 1984

year

14 / 22
Function pdynmc
reg <- pdynmc(
dat = dat, varname.i = "firm", varname.t = "year",

use.mc.diff = TRUE, use.mc.lev = FALSE, use.mc.nonlin = TRUE,

include.y = TRUE,
varname.y = "n", lagTerms.y = 2,

fur.con = TRUE,
fur.con.diff = TRUE, fur.con.lev = TRUE,
varname.reg.fur = c("w", "k", "ys"),
lagTerms.reg.fur = c(1,2,2),

include.dum = TRUE,
dum.diff = TRUE, dum.lev = FALSE,
varname.dum = "year",

w.mat = "iid.err", std.err = "corrected",


estimation = "iterative",
# max.iter = 4,
opt.meth = "BFGS"
)

summary(reg)

yields . . .
15 / 22
Model output for object reg (excerpt)
Dynamic linear panel estimation (iterative)
Estimation steps: 13

Coefficients:
Estimate Std.Err.rob z-value.rob Pr(>|z.rob|)
L1.n 1.19704 0.06855 17.463 < 2e-16 ***
L2.n -0.12589 0.06799 -1.852 0.06403 .
L0.w -0.21935 0.12697 -1.728 0.08399 .
L1.w 0.25791 0.13753 1.875 0.06079 .
L0.k 0.25521 0.05568 4.583 < 2e-16 ***
L1.k -0.15546 0.07673 -2.026 0.04276 *
L2.k -0.15599 0.05498 -2.837 0.00455 **
L0.ys 0.53006 0.18336 2.891 0.00384 **
L1.ys -0.37925 0.22256 -1.704 0.08838 .
L2.ys -0.20770 0.15186 -1.368 0.17131
1979 0.03124 0.01015 3.077 0.00209 **
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

53 total instruments are employed to estimate 16 parameters


27 linear (DIF) 4 nonlinear
8 further controls (DIF) 8 further controls (LEV)
6 time dummies (DIF)

J-Test (overid restrictions): 48.1 with 37 DF, pvalue: 0.1046


F-Statistic (slope coeff): 92232.95 with 10 DF, pvalue: <0.001
F-Statistic (time dummies): 20.63 with 6 DF, pvalue: 0.0021
16 / 22
Coefficient range plot
plot(reg, type = "coef.range", omit1step = TRUE)

yields

coef. est.
coef. initial
1.0

coef. range
0.5
Estimate

0.0
−0.5

L1.n L2.n L0.w L1.w L0.k L1.k L2.k L0.ys L1.ys L2.ys

17 / 22
Coefficient path plot (Hansen & Lee, 2020)
plot(reg, type = "coef.path", omit1step = TRUE,
co = c("L1.n", "L2.n", "L0.w", "L1.w")
)

yields Coefficient estimates over 13 iterations

L1.n
L2.n
L0.w
1.0

L1.w
Estimate

0.5
0.0
−0.5

1 2 3 4 5 6 7 8 9 10 11 12 13

Iteration

18 / 22
Arguments of function pdynmc (1)

R-command Type of moment conditions


use.mc.diff MYD/MFCD/MXD
use.mc.lev MYL/MFCL/MXL
use.mc.nonlin MN
use.mc.nonlinAS MNAS

R-command Estimate parameter(s) Derive moment condition(s)


include.y + MYD/MYL
fur.con/include.dum + MFCD/MFCL
include.x + MXD/MXL
include.x.instr - MXD/MXL
include.x.toInstr + -

Note: Essential arguments are indicated in bold (dat, varname.i, varname.t).

19 / 22
Arguments of function pdynmc (2)

Relate to data set columns: varname.reg.end


Restrict number of parameters: lagTerms.reg.end
Restrict number of moment conditions: maxLags.reg.end

varname. lagTerms. maxLags.


.i + - -
.t + - -
.y + + +
.reg.end + + +
.reg.pre + + +
.reg.ex + + +
.reg.instr + - -
.reg.toInstr + - -
.reg.fur + + -
.dum + - -

20 / 22
Arguments of function pdynmc (3)

Context R-command
Basic configuration w.mat
std.err
estimation
Handle multicollinearity col_tol
inst.thresh
Stata-conformity inst.stata
w.mat.stata
Iterated estimation max.iter
iter.tol
Nonlinear optimization opt.method
hessian
optCtrl
Starting values custom.start.val
start.val
start.val.lo
start.val.hi
seed.input

21 / 22
References
Ahn, S. C. & P. Schmidt (1995), Efficient estimation of models for dynamic panel data.
Journal of Econometrics, 68(1), 5–27.

M. Arellano (2003), Panel Data Econometrics, Oxford University Press.

Arellano, M. & S. Bond (1991), Some Tests of Specification for Panel Data: Monte
Carlo Evidence and an Application to Employment Equations. Review of Economic
Studies 58, 277–297.

Bun, M. J. G. & V. Sarafidis (2015), Chapter 3 – Dynamic panel data models. In B. H.


Baltagi, Editor, The Oxford Handbook of Panel Data, 76–110, Oxford University Press.

Fritsch, M., Pua, A. & J. Schnurbus (2020), pdynmc - An package for estimating linear
dynamic panel data models based on nonlinear moment conditions, Working Paper.

Hansen, B. E. & S. Lee (2020), Inference for Iterated GMM Under Misspecification,
Econometrica, forthcoming.

J. F. Kiviet (2007), Chapter 11 – Judging contending estimators by simulation:


Tournaments in dynamic panel data models. In Phillips, G. D. A. & E. Tzavalis,
Editors, The Refinement of Econometric Estimation and Test Procedures: Finite
Sample and Asymptotic Analysis, 282–318. Cambridge University Press.

R Core Team (2020) R: A language and environment for statistical computing. R


Foundation for Statistical Computing. Vienna, Austria.
22 / 22

You might also like