*! version 1.0 25apr2026

Title

xtgmcoint -- Estimate the cointegrating relationship in heterogeneous panels using Pedroni's group-mean Fully Modified OLS (FMOLS) and Dynamic OLS (DOLS)

Syntax

xtgmcoint depvar indepvars [if] [in] , method(string) [options]

Required
method(string) dols or fmols

Common to both methods
tdum include common time dummies (subtract cross-section means at each time period)

trend include linear time trend

b(numlist) null hypothesis vector for the long-run coefficients (one value per regressor, or a single value applied to all); default 0

average(string) simple (default), sqrt, precision

full display regression details for each cross-section unit

ttest use t-distribution (with finite-sample degrees of freedom) instead of standard normal for unit-level p-values and confidence intervals when full is specified

DOLS-specific (method(dols))
dlags(#) leads/lags of D.x in the DOLS regression; default 2

lags(#) Bartlett kernel lag for Newey-West HAC; default auto

pedroni2001 option to replicate Pedroni (2001) Table 1 panel results; uses the (T+2*lags) HAC denominator from the original code instead of the default T denominator

FMOLS-specific (method(fmols))
lags(#) Bartlett kernel lag for long-run covariance; default auto

Post-estimation
resid(name) save residuals (matches RATS %resids: y - alpha_GM - X*beta_panel)

fit(name) save fitted values (= y - resid)

Description

xtgmcoint estimates Pedroni's (2000, 2001) between-dimension group-mean
panel cointegration estimators in heterogeneous panels:

method(dols) - Group-Mean Panel Dynamic OLS (Pedroni 2001).
Replicates RATS @paneldols (paneldols.src, SSC: RTS00150).

method(fmols) - Group-Mean Panel Fully Modified OLS (Pedroni 2000).
Replicates RATS @panelfm (panelfm.src, SSC: RTS00151).

Output matches the corresponding RATS routine to four decimal places
across univariate and multivariate specifications, balanced and unbalanced
panels, with or without time dummies and trend, and all three averaging
methods (simple, sqrt, precision).

Post-estimation variables

A single post-estimation variable can be saved to the dataset.

resid(name) Residuals: y[it] - alpha_GM - X[it]'*beta_panel,
computed using the panel-mean slope coefficients on x and the simple mean of
unit-level intercepts. This corresponds exactly to the %RESIDS series
produced by Pedroni's RATS routines (paneldols.src and panelfm.src), and is
the input typically used for panel cointegration tests such as Pedroni's
PP/ADF, Westerlund (2005, 2007), or Kao tests.

fit(name) Fitted values: y[it] - resid[it], the model's
predicted value of y[it] using the panel-mean slope coefficients and the
group-mean of unit intercepts. Equivalent to RATS' set fit = y - %resids.

Examples

Example 1: Replication of Pedroni (2001), Table 1 - xtgmcoint and RATS Codes

To replicate Pedroni (2001) Table 1 results in RATS, click the link below
for the required files:

https://eruygurakademi.com/datasets/rats_req_files.txt

or download the zip archive shown below:

https://eruygurakademi.com/datasets/pedroni2001_replication_winrats.zip

Place the files in this archive into a folder and set that folder as the
working directory in RATS. Running the pedroni_ppp.rpf file from
the zip archive produces the following results:

Country FMOLS t-stat DOLS t-stat

UK 0.68 -2.59** 0.67 -1.88*

Belgium 0.31 -1.74* 0.23 -1.93*

Denmark 1.63 1.95* 1.90 2.80**

France 2.00 5.95** 2.21 7.96**

Germany 0.80 -1.42 0.91 -0.59

Italy 0.97 -0.48 1.08 1.11

Holland 0.69 -1.92* 0.66 -2.03*

Sweden 1.22 1.16 1.16 0.81

Switzerland 1.27 1.96* 1.36 2.21*

Canada 1.44 2.01* 1.43 1.85*

Japan 1.79 5.21** 1.75 4.94**

Greece 1.02 0.54 0.99 -0.36

Portugal 1.05 1.41 1.09 2.42*

Spain 0.93 -0.83 1.02 0.18

Turkey 1.10 6.36** 1.11 5.74**

New Zealand 1.11 2.58** 1.02 0.60

Chile 1.21 10.32** 1.37 10.77**

Mexico 1.03 3.43** 1.03 3.54**

India 2.12 8.15** 2.06 7.67**

South Korea 0.93 -1.06 0.88 -1.44

Panel Results

Without Time Dummies

Between 1.17 8.67** 1.20 9.34**

With Time Dummies

Between 1.12 13.48** 1.14 12.50**

The corresponding xtgmcoint commands to produce the same results
are as follows:

. use https://eruygurakademi.com/datasets/pedronidata.dta, clear

. xtgmcoint logexrate logratio, method(dols) dlags(4) lags(4) b(1) full ttest

. xtgmcoint logexrate logratio, method(fmols) lags(4) b(1) full ttest

Note that in Pedroni (2001), panel results of Table 1 are produced with
lags=5, mlags=5. In xtgmcoint, the Pedroni (2001) Table 1
panel "Between" values for DOLS are reproduced exactly with the
pedroni2001 option, which uses the (T+2*lags) HAC denominator
from the original code:

. xtgmcoint logexrate logratio, method(dols) dlags(5) lags(5) b(1) pedroni2001

beta = 1.2024, t = 9.5374 (Pedroni 2001 Table 1: 1.20, 9.54)

. xtgmcoint logexrate logratio, method(dols) dlags(5) lags(5) b(1) tdum pedroni2001

beta = 1.1409, t = 12.7611 (Pedroni 2001 Table 1: 1.14, 12.76)

Example 2: Model specifications

. use https://eruygurakademi.com/datasets/pedronidata.dta, clear

With constant (default):

. xtgmcoint logexrate logratio, method(fmols)

. xtgmcoint logexrate logratio, method(dols)

Model with trend:

. xtgmcoint logexrate logratio, method(fmols) trend

. xtgmcoint logexrate logratio, method(dols) trend

With time dummies:

. xtgmcoint logexrate logratio, method(dols) tdum

. xtgmcoint logexrate logratio, method(fmols) tdum

With time dummies and trend:

. xtgmcoint logexrate logratio, method(dols) tdum trend

. xtgmcoint logexrate logratio, method(fmols) tdum trend

With different lag options:

. xtgmcoint logexrate logratio, method(dols) lags(5) dlags(5) trend

. xtgmcoint logexrate logratio, method(fmols) lags(5) trend

Equivalent RATS code:

https://www.eruygurakademi.com/datasets/ex2_rats_code.txt

Example 3: Multivariate example

. use https://eruygurakademi.com/datasets/pedronidata.dta, clear

. gen logwpi_ratio = log(wpi/uswpi)

. xtgmcoint logexrate logratio logwpi_ratio, method(dols) lags(5) dlags(5)

. xtgmcoint logexrate logratio logwpi_ratio, method(fmols) lags(5)

Equivalent RATS code:

https://www.eruygurakademi.com/datasets/ex3_rats_code.txt

Example 4: Multivariate example with different null hypotheses per variable via b() vector

The b() option accepts either a single value (applied to every RHS
coefficient) or a vector of values (one per RHS) for testing different null
hypotheses on different coefficients. With four right-hand-side variables
(uswpi, uscpi, cpi, wpi), test H0: theta_uswpi = 1 and
H0: theta = 0 for the others:

. xtgmcoint logexrate uswpi uscpi cpi wpi, method(dols) lags(5) dlags(5) b(1 0 0 0)

Equivalent RATS code:

https://www.eruygurakademi.com/datasets/ex4_rats_code.txt

Example 5: Short-T multivariate example (T=46)

Truncating to first 46 months (matching typical macro-panel length):

. use https://eruygurakademi.com/datasets/pedronidata.dta, clear

. gen logwpi_ratio = log(wpi/uswpi)

. bysort country (time): keep if _n <= 46

. xtgmcoint logexrate logratio logwpi_ratio, method(dols) lags(2) dlags(2)

. xtgmcoint logexrate logratio logwpi_ratio, method(fmols) lags(2)

Equivalent RATS code:

https://www.eruygurakademi.com/datasets/ex5_rats_code.txt

Example 6: Comparison with xtpedroni (Neal 2014)

xtpedroni uses a slightly different Newey-West denominator
(T+2*lags vs T). To replicate xtpedroni's PDOLS results exactly,
use the pedroni2001 option:

. xtgmcoint logexrate logratio, method(dols) lags(5) dlags(5) b(1) pedroni2001

. xtpedroni logexrate logratio, lags(5) mlags(5) b(1) notdum notest

Example 7: Saving residuals and fitted y values

. use https://eruygurakademi.com/datasets/pedronidata.dta, clear

. xtgmcoint logexrate logratio, method(fmols) lags(5) resid(ehat_fm) fit(yhat_fm)

. xtgmcoint logexrate logratio, method(dols) lags(5) dlags(5) resid(ehat_dols) fit(yhat_dols)

. summ ehat_fm yhat_fm ehat_dols yhat_dols

Equivalent RATS code:

https://www.eruygurakademi.com/datasets/ex7_rats_code.txt

Example 8: All three averaging methods

. xtgmcoint logexrate logratio, method(fmols) lags(5) b(1) average(simple)

. xtgmcoint logexrate logratio, method(fmols) lags(5) b(1) average(sqrt)

. xtgmcoint logexrate logratio, method(fmols) lags(5) b(1) average(precision)

Equivalent RATS code:

https://www.eruygurakademi.com/datasets/ex8_rats_code.txt

Example 9: Density plot of unit-level estimates

After estimation, unit-level coefficients can be exported and visualized:

. xtgmcoint logexrate logratio, method(fmols) lags(5)

. preserve

. clear

. svmat e(ibetas), names(beta_)

. kdensity beta_1, normal

. restore

This shows the cross-section distribution of the unit-level long-run
coefficients, useful for assessing heterogeneity and identifying
outlier units.

Stored results

xtgmcoint stores the full set of estimation results in e(),
following Stata's standard convention.

Scalars

e(N) total number of observations used across all units

e(N_g) number of cross-sectional units retained (units with insufficient observations are dropped)

e(K_x) number of long-run regressors (length of indepvars)

e(dlags) number of DOLS leads/lags (method(dols) only)

e(lags) Bartlett kernel HAC bandwidth (auto if not specified)

Macros

e(cmd) always xtgmcoint

e(method) dols or fmols (whichever was used)

e(depvar) name of the dependent variable

e(xvars) names of the long-run regressors

e(average) group-mean averaging method: simple, sqrt, or precision

e(tdum) yes if time dummies were applied, no otherwise

Matrices - Panel-level (group-mean)

e(b_lr) 1 x K_x row vector of panel long-run coefficients (theta_GM).
This is the main result reported in the output table.

e(se_lr) 1 x K_x row vector of panel standard errors, derived from cross-section dispersion of unit-level estimates.

e(V_lr) K_x x K_x panel variance-covariance matrix.

e(t_lr) 1 x K_x row vector of panel t-statistics, computed as t = (1/sqrt(N_g)) sum[i] (theta_hat[i] - b0) / SE[i]. Distributed N(0,1) under standard panel-cointegration assumptions.

e(b0) 1 x K_x row vector of null hypothesis values for the long-run coefficients (set by b(); default zeros).

Matrices - Unit-level (matches RATS @paneldols / @panelfm output)

e(ibetas) N_g x K_x matrix. Each row i contains unit i's long-run coefficient vector (theta_hat[i]). Matches RATS' %%IBETAS.

e(istderr) N_g x K_x matrix of unit-level standard errors. Matches RATS' %%ISTDERRS.

e(itstats) N_g x K_x matrix of unit-level t-statistics, computed against the null b() (default 0). Matches RATS' %%ITSTATS.

How to access stored results

. matrix list e(b_lr)

. matrix list e(ibetas)

. di "Panel coefficient: " e(b_lr)[1,1]

. di "Method used: " e(method)

. di "Number of valid units: " e(N_g)

The unit-level matrices (e(ibetas), e(istderr), e(itstats))
are useful for further analysis, e.g. constructing density plots of
unit-level estimates, identifying outlier countries, or building
heterogeneity diagnostics.

References

Pedroni, P. 2000. Fully modified OLS for heterogeneous cointegrated panels.
Advances in Econometrics 15: 93-130.

Pedroni, P. 2001. Purchasing power parity tests in cointegrated panels.
Review of Economics and Statistics 83(4): 727-731.

Pedroni, P. paneldols.src (RATS procedure, January 2000). SSC: RTS00150.

Pedroni, P. panelfm.src (RATS procedure). SSC: RTS00151.

Phillips, P. C. B., and B. E. Hansen. 1990. Statistical inference in
instrumental variables regression with I(1) processes.
Review of Economic Studies 57(1): 99-125.

Stock, J. H., and M. W. Watson. 1993. A simple estimator of cointegrating
vectors in higher order integrated systems. Econometrica 61(4): 783-820.

Author

H. Ozan Eruygur

AHBV University, Ankara, Turkiye

Department of Economics

https://www.ozaneruygur.com

eruygur@gmail.com

Eruygur Academy and Consulting (Eruygur Akademi ve Danismanlik), Ankara, Turkiye

https://www.eruygurakademi.com

eruygurakademi@gmail.com

xtgmcoint v1.0 - April 2026

Citation

Please cite as:

Eruygur, H. O. 2026. xtgmcoint: Native Stata implementation of Pedroni's
group-mean panel cointegration FMOLS and DOLS estimators (Pedroni 2000, 2001).
Stata package version 1.0. Available from: https://www.eruygurakademi.com

Also see

Online: help for xtpedroni