| Title: | Durbin-Hausman Panel Cointegration Tests |
|---|---|
| Description: | Implements the Durbin-Hausman panel cointegration tests of Westerlund (2008) <doi:10.1002/jae.967>. 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. |
| Authors: | Muhammad Alkhalaf [aut, cre, cph] (ORCID: <https://orcid.org/0009-0002-2677-9246>), Joakim Westerlund [ctb] (Original GAUSS code author) |
| Maintainer: | Muhammad Alkhalaf <[email protected]> |
| License: | GPL-3 |
| Version: | 1.0.5 |
| Built: | 2026-10-31 19:01:12 UTC |
| Source: | https://github.com/cran/xtdhcoint |
Extracts the test statistics from the Durbin-Hausman test.
## S3 method for class 'xtdhcoint' coef(object, ...)## S3 method for class 'xtdhcoint' coef(object, ...)
object |
An object of class |
... |
Additional arguments (currently ignored). |
Named numeric vector of z-statistics and p-values.
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.
fisher_panelfisher_panel
A data frame with 1000 observations and 4 variables:
Character. Country identifier (Country01 through Country20).
Integer. Year (1970-2019).
Numeric. Annual inflation rate (percent).
Numeric. Nominal interest rate (percent).
The data are simulated according to:
where are common factors, are factor loadings,
and is a stationary cointegration error (under cointegration).
The cointegrating coefficient is approximately 1, consistent
with the Fisher hypothesis.
Simulated data.
data(fisher_panel) head(fisher_panel) table(fisher_panel$country)data(fisher_panel) head(fisher_panel) table(fisher_panel$country)
Prints the results of the Durbin-Hausman panel cointegration test.
## S3 method for class 'xtdhcoint' print(x, ...)## S3 method for class 'xtdhcoint' print(x, ...)
x |
An object of class |
... |
Additional arguments (currently ignored). |
Invisibly returns the input object.
Provides a detailed summary of Durbin-Hausman test results with decision tables at various significance levels.
## S3 method for class 'xtdhcoint' summary(object, level = 0.95, ...)## S3 method for class 'xtdhcoint' summary(object, level = 0.95, ...)
object |
An object of class |
level |
Numeric. Confidence level for hypothesis testing. Default is 0.95. |
... |
Additional arguments (currently ignored). |
Invisibly returns a list with summary statistics.
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.
xtdhcoint( formula, data, id, time, kmax = 5, criterion = c("ic", "pc", "aic", "bic"), penalty = NULL, bandwidth = -1, predet = 0, nfactors = NULL )xtdhcoint( formula, data, id, time, kmax = 5, criterion = c("ic", "pc", "aic", "bic"), penalty = NULL, bandwidth = -1, predet = 0, nfactors = NULL )
formula |
A formula specifying the cointegrating relationship
(e.g., |
data |
A data frame containing panel data. Missing values in the
response, the regressors, |
id |
Character string naming the cross-sectional unit identifier. |
time |
Character string naming the time period identifier. Units are aligned on this variable (see Details, "Unbalanced panels"). |
kmax |
Integer. Maximum number of common factors to consider in the
search |
criterion |
Character string specifying the information criterion for
factor number selection. One of |
penalty |
Integer 1, 2 or 3 selecting the penalty function
|
bandwidth |
Integer. Bartlett kernel bandwidth |
predet |
Numeric. If non-zero, the slope(s) of the first-difference
regression are not estimated but set to the given value(s) (Westerlund,
2008, Remark 4). Either a single number applied to every regressor or a
vector of length |
nfactors |
Integer or |
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.
Computation. Following Westerlund (2008, Section 3.2), for each
unit the first differences of the response are regressed on the first
differences of the regressors over without an
intercept (eq. 12). Common factors are extracted from the
matrix of residuals by principal components, the
defactored differences are recumulated from zero,
with
, and the autoregression (13) is fitted over
. The statistics are therefore invariant to adding a
constant to the response or to any regressor.
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.
Number of factors. The number of common factors is selected by
minimising the chosen criterion over
(Westerlund, 2008, Remark 5; Bai and Ng, 2002, Theorem 2).
means that no factor is removed. For the "pc", "aic" and
"bic" criteria the scale is , as
allowed by Bai and Ng (2002, p. 201).
Number of regressors. The limiting distributions in Westerlund
(2008, Theorem 1 and Remark 3) do not depend on the regressors, so the
simulated moments of Remark 2 (5.5464, 36.7673, 0.5005, 0.3348) apply for
any number of regressors ; there is a single set of critical values.
What the theory does require is that the regressors are not cointegrated
among themselves (Assumption 1(d)). With several regressors the user should
check this condition; the function only reports . With
predet and , a single value is applied to every
regressor; supply a vector of length for different slopes.
Unbalanced panels. The test is defined for a balanced panel: the
common factors are extracted from a matrix
whose rows are calendar periods shared by all units (Westerlund, 2008,
Section 3.1 and p. 201), and the criterion of Remark 5 sums over
for every unit. When units are observed over
different periods the function keeps the common time window, the set of
values of time at which every unit is observed, drops the
observations outside it with a message, and requires that window to consist
of consecutive periods of the data (no unit may have a gap inside it). If
the common window has gaps, or fewer than 10 periods, the function stops
with an error. Duplicate values of time within a unit are an error.
Small N and N larger than T. The limiting distributions of
Theorem 1 require both and to grow, with going
to zero. In a Monte Carlo study of this version (Westerlund's Section 3.4
design, nominal 5 percent level, one factor fixed with nfactors = 1,
1000 replications for each of two seed sets) the null rejection rate was
38 to 41 percent for DHp with ( and ),
23 to 24 percent for DHp with ( and ),
and 57 to 60 percent for DHg with and . The
function therefore warns when or . The Bai and Ng
(2002) criteria are also asymptotic in both and : "for very
small N or T, the proposed criteria are inadequate" (p. 203). In their
Table I (, ) with , every criterion
except BIC3 averages the upper bound 8, whereas BIC3 averages 7.18
() and 5.88 (). The function warns when and the
number of factors is selected automatically; fix the number of factors with
nfactors or report results for several values of kmax.
An object of class "xtdhcoint" containing:
Raw DHg (group-mean) statistic.
Raw DHp (panel) statistic.
Standardized DHg z-statistic.
Standardized DHp z-statistic.
P-value for DHg (right-tail).
P-value for DHp (right-tail).
Number of common factors used (estimated, or fixed by
nfactors). 0 means that no factor was removed.
Logical. TRUE when the information criterion
selected the upper bound kmax.
The value of the nfactors argument.
Number of cross-sectional units.
Number of time periods in the analysed window.
The first and last value of time in the
analysed window.
Number of observations outside the common time window that were dropped.
Number of regressors.
Bandwidth used.
Upper bound of the factor search actually used.
Information criterion used.
Penalty function used (NA for "aic" and
"bic").
The matched call.
Westerlund, J. (2008). Panel cointegration tests of the Fisher effect. Journal of Applied Econometrics, 23(2), 193–233. doi:10.1002/jae.967
Bai, J. and Ng, S. (2002). Determining the number of factors in approximate factor models. Econometrica, 70(1), 191–221. doi:10.1111/1468-0262.00273
Newey, W. K. and West, K. D. (1994). Automatic lag selection in covariance matrix estimation. Review of Economic Studies, 61(4), 631–653. doi:10.2307/2297912
# 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)# 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)