<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>dynamic panel model | Carlos Mendez</title><link>https://carlos-mendez.org/tag/dynamic-panel-model/</link><atom:link href="https://carlos-mendez.org/tag/dynamic-panel-model/index.xml" rel="self" type="application/rss+xml"/><description>dynamic panel model</description><generator>Wowchemy (https://wowchemy.com)</generator><language>en-us</language><copyright>© 2018–2026 Carlos Mendez. All rights reserved.</copyright><image><url>https://carlos-mendez.org/media/icon_huedfae549300b4ca5d201a9bd09a3ecd5_79625_512x512_fill_lanczos_center_3.png</url><title>dynamic panel model</title><link>https://carlos-mendez.org/tag/dynamic-panel-model/</link></image><item><title>pydynpd: A Python package for dynamic panel model</title><link>https://carlos-mendez.org/post/python_dynamic_panel/referencematerials/vignettes/paper/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://carlos-mendez.org/post/python_dynamic_panel/referencematerials/vignettes/paper/</guid><description>&lt;h1 id="summary">Summary&lt;/h1>
&lt;p>We present pydynpd, a Python package which implements all the
features in dynamic panel model with GMM (general method of moments).
These features include: (1) difference and system GMM, (2) one-step, two-step, and iterative estimators, (3) robust standard errors including the one
suggested by [@windmeijer2005finite], (4) Hansen over-identification test, (5)
Arellano-Bond test for autocorrelation, (6) time dummies, (7) allows
users to collapse instruments to reduce instrument proliferation issue,
and (8) a simple grammar for model specification. As far as we know, pydynpd is the first Python package that allows researchers to estimate dynamic panel model.&lt;/p>
&lt;p>What distinguishes pydynpd from any other dynamic panel model packages is its innovative feature: the capability to search for models based on users&amp;rsquo; request, rather than just run the model specified by users as other packages do. To the best of our knowledge, there is no other econometric software/package that offers this feature, let alone dynamic panel model packages.&lt;/p>
&lt;h1 id="statement-of-need">Statement of need&lt;/h1>
&lt;p>Over the past decade, dynamic panel model has become increasingly
popular in empirical studies. For example, researchers use dynamic panel
model to study the environmental impacts of climate change [@econometrics8030030] and COVID-19 [@anser2020does;@oehmke2021dynamic].
This is because many aspects of our social and natural systems are
inherently dynamic, and the GMM methods proposed by Arellano &amp;amp; Bond [-@arellano1991some] and Blundell &amp;amp; Bond [-@blundell1998initial] allow us to model the dynamics that
traditional static panel models are not able to capture.
Correspondingly, the growing popularity of dynamic panel model will
stimulate demand for the related packages in open source programs such
as R, Python, and Julia,&lt;/p>
&lt;h1 id="statement-of-field">Statement of field&lt;/h1>
&lt;p>So far, there are several related packages in Stata and R.
Stata is a commercial software, while existing R packages have some
issues. For example, in our benchmark test R package panelvar [@sigmund2021panel] is more than 100 times slower than Stata package xtabond2 [@roodman2009xtabond2]. On the other hand, R package plm [@croissant2008panel]
is fast enough, but it
has calculation issue for system GMM. A third R package, pdynmc, crashed or refused to work several times in our tests. Due to these reasons, R packages above are far less popular than xtabond2, according to citations they
have received.&lt;/p>
&lt;p>Moreover, there is no Python or Julia package yet to estimate dynamic
panel model due to the complexity involved in implementation. Our
package contributes to the open source community because (1) it
implements all of the major features in the associated commercial packages in
Stata, (2) its innovative feature (as mentioned above) will stimulate similar or even more revolutionary features in the empirical computing community, and (3) though Python is interpreted, our package is almost as
fast as xtabond2 which was compiled as shown in figure below. This package will increase the usability of open source software in estimating dynamic panel models, because for a package to be attractive, it must be both accurate and fast. Moreover, unlike existing R
packages which rely heavily on R-specific components (that is a main
reason they are not fast), our code uses components common to any
programming language, making it easy to translate to R or Julia.&lt;/p>
&lt;p>&lt;img src="Test_1.png" alt="Running time (relative to the fastest).\label{fig:runtime}">{width=100%}&lt;/p>
&lt;h1 id="the-pydynpd-package">The pydynpd package&lt;/h1>
&lt;p>pydynpd is able to estimate the most complicated linear dynamic panel
models:&lt;/p>
&lt;p>$$y_{it}=\sum_{j=1}^{p}\alpha_{j}y_{i,t-j}+\sum_{k=1}^{m}\sum_{j=0}^{q_{k}}\beta_{jk}r_{i,t-j}^{(k)}+\boldsymbol{\delta}\boldsymbol{d_{i,t}}+\boldsymbol{\gamma}\boldsymbol{s_{i,t}}+u_{i}+\epsilon_{it}$$&lt;/p>
&lt;p>In the model above, $y_{i,t-j}$ ($j=1,2,\ldots,p$) denotes a group of
$p$ lagged dependent variables. $r_{i,t-j}^{(k)}$ represents a group of
$m$ endogenous variables other than lagged $y$. $\boldsymbol{d_{it}}$ is
a vector of predetermined variables which may potentially correlate with
past errors, $\boldsymbol{s_{it}}$ is a vector of exogenous variables,
and $u_{i}$ represents fixed effect. As lagged dependent variables such as $y_{i,t-1}$ are included as regressors, the
popular techniques in static panel models no longer produce consistent
results. Researchers have developed many methods to estimate dynamic
panel models. Essentially there are two types of GMM estimates,
difference GMM and system GMM. Just like other R and Stata packages, pydynpd fully implements these two methods.&lt;/p>
&lt;p>Due to space limit, we focus here on general discussion of the package. A detailed statistical/technique description of our package is available on &lt;a href="https://github.com/dazhwu/pydynpd/blob/main/vignettes/Guide.ipynb" target="_blank" rel="noopener">GitHub&lt;/a>.&lt;/p>
&lt;p>For illustration purpose, consider the following equation:
$$y_{it}=\sum_{j=1}^{\colorbox{yellow}p}\alpha_{j}y_{i,t-j}+\sum_{j=1}^{\colorbox{yellow}q_k}\beta_{j}r_{i,t-j}+{\delta}d_{i,t}+\gamma_{i,t}+u_{i}+\epsilon_{it}$$&lt;/p>
&lt;p>The equation above is related to a group/family of models with different combinations of $p$ and $q_{k}$ values. Unless existing economic theory indicates exactly what model to choose, researchers need to guess and try the values of $p$ and $q_{k}$ as highlighted in equation above. For example, if $p=2$ and $q_{k}=1$, then a specific model is formed:&lt;/p>
&lt;p>$$ y_{it}=\alpha_{1}y_{i,t-1}+\alpha_{2}y_{i,t-2}+\beta_{j}r_{i,t-j}+{\delta}d_{i,t}+\gamma_{i,t}+u_{i}+\epsilon_{it}$$&lt;/p>
&lt;p>&lt;img src="traditional.png" alt="How alternative packages work. \label{fig:traditional}">{width=100%}&lt;/p>
&lt;p>&lt;img src="new_struct.png" alt="The automatic mode in pydnynpd. \label{fig:auto_mode}">{width=100%}&lt;/p>
&lt;p>Figure 2 shows how other packages work: a user needs to choose a specific model, then based on that particular model the system generates the corresponding instrument matrix and panel data with dependent/independent variables so that the GMM process can produce regression results. An innovative feature of pydynpd is that it can also run in its &amp;ldquo;automatic&amp;rdquo; mode in which it doesn&amp;rsquo;t require users to choose a particular model. Instead, users may let pydynpd search for the lags (e.g., $p$ and $q_{k}$) so that the corresponding models satisfy certain standards. In other words, users may use pydynpd to estimate the following model with question markers indicating values not determined yet:&lt;/p>
&lt;p>$$y_{it}=\sum_{j=1}^{\colorbox{yellow} ?}\alpha_{j}y_{i,t-j}+\sum_{j=1}^{{\colorbox{yellow} ?}}\beta_{j}r_{i,t-j}+{\delta}d_{i,t}+\gamma_{i,t}+u_{i}+\epsilon_{it}$$&lt;/p>
&lt;p>Figure 3 shows how pydynpd&amp;rsquo;s automatic mode works: a user indicates what values pydynpd needs to search for (e.g., the question marks in equation above), and then pydynpd tries all possible models, and returns &amp;ldquo;good&amp;rdquo; models that pass dynamic models&amp;rsquo; specification tests (e.g., Hansen overidentification test and AR(2) test). Note that processes included in the dotted box in Figure 2 is represented as a black-box process named &amp;ldquo;traditional process&amp;rdquo; in Figure 3.&lt;/p>
&lt;h1 id="references">References&lt;/h1></description></item></channel></rss>