help xtpmg version 2.0.1

Title

xtpmg -- Pooled Mean-Group, Mean-Group, and
Dynamic Fixed Effects Models with Lag Selection, Short-Run Tables,
Half-Life & Impulse Response

Version

Version 2.0.1, 12 February 2026

Updated by: Dr Merwan Roudane (merwanroudane920@gmail.com)

Original authors: Edward F. Blackburne III and Mark W. Frank, Sam Houston State University (2007)

What's new in version 2.0.1:

- Automatic Lag Selection: New maxlag() and lagsel() options for optimal ARDL lag order via AIC/BIC

- Per-Panel Short-Run Table: New srtable option displays heterogeneous SR coefficients with significance stars

- Half-Life of Adjustment: New halflife option computes ln(2)/|phi_i| for each panel

- Impulse Response Simulation: New irf() option traces shock propagation through EC mechanism

- Graph Visualizations: New graph option generates publication-quality Stata graphs

- Enhanced Display: Box-drawn sections, ARDL order notation, improved formatting

What was fixed in version 2.0.0:

- Fixed r(110) "invalid new variable name" error that occurred in Stata 15.1+

- Root cause: Stata's _predict update (Feb 2019) disallows output variable names matching estimation result names

- Default EC variable name changed from __ec to ECT for readability

Syntax

xtpmg depvar [indepvars] [if] [in] [, options]

Model
lr(varlist) terms to be included in long-run cointegrating vector

noconstant suppresses constant term

cluster(varname) adjust standard errors for intragroup
correlation

ec(name) name of newly created error-correction term; default is ECT

constraints(string) constraints to be applied to the model

replace overwrite error correction term, if it exists

full display all panel regressions for MG and PMG models

pmg|mg|fe estimation method. Default is pmg.

Lag Selection (New in 2.0.1)
maxlag(#) maximum lag order to search; default is 4, range 1-8

lagsel(string) lag selection criterion: aic, bic, or both

Diagnostics (New in 2.0.1)
srtable display per-panel short-run coefficient table

halflife compute and display half-life of adjustment per panel

irf(#) simulate impulse response for # periods (e.g., irf(20))

graph generate publication-quality Stata graphs for ECT, half-life, IRF, and SR coefficients

Maximum Likelihood Options

Only valid with pmg.

technique(algorithm) specifies the ml maximization technique

difficult will use a different stepping algorithm in non-concave
regions of the likelihood

Reporting
level(#) set confidence level; default is level(95)

You must tsset your data before using xtpmg; see tsset.

varlists may contain time-series operators; see
tsvarlist.

Description

xtpmg aids in the estimation of large N and large T panel-data models where
nonstationarity may be a concern. In addition to the traditional dynamic fixed effects models,
xtpmg allows for the pooled mean group and mean group estimators.

Version 2.0.1 introduces automatic lag selection, per-panel diagnostics, and
impulse response analysis — tools frequently needed by researchers working with
Panel ARDL models.

New Features in 2.0.1

Automatic Lag Selection

The lagsel() option automates the process of finding optimal ARDL lag orders
using information criteria. For each panel unit, xtpmg tests all lag orders
from 1 to maxlag() and selects the optimal using AIC or BIC (Schwarz criterion).

The selected lag order is reported in ARDL(p,q1,q2,...) notation. The modal
(most frequent) lag across panels is used for pooled estimation.

Per-Panel Short-Run Table

The srtable option displays a formatted table showing heterogeneous short-run
coefficients for each panel unit. In PMG estimation, long-run coefficients are
constrained to be equal, but short-run dynamics differ across panels. This table
reveals those differences with significance indicators (***, **, *).

Half-Life of Adjustment

The halflife option computes the half-life of adjustment to long-run equilibrium
for each panel using the formula:

half_life_i = ln(2) / |phi_i|

where phi_i is the panel-specific error correction coefficient. Also reports the
speed of adjustment (% of disequilibrium corrected per period) and convergence status.

Impulse Response Simulation

The irf(#) option simulates the dynamic response to a one-unit shock, tracing
the adjustment path through the error-correction mechanism for # periods. Reports
cumulative adjustment percentage and remaining gap with a visual ASCII display.

Options

Model

constraints(constraints), noconstant; see estimation options.

lr(varlist) specifies the variables to be included in the cointegrating vector.

ec(name) specifies the name of the error-correction variable. Default is ECT.

cluster(varname); see estimation options.

replace replaces the error correction variable in memory, if it exists.

full displays all panel estimation output.

pmg|mg|fe selects the estimation procedure. pmg is the default.

Lag Selection

maxlag(#) maximum lag to search. Default is 4, range 1-8.

lagsel(string) criterion: aic (Akaike), bic (Schwarz/Bayesian),
or both (report both, use AIC for selection).

Diagnostics

srtable displays a table of short-run coefficients for each panel ID.

halflife computes half-life = ln(2)/|phi_i| for each panel.

irf(#) simulates impulse response for # periods. Typically 10-30.

Visualization

graph generates publication-quality Stata graphs. When specified, the following
graphs are produced:

1. xtpmg_ect: Error correction term bar chart by panel, color-coded by convergence strength (green = strong, amber = moderate, red = non-convergent)

2. xtpmg_halflife: Horizontal bar chart of half-life of adjustment per panel with mean reference line

3. xtpmg_irf: Impulse response area chart showing shock adjustment path with half-life marker (requires irf(#))

4. xtpmg_sr_combined: Combined panel of per-panel short-run coefficients with 95% confidence intervals (requires full)

Graphs are stored in memory and can be saved using graph export. For example:

. graph export xtpmg_irf.png, name(xtpmg_irf) replace

Examples

Basic PMG estimation:

. xtpmg d.c d.y d.pi, lr(l.c y pi) full

PMG with automatic lag selection (AIC):

. xtpmg d.c d.y d.pi, lr(l.c y pi) maxlag(4) lagsel(aic) replace

PMG with lag selection (both AIC and BIC):

. xtpmg d.c d.y d.pi, lr(l.c y pi) maxlag(6) lagsel(both) replace

PMG with per-panel short-run table:

. xtpmg d.c d.y d.pi, lr(l.c y pi) srtable replace

PMG with half-life computation:

. xtpmg d.c d.y d.pi, lr(l.c y pi) halflife replace

PMG with impulse response (20 periods):

. xtpmg d.c d.y d.pi, lr(l.c y pi) irf(20) replace

Full analysis — all new features:

. xtpmg d.c d.y d.pi, lr(l.c y pi) maxlag(4) lagsel(aic) srtable halflife irf(20) full replace

Mean Group with diagnostics:

. xtpmg d.c d.y d.pi, lr(l.c y pi) mg halflife replace

DFE estimation:

. xtpmg d.c d.y d.pi, lr(l.c y pi) fe replace

Graph Examples

Basic graphs (ECT + Half-Life charts):

. xtpmg d.c d.y d.pi, lr(l.c y pi) graph full replace

Produces: xtpmg_ect (ECT bar chart) and xtpmg_halflife (half-life chart).

Graphs with impulse response plot:

. xtpmg d.c d.y d.pi, lr(l.c y pi) irf(20) graph full replace

Produces: xtpmg_ect, xtpmg_halflife, and xtpmg_irf (IRF area chart).

All graphs including short-run coefficient plot:

. xtpmg d.c d.y d.pi, lr(l.c y pi) irf(15) graph full replace

Produces all 4 graphs: xtpmg_ect, xtpmg_halflife, xtpmg_irf,
and xtpmg_sr_combined (requires full).

Complete workflow with lag selection, diagnostics, and graphs:

. xtpmg d.c d.y d.pi, lr(l.c y pi) maxlag(4) lagsel(both) srtable halflife irf(20) graph full replace

Exporting graphs to file:

. graph export xtpmg_irf.png, name(xtpmg_irf) replace width(1200)

. graph export xtpmg_ect.png, name(xtpmg_ect) replace width(1200)

. graph export xtpmg_halflife.pdf, name(xtpmg_halflife) replace

. graph export xtpmg_sr.png, name(xtpmg_sr_combined) replace width(1600)

Stored Results

xtpmg stores the following in e():

Scalars

e(N) number of observations

e(n_g) number of groups

e(g_min) minimum group size

e(g_avg) average group size

e(g_max) maximum group size

e(ll) log likelihood

e(sigma) estimated sigma

Macros

e(cmd) xtpmg

e(model) estimation model (pmg, mg, or fe)

e(depvar) name of dependent variable

e(ivar) name of panel variable

e(tvar) name of time variable

e(ardl_order) ARDL order notation (if lagsel() used)

Matrices

e(b) coefficient vector

e(V) variance-covariance matrix

e(sig2_i) panel-specific variance estimates (PMG only)

e(phi_i) panel-specific ECT coefficients (PMG only)

e(irf) impulse response function matrix (if irf() used)

References

Blackburne, E.F. III and M.W. Frank. 2007.
Estimation of nonstationary heterogeneous panels.
Stata Journal 7(2): 197-208.

Pesaran, M.H., Y. Shin, and R.P. Smith. 1999.
Pooled mean group estimation of dynamic heterogeneous panels.
Journal of the American Statistical Association 94: 621-634.

Pesaran, M.H. and R. Smith. 1995.
Estimating long-run relationships from dynamic heterogeneous panels.
Journal of Econometrics 68: 79-113.

Authors

Version 2.0.1 update:

Dr Merwan Roudane

merwanroudane920@gmail.com

Original version (1.1.1):

Edward F. Blackburne III and Mark W. Frank

Sam Houston State University

Also see

Manual: [XT] xt

xtdata, xtdes,
xtreg, xtsum,
xttab; tsset