*! version 1.0.0 23jan2026

Title

kmtest -- Kobayashi-McAleer tests of linear and logarithmic transformations for integrated processes

Syntax

kmtest
varname
[if] [in]
[, options]

Model
lags(#) include # autoregressive lags in the model

nodrift assume the process has no drift (use U1/U2 statistics)

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

detail display additional parameter estimates

graph produce diagnostic graphs

savegraph(filename) save graph to file

varname must be a time-series variable with strictly positive values.
You must tsset your data before using kmtest; see [TS] tsset.

Description

kmtest performs the Kobayashi-McAleer (1999) non-nested tests for determining
whether a time series should be modeled in levels (linear form) or in logarithms
(logarithmic form) when the series is integrated of order one, I(1).

The test addresses the common problem in applied econometrics of choosing between
modeling a variable y_t directly or modeling its logarithm ln(y_t). This
choice has important implications for interpretation and inference.

The command provides two pairs of test statistics:

V1 and V2 (used when drift is present): These tests follow an asymptotic
normal distribution under the null hypothesis.

U1 and U2 (used when there is no drift): These tests follow a nonstandard
distribution related to functionals of Brownian motion.

Options

Model

lags(#) specifies the number of autoregressive lags to include when
modeling the first differences of the series. The default is lags(0),
which assumes the innovations are serially uncorrelated.

nodrift specifies that the integrated process is assumed to have no drift
(mean zero first differences). When this option is specified, the U1 and U2
test statistics are computed, which follow a nonstandard distribution. Without
this option, the V1 and V2 statistics are computed, which are asymptotically
normal.

Reporting

level(#) specifies the confidence level, as a percentage, for determining
statistical significance. The default is level(95).

detail displays additional information including estimated drift parameters
and innovation variances for both the linear and logarithmic models.

graph produces a two-panel time series graph showing the original series
and its logarithm for visual comparison.

savegraph(filename) saves the diagnostic graph to the specified file.

Examples

Setup: Load example data

. webuse lutkepohl2, clear

. tsset

Basic test with drift (V1/V2 statistics)

. kmtest consumption

Test with 2 autoregressive lags

. kmtest consumption, lags(2)

Test without drift (U1/U2 statistics)

. kmtest interest, nodrift

Test with detailed output and graph

. kmtest consumption, lags(1) detail graph

Stored results

kmtest stores the following in r():

Scalars

r(N) number of observations

r(lags) number of AR lags

When drift is assumed present:

r(V1) V1 test statistic (H0: linear)

r(V1_pval) p-value for V1

r(V2) V2 test statistic (H0: logarithmic)

r(V2_pval) p-value for V2

r(mu) estimated drift in linear model

r(eta) estimated drift in log model

r(sigma) estimated std. dev. in linear model

r(omega) estimated std. dev. in log model

When drift is not present:

r(U1) U1 test statistic (H0: linear)

r(U1_pval) approximate p-value for U1

r(U2) U2 test statistic (H0: logarithmic)

r(U2_pval) approximate p-value for U2

r(sigma) estimated std. dev. in linear model

r(omega) estimated std. dev. in log model

Macros

r(varname) name of the tested variable

r(test_type) with_drift or no_drift

r(conclusion) linear, logarithmic, both, or neither

r(cmd) kmtest

Methods and formulas

The Linear Model

The linear I(1) model is defined as:

y_t - y_ = e_t + μ

where e_t follows an AR(p) process: α(L)e_t = ε_t, with α(L) = 1 - α_1L - ... - α_pL^p.

The Logarithmic Model

The logarithmic I(1) model is defined as:

log(y_t) - log(y_) = u_t + η

where u_t follows an AR(p) process: β(L)u_t = ζ_t.

Test Statistics with Drift (V1 and V2)

Under the linear model, the conditional variance of Δy_t given y_ is constant.
Under the logarithmic model, it is proportional to y_^2. This motivates a test
based on the correlation between y_ and z_t^2, where z_t are the residuals from
an AR(p) regression on Δy_t.

The V1 statistic testing H0: Linear model is:

V1 = n^(-3/2) * Σ y_(z_t^2 - s^2) / √(s^4 * m^2 / 6)

which is asymptotically N(0,1) under the null.

The V2 statistic testing H0: Logarithmic model is:

V2 = n^(-3/2) * Σ (-log y_)(v_t^2 - w^2) / √(w^4 * h^2 / 6)

which is also asymptotically N(0,1) under the null.

Test Statistics without Drift (U1 and U2)

When there is no drift, the asymptotic distributions are nonstandard:

U1 → ∫₀¹ W₁(r)dW₂(r) - ∫₀¹ W₁(r)dr ∫₀¹ dW₂(r)

U2 → -∫₀¹ W₁(r)dW₂(r) + ∫₀¹ W₁(r)dr ∫₀¹ dW₂(r)

where (W₁, W₂) is a two-dimensional Brownian motion with zero covariance.

Critical Values for U1 and U2

+
+
| Significance Critical |
| Level Value |
+
+
| 10% 0.477 |
| 5% 0.664 |
| 1% 1.116 |
+
+

References

Kobayashi, M. and M. McAleer. 1999. Tests of linear and logarithmic transformations
for integrated processes. Econometric Reviews 18(2): 187-209.

Dickey, D. A. and W. A. Fuller. 1979. Distribution of the estimates for autoregressive
time series with a unit root. Journal of the American Statistical Association
74(366): 427-431.

Granger, C. W. J. and J. Hallman. 1991. Nonlinear transformations of integrated
time series. Journal of Time Series Analysis 12(3): 207-218.

Ermini, L. and D. F. Hendry. 1995. Log income versus linear income: An application
of the encompassing principle. Presented at the 7th World Congress of the
Econometric Society, Tokyo, Japan.

Author

Dr. Merwan Roudane

Implementation based on Kobayashi & McAleer (1999)

Version 1.0.0, January 2026

Please cite as:

Roudane, M. 2026. KMTEST: Stata module for testing linear and logarithmic
transformations of integrated processes.

Also see

Manual: [TS] dfuller, [TS] dfgls, [R] boxcox

Help: [TS] dfuller, [TS] dfgls, [R] boxcox