Type: Package
Title: Durbin-Hausman Panel Cointegration Tests
Version: 1.0.1
Date: 2026-03-07
Description: Implements the Durbin-Hausman panel cointegration tests of Westerlund (2008) <doi:10.1002/jae.963>. The tests are robust to cross-sectional dependence through common factor extraction using principal components. Provides both group-mean (DHg) and panel (DHp) test statistics with automatic factor number selection via information criteria.
License: GPL-3
Encoding: UTF-8
LazyData: true
Depends: R (≥ 3.5.0)
Imports: stats
Suggests: testthat (≥ 3.0.0), knitr, rmarkdown
RoxygenNote: 7.3.3
URL: https://github.com/muhammedalkhalaf/xtdhcoint
BugReports: https://github.com/muhammedalkhalaf/xtdhcoint/issues
NeedsCompilation: no
Packaged: 2026-03-08 10:16:40 UTC; acad_
Author: Muhammad Alkhalaf ORCID iD [aut, cre, cph], Merwan Roudane [ctb] (Original Stata implementation), Joakim Westerlund [ctb] (Original GAUSS code author)
Maintainer: Muhammad Alkhalaf <muhammedalkhalaf@gmail.com>
Repository: CRAN
Date/Publication: 2026-03-12 08:30:02 UTC

xtdhcoint: Durbin-Hausman Panel Cointegration Tests

Description

Implements the Durbin-Hausman panel cointegration tests of Westerlund (2008) doi:10.1002/jae.963. The tests are robust to cross-sectional dependence through common factor extraction using principal components. Provides both group-mean (DHg) and panel (DHp) test statistics with automatic factor number selection via information criteria.

Implements the Durbin-Hausman panel cointegration tests of Westerlund (2008). The tests are robust to cross-sectional dependence through common factor extraction using principal components.

Details

The package provides the xtdhcoint function for performing panel cointegration tests that account for cross-sectional dependence.

The main features include:

Author(s)

Maintainer: Muhammad Alkhalaf muhammedalkhalaf@gmail.com (ORCID) [copyright holder]

Other contributors:

References

Westerlund, J. (2008). Panel cointegration tests of the Fisher effect. Journal of Applied Econometrics, 23(2), 193–233. doi:10.1002/jae.963

See Also

Useful links:


Coef Method for xtdhcoint Objects

Description

Extracts the test statistics from the Durbin-Hausman test.

Usage

## S3 method for class 'xtdhcoint'
coef(object, ...)

Arguments

object

An object of class "xtdhcoint".

...

Additional arguments (currently ignored).

Value

Named numeric vector of z-statistics and p-values.


Fisher Effect Panel Dataset

Description

Simulated panel dataset for testing the Fisher effect (cointegration between inflation and nominal interest rates). The data are generated with cointegration and common factors, suitable for demonstrating the Durbin-Hausman panel cointegration tests.

Usage

fisher_panel

Format

A data frame with 1000 observations and 4 variables:

country

Character. Country identifier (Country01 through Country20).

year

Integer. Year (1970-2019).

inflation

Numeric. Annual inflation rate (percent).

interest

Numeric. Nominal interest rate (percent).

Details

The data are simulated according to:

inflation_{it} = \alpha_i + \beta_i \cdot interest_{it} + F_t' \lambda_i + e_{it}

where F_t are common factors, \lambda_i are factor loadings, and e_{it} is a stationary cointegration error (under cointegration).

The cointegrating coefficient \beta_i is approximately 1, consistent with the Fisher hypothesis.

Source

Simulated data.

Examples

data(fisher_panel)
head(fisher_panel)
table(fisher_panel$country)


Print Method for xtdhcoint Objects

Description

Prints the results of the Durbin-Hausman panel cointegration test.

Usage

## S3 method for class 'xtdhcoint'
print(x, ...)

Arguments

x

An object of class "xtdhcoint".

...

Additional arguments (currently ignored).

Value

Invisibly returns the input object.


Summary Method for xtdhcoint Objects

Description

Provides a detailed summary of Durbin-Hausman test results with decision tables at various significance levels.

Usage

## S3 method for class 'xtdhcoint'
summary(object, level = 0.95, ...)

Arguments

object

An object of class "xtdhcoint".

level

Numeric. Confidence level for hypothesis testing. Default is 0.95.

...

Additional arguments (currently ignored).

Value

Invisibly returns a list with summary statistics.


Durbin-Hausman Panel Cointegration Tests

Description

Performs the Durbin-Hausman panel cointegration tests of Westerlund (2008). The tests are robust to cross-sectional dependence through common factor extraction using principal components.

Usage

xtdhcoint(
  formula,
  data,
  id,
  time,
  kmax = 5,
  criterion = c("ic", "pc", "aic", "bic"),
  penalty = 1,
  bandwidth = -1,
  predet = 0,
  constant = TRUE
)

Arguments

formula

A formula specifying the cointegrating relationship (e.g., y ~ x1 + x2).

data

A data frame containing panel data.

id

Character string naming the cross-sectional unit identifier.

time

Character string naming the time period identifier.

kmax

Integer. Maximum number of common factors to consider. Default is 5.

criterion

Character string specifying the information criterion for factor number selection. One of "ic" (default), "pc", "aic", or "bic".

penalty

Integer. Penalty type for factor selection (1, 2, or 3). Default is 1.

bandwidth

Integer. Kernel bandwidth for long-run variance estimation. If -1 (default), automatic bandwidth selection using Newey-West rule.

predet

Numeric. If non-zero, uses predetermined coefficient instead of OLS estimation. Default is 0 (estimate via OLS).

constant

Logical. If TRUE (default), includes a constant term.

Details

The Durbin-Hausman tests examine the null hypothesis of no cointegration against the alternative of cointegration. The tests are based on comparing OLS and instrumental variable estimators of the autoregressive parameter in the cumulated residuals.

DHg (Group-mean statistic): Tests the null of no cointegration against the heterogeneous alternative that at least some units are cointegrated. Under the null, the standardized statistic is asymptotically N(0,1).

DHp (Panel statistic): Tests the null of no cointegration against the homogeneous alternative that all units are cointegrated with a common autoregressive parameter. Under the null, the standardized statistic is asymptotically N(0,1).

Both statistics are computed using right-tail critical values. Large positive values indicate evidence of cointegration.

Cross-sectional dependence is handled by extracting common factors from the first-differenced residuals using principal components. The number of factors is selected automatically using information criteria.

Value

An object of class "xtdhcoint" containing:

dhg

Raw DHg (group-mean) statistic.

dhp

Raw DHp (panel) statistic.

dhg_z

Standardized DHg z-statistic.

dhp_z

Standardized DHp z-statistic.

dhg_pval

P-value for DHg (right-tail).

dhp_pval

P-value for DHp (right-tail).

nf

Estimated number of common factors.

N

Number of cross-sectional units.

TT

Number of time periods.

bandwidth

Bandwidth used.

criterion

Information criterion used.

call

The matched call.

References

Westerlund, J. (2008). Panel cointegration tests of the Fisher effect. Journal of Applied Econometrics, 23(2), 193–233. doi:10.1002/jae.963

Examples

# Load example data
data(fisher_panel)


# Basic test with default settings
result <- xtdhcoint(inflation ~ interest, data = fisher_panel,
                    id = "country", time = "year")
print(result)
summary(result)