*! version 1.0.2 14may2026
help kpssbr

Title

kpssbr -- KPSS unit root tests with up to 2 structural breaks

Syntax

kpssbr varname [if] [in] [, options]

trend add a linear trend to the deterministic component (only with breaks(0))

breaks(#) number of structural breaks: 0 (default), 1, or 2

model(spec) for breaks(1): intercept (default) | both

for breaks(2): 1=AAn (default) | 2=AA | 3=BB | 4=CC

lags(spec) lag rule: short (default) | long | nil | positive integer

use(spec) auto bandwidth: method kernel (e.g. nw ba) | fixed integer

trim(#) trimming for the breaks(1) search (default 0.10)

trace print progress for breaks(2) (cubic in T)

Description

kpssbr implements the family of KPSS stationarity tests, with the
null of I(0) stationarity. The test statistic is

eta = T^(-2) * sum(S_t^2) / lrv

where S_t is the partial sum of regression residuals from the deterministic
specification, and lrv is a kernel estimate of the long-run variance. The
null is rejected when eta exceeds the right-tail critical value.

Three variants are available:

- breaks(0) (default): classic KPSS of
Kwiatkowski, Phillips, Schmidt and Shin (1992),
with intercept only (without trend) or intercept+trend (with trend).

- breaks(1): one unknown break extension of
Kurozumi (2002). model(intercept) =
level shift only; model(both) = level + slope shift. The break point
is the value of TB in the trimmed range [round(trim*T), round((1-trim)*T)]
that minimises eta.

- breaks(2): two unknown breaks of
Carrion-i-Silvestre and Sanso (2007). Four models
via model(): 1=AAn (two level shifts only), 2=AA (level
shifts + trend), 3=BB (trend shifts), 4=CC (level + trend
shifts). Joint search over all pairs (TB1, TB2). Cubic in T.

Options

trend adds a linear trend to the deterministic component. Only
relevant when breaks(0), the default. Without trend the
test is run against the null of level stationarity (intercept
only); with trend it is run against the null of trend
stationarity (intercept + linear trend). The choice changes both the
regressors used to compute residuals AND the critical values; see Ho's
COINT::kpss for details.

breaks(#) selects the number of structural breaks:
0 (default) is the classic KPSS test;
1 is the Kurozumi (2002) one-break extension;
2 is the Carrion-i-Silvestre and Sanso (2007) two-break extension.

model(spec) selects the deterministic specification of the break
tests.

For breaks(1) (Kurozumi 2002), the regression of the time series
on the deterministic component is:

intercept (default): a level shift at the break date TB. The
regressors are: a constant and a level-shift dummy
DU(t) = 1 if t > TB, 0 otherwise.

both: a level shift plus a slope shift. The regressors are: a
constant, a linear trend, a level-shift dummy DU(t), and a slope-shift
dummy DT(t) = (t - TB)/T if t > TB, 0 otherwise.

For breaks(2) (Carrion-i-Silvestre and Sanso 2007), four models
are available, distinguished by which deterministic features change at
the two break dates TB1 and TB2:

1 = AAn: two level shifts, no trend. Regressors: constant,
DU1(t), DU2(t).

2 = AA: two level shifts and a linear trend (the trend itself
does not break). Regressors: constant, trend, DU1(t), DU2(t).

3 = BB: two slope shifts and a linear trend (no level jumps).
Regressors: constant, trend, DT1(t), DT2(t).

4 = CC: both level and slope shifts at each break point.
Regressors: constant, trend, DU1(t), DU2(t), DT1(t), DT2(t).

Here DUi(t) = 1 if t > TBi (level dummy) and DTi(t) = (t - TBi)/T if
t > TBi (slope dummy), for i = 1, 2; both dummies are zero before the
break. The break dates TB1 and TB2 are chosen jointly to minimise the
KPSS statistic over all admissible pairs.

lags(spec) controls the lag length lmax used in the kernel sum
that estimates the long-run variance (LRV). The LRV enters the KPSS
statistic as the denominator:

eta = T^(-2) * sum(S_t^2) / lrv

The lag sum corrects the LRV for serial correlation in the residuals.
With u_t denoting the regression residual,

lrv = (1/T) sum_t u_t^2 + (2/T) sum_^ w(j,lmax) sum_t u_t u_

The first term is the ordinary residual variance; the second sum adds
the autocovariances up to lag lmax, weighted by the kernel w. The
lags() option only sets lmax (the kernel under lags() is
always Bartlett; see use() for other kernels).

short (default) sets lmax = floor(4*(T/100)^(2/9)). This is the
rule used by Tsung-wu Ho's COINT::kpss with lags="short" and
originates from KPSS (1992, appendix). Adequate when the residuals show
only weak serial correlation. For T=703 this gives lmax=6.

long sets lmax = floor(12*(T/100)^(2/9)) - the KPSS (1992) "long"
rule, also used by COINT::kpss with lags="long". Recommended when
the residuals are strongly autocorrelated (e.g. an ARMA(1,1) error
process). For T=703 this gives lmax=18.

nil sets lmax = 0. No autocorrelation correction is performed:
the second sum vanishes, so lrv collapses to the plain residual
variance. If the residuals are serially correlated, the true LRV
exceeds e'e/T, the denominator is under-estimated, and the eta
statistic is inflated - the test then over-rejects the null
of stationarity. Use nil only as a diagnostic; for inference
prefer short, long, or one of the automatic-bandwidth
rules under use().

positive integer fixes lmax to that exact value, identical to
COINT::kpss with lags=<integer>.

use(spec) overrides lags() and selects the lag length and
kernel automatically. Three forms:

empty (default): use() is inactive, so lags() drives
the lag length and the kernel is Bartlett.

method kernel (two tokens): the lag length is set to
floor(getBandwidth(y)) using one of two automatic bandwidth selection
rules - and for Andrews (1991), nw for Newey and West
(1994) - combined with one of three kernels - ba Bartlett,
pa Parzen, qs Quadratic Spectral. Identical to COINT::kpss
with use=c(method,kernel).

single integer: fixes lmax to that value and uses the Bartlett
kernel. Identical to COINT::kpss with use=integer.

trim(#) sets the trimming proportion used in the breaks(1)
break search. The candidate break dates run from round(trim*T) to
round((1-trim)*T). The default is 0.10.

trace prints periodic progress messages for breaks(2),
which is cubic in T and can take minutes or hours on large samples.

Bandwidth and lag selection - formal definition

The long-run variance is

lrv = e'e/T + (2/T) sum_^ w_i e[1..T-i]' e[i+1..T]

Three kernels are supported: Bartlett (ba), Quadratic
Spectral (qs), and Parzen (pa) - in the centred form
used by Ho's COINT package.

The lag lmax is determined as follows:

- If use() is empty: lags() drives the choice.
short = floor(4*(T/100)^(2/9)), long = floor(12*(T/100)^(2/9)),
nil = 0, integer = verbatim. Kernel is Bartlett.

- If use(method kernel): lmax = floor(getBandwidth(y)), with
Andrews (1991) bandwidth when method=and
and Newey and West (1994) when method=nw.
Bandwidth is computed on the original series y.

- If use(#): lag is set to # and the Bartlett kernel is used.

Examples

All examples below have been verified against the equivalent R call
(kpss, kpss_1br, kpss_2br) from Tsung-wu Ho's COINT
package to at least 14 decimal places. Each block is self-contained:
copy and paste to reproduce.

Deterministic model specifications at a glance

Before working through the examples, the table below summarises which
regressors enter the residual equation under each combination of
breaks() and model(), together with the exact Stata
command. Let DU(t) be a level-shift dummy (1 if t > TB, 0 otherwise)
and DT(t) = (t - TB)/T if t > TB, 0 otherwise, a slope-shift dummy.

No break (breaks(0)):

intercept only: y = const + e

kpssbr y

intercept + trend: y = const + b*t + e

kpssbr y, trend

One break (breaks(1), Kurozumi 2002):

model(intercept): y = const + a*DU(t) + e

kpssbr y, breaks(1) model(intercept)

model(both): y = const + b*t + a*DU(t) + c*DT(t) + e

kpssbr y, breaks(1) model(both)

Two breaks (breaks(2), Carrion-i-Silvestre and Sanso 2007):

model(1) AAn: y = const + a1*DU1(t) + a2*DU2(t) + e

kpssbr y, breaks(2) model(1)

model(2) AA: y = const + b*t + a1*DU1(t) + a2*DU2(t) + e

kpssbr y, breaks(2) model(2)

model(3) BB: y = const + b*t + c1*DT1(t) + c2*DT2(t) + e

kpssbr y, breaks(2) model(3)

model(4) CC: y = const + b*t + a1*DU1(t) + a2*DU2(t) + c1*DT1(t) + c2*DT2(t) + e

kpssbr y, breaks(2) model(4)

The KPSS statistic is computed from the partial sums of the
residuals e. The break date TB (breaks(1)) or the pair
(TB1, TB2) (breaks(2)) is chosen to minimise the resulting
statistic over a grid of admissible dates.

Example 1: Classic KPSS, intercept only, lags=short

Stata

use https://www.eruygurakademi.com/datasets/kpsstest/macro.dta, clear

kpssbr INF

-> teststat = 3.550467574793232, lag = 6

R

install.packages("COINT")

library(COINT)

load(url("https://www.eruygurakademi.com/datasets/kpsstest/macro.rda"))

INF <- as.numeric(macro[,"INF"])

KPSS <- kpss(INF, x = NULL, lags = "short", use = NULL)

KPSS$teststat

KPSS$lag

KPSS$cval

Example 2: Classic KPSS, intercept only, lags=long

Stata

use https://www.eruygurakademi.com/datasets/kpsstest/macro.dta, clear

kpssbr INF, lags(long)

-> teststat = 1.455862597583669, lag = 18

R

library(COINT)

load(url("https://www.eruygurakademi.com/datasets/kpsstest/macro.rda"))

INF <- as.numeric(macro[,"INF"])

KPSS <- kpss(INF, x = NULL, lags = "long", use = NULL)

KPSS$teststat

KPSS$lag

KPSS$cval

Example 3: Classic KPSS, intercept only, no lag correction

Stata

use https://www.eruygurakademi.com/datasets/kpsstest/macro.dta, clear

kpssbr INF, lags(nil)

-> teststat = 23.917089315971140, lag = 0

R

library(COINT)

load(url("https://www.eruygurakademi.com/datasets/kpsstest/macro.rda"))

INF <- as.numeric(macro[,"INF"])

KPSS <- kpss(INF, x = NULL, lags = "nil", use = NULL)

KPSS$teststat

KPSS$lag

KPSS$cval

Example 4: Classic KPSS, intercept only, Newey-West / Bartlett

Stata

use https://www.eruygurakademi.com/datasets/kpsstest/macro.dta, clear

kpssbr INF, use(nw ba)

-> teststat = 1.250961577820944, lag = 22

R

library(COINT)

load(url("https://www.eruygurakademi.com/datasets/kpsstest/macro.rda"))

INF <- as.numeric(macro[,"INF"])

KPSS <- kpss(INF, x = NULL, use = c("nw","ba"))

KPSS$teststat

KPSS$lag

KPSS$cval

Example 5: Classic KPSS, intercept only, Newey-West / Parzen

Stata

use https://www.eruygurakademi.com/datasets/kpsstest/macro.dta, clear

kpssbr INF, use(nw pa)

-> teststat = 3.095123619789721, lag = 24

R

library(COINT)

load(url("https://www.eruygurakademi.com/datasets/kpsstest/macro.rda"))

INF <- as.numeric(macro[,"INF"])

KPSS <- kpss(INF, x = NULL, use = c("nw","pa"))

KPSS$teststat

KPSS$lag

KPSS$cval

Example 6: Classic KPSS, intercept only, Newey-West / QS

Stata

use https://www.eruygurakademi.com/datasets/kpsstest/macro.dta, clear

kpssbr INF, use(nw qs)

-> teststat = 1.973728414365710, lag = 10

R

library(COINT)

load(url("https://www.eruygurakademi.com/datasets/kpsstest/macro.rda"))

INF <- as.numeric(macro[,"INF"])

KPSS <- kpss(INF, x = NULL, use = c("nw","qs"))

KPSS$teststat

KPSS$lag

KPSS$cval

Example 7: Classic KPSS, intercept only, Andrews / Bartlett

Stata

use https://www.eruygurakademi.com/datasets/kpsstest/macro.dta, clear

kpssbr INF, use(and ba)

-> teststat = 0.333132491221583, lag = 457

R

library(COINT)

load(url("https://www.eruygurakademi.com/datasets/kpsstest/macro.rda"))

INF <- as.numeric(macro[,"INF"])

KPSS <- kpss(INF, x = NULL, use = c("and","ba"))

KPSS$teststat

KPSS$lag

KPSS$cval

Example 8: Classic KPSS, intercept only, Andrews / Parzen

Stata

use https://www.eruygurakademi.com/datasets/kpsstest/macro.dta, clear

kpssbr INF, use(and pa)

-> teststat = 0.500215577865494, lag = 702

R

library(COINT)

load(url("https://www.eruygurakademi.com/datasets/kpsstest/macro.rda"))

INF <- as.numeric(macro[,"INF"])

KPSS <- kpss(INF, x = NULL, use = c("and","pa"))

KPSS$teststat

KPSS$lag

KPSS$cval

Example 9: Classic KPSS, intercept only, Andrews / QS

Stata

use https://www.eruygurakademi.com/datasets/kpsstest/macro.dta, clear

kpssbr INF, use(and qs)

-> teststat = 0.544419758900968, lag = 622

R

library(COINT)

load(url("https://www.eruygurakademi.com/datasets/kpsstest/macro.rda"))

INF <- as.numeric(macro[,"INF"])

KPSS <- kpss(INF, x = NULL, use = c("and","qs"))

KPSS$teststat

KPSS$lag

KPSS$cval

Example 10: Classic KPSS, intercept only, fixed lag = 15

Stata

use https://www.eruygurakademi.com/datasets/kpsstest/macro.dta, clear

kpssbr INF, use(15)

-> teststat = 1.679413432461915, lag = 15

R

library(COINT)

load(url("https://www.eruygurakademi.com/datasets/kpsstest/macro.rda"))

INF <- as.numeric(macro[,"INF"])

KPSS <- kpss(INF, x = NULL, use = 15)

KPSS$teststat

KPSS$lag

KPSS$cval

Example 11: Classic KPSS with linear trend, lags=short

Stata

use https://www.eruygurakademi.com/datasets/kpsstest/macro.dta, clear

kpssbr INF, trend

-> teststat = 0.475262923729511, lag = 6

R

library(COINT)

load(url("https://www.eruygurakademi.com/datasets/kpsstest/macro.rda"))

INF <- as.numeric(macro[,"INF"])

T <- length(INF); D <- cbind(const = rep(1,T), trend = seq(T)/T)

KPSS <- kpss(INF, x = D, lags = "short", use = NULL)

KPSS$teststat

KPSS$lag

KPSS$cval

Example 12: Classic KPSS, trend, lags=long, Newey-West / Bartlett (kpss.Rd example)

This is the first call in the R help file kpss.Rd.

Stata

use https://www.eruygurakademi.com/datasets/kpsstest/macro.dta, clear

kpssbr INF, trend lags(long) use(nw ba)

-> teststat = 0.179928029530022, lag = 22

R

library(COINT)

load(url("https://www.eruygurakademi.com/datasets/kpsstest/macro.rda"))

INF <- as.numeric(macro[,"INF"])

T <- length(INF); D <- cbind(const = rep(1,T), trend = seq(T)/T)

KPSS <- kpss(INF, x = D, lags = "long", use = c("nw","ba"))

KPSS$teststat

KPSS$lag

KPSS$cval

Example 13: Classic KPSS, trend, lags=long, fixed lag = 15 (kpss.Rd example)

This is the second call in the R help file kpss.Rd.

Stata

use https://www.eruygurakademi.com/datasets/kpsstest/macro.dta, clear

kpssbr INF, trend lags(long) use(15)

-> teststat = 0.233211133758688, lag = 15

R

library(COINT)

load(url("https://www.eruygurakademi.com/datasets/kpsstest/macro.rda"))

INF <- as.numeric(macro[,"INF"])

T <- length(INF); D <- cbind(const = rep(1,T), trend = seq(T)/T)

KPSS <- kpss(INF, x = D, lags = "long", use = 15)

KPSS$teststat

KPSS$lag

KPSS$cval

Example 14: Classic KPSS, trend, lags=long, use=NULL (kpss.Rd example)

This is the third call in the R help file kpss.Rd.

Stata

use https://www.eruygurakademi.com/datasets/kpsstest/macro.dta, clear

kpssbr INF, trend lags(long)

-> teststat = 0.205124023449666, lag = 18

R

library(COINT)

load(url("https://www.eruygurakademi.com/datasets/kpsstest/macro.rda"))

INF <- as.numeric(macro[,"INF"])

T <- length(INF); D <- cbind(const = rep(1,T), trend = seq(T)/T)

KPSS <- kpss(INF, x = D, lags = "long", use = NULL)

KPSS$teststat

KPSS$lag

KPSS$cval

Example 15: KPSS one break, intercept model, first 200 obs

Stata

use https://www.eruygurakademi.com/datasets/kpsstest/macro.dta, clear

kpssbr INF in 1/200, breaks(1) model(intercept)

-> teststat = 0.152040836378325, bpoint = 73, lag = 4

R

library(COINT)

load(url("https://www.eruygurakademi.com/datasets/kpsstest/macro.rda"))

INF <- as.numeric(macro[1:200,"INF"])

KPSS1 <- kpss_1br(INF, lags = "short", model = "intercept", use = NULL)

KPSS1$teststat

KPSS1$lag

KPSS1$bpoint

KPSS1$cval

Example 16: KPSS one break, both model, first 200 obs

Stata

use https://www.eruygurakademi.com/datasets/kpsstest/macro.dta, clear

kpssbr INF in 1/200, breaks(1) model(both)

-> teststat = 0.100890074277901, bpoint = 157, lag = 4

R

library(COINT)

load(url("https://www.eruygurakademi.com/datasets/kpsstest/macro.rda"))

INF <- as.numeric(macro[1:200,"INF"])

KPSS1 <- kpss_1br(INF, lags = "short", model = "both", use = NULL)

KPSS1$teststat

KPSS1$lag

KPSS1$bpoint

KPSS1$cval

Example 17: KPSS one break, intercept, Newey-West / Bartlett, first 200 obs

Stata

use https://www.eruygurakademi.com/datasets/kpsstest/macro.dta, clear

kpssbr INF in 1/200, breaks(1) model(intercept) use(nw ba)

-> teststat = 0.073088938651760, bpoint = 73, lag = 11

R

library(COINT)

load(url("https://www.eruygurakademi.com/datasets/kpsstest/macro.rda"))

INF <- as.numeric(macro[1:200,"INF"])

KPSS1 <- kpss_1br(INF, model = "intercept", use = c("nw","ba"))

KPSS1$teststat

KPSS1$lag

KPSS1$bpoint

KPSS1$cval

Example 18: KPSS one break, both model, full sample (kpss_1br.Rd example)

This is the example block in the R help file kpss_1br.Rd.

Stata

use https://www.eruygurakademi.com/datasets/kpsstest/macro.dta, clear

kpssbr INF, breaks(1) model(both) use(nw ba)

-> teststat = 0.064682218165045, bpoint = 215, lag = 22

R

library(COINT)

load(url("https://www.eruygurakademi.com/datasets/kpsstest/macro.rda"))

INF <- as.numeric(macro[,"INF"])

KPSS1 <- kpss_1br(INF, model = "both", use = c("nw","ba"))

KPSS1$teststat

KPSS1$lag

KPSS1$bpoint

KPSS1$cval

Example 19: KPSS two breaks, model 1 (AAn), first 80 obs

Stata

use https://www.eruygurakademi.com/datasets/kpsstest/macro.dta, clear

kpssbr INF in 1/80, breaks(2) model(1)

-> teststat = 0.119321187017947, bp1 = 21, bp2 = 46

R

library(COINT)

load(url("https://www.eruygurakademi.com/datasets/kpsstest/macro.rda"))

INF <- as.numeric(macro[1:80,"INF"])

KPSS2 <- kpss_2br(INF, lags = "short", model = 1, use = NULL)

KPSS2$teststat

KPSS2$lag

KPSS2$bpoint

KPSS2$cval

Example 20: KPSS two breaks, model 2 (AA), first 80 obs

Stata

use https://www.eruygurakademi.com/datasets/kpsstest/macro.dta, clear

kpssbr INF in 1/80, breaks(2) model(2)

-> teststat = 0.072330771228686, bp1 = 44, bp2 = 56

R

library(COINT)

load(url("https://www.eruygurakademi.com/datasets/kpsstest/macro.rda"))

INF <- as.numeric(macro[1:80,"INF"])

KPSS2 <- kpss_2br(INF, lags = "short", model = 2, use = NULL)

KPSS2$teststat

KPSS2$lag

KPSS2$bpoint

KPSS2$cval

Example 21: KPSS two breaks, model 3 (BB), first 80 obs

Stata

use https://www.eruygurakademi.com/datasets/kpsstest/macro.dta, clear

kpssbr INF in 1/80, breaks(2) model(3)

-> teststat = 0.030896518149923, bp1 = 39, bp2 = 68

R

library(COINT)

load(url("https://www.eruygurakademi.com/datasets/kpsstest/macro.rda"))

INF <- as.numeric(macro[1:80,"INF"])

KPSS2 <- kpss_2br(INF, lags = "short", model = 3, use = NULL)

KPSS2$teststat

KPSS2$lag

KPSS2$bpoint

KPSS2$cval

Example 22: KPSS two breaks, model 4 (CC), first 80 obs

Stata

use https://www.eruygurakademi.com/datasets/kpsstest/macro.dta, clear

kpssbr INF in 1/80, breaks(2) model(4)

-> teststat = 0.029942326110303, bp1 = 38, bp2 = 65

R

library(COINT)

load(url("https://www.eruygurakademi.com/datasets/kpsstest/macro.rda"))

INF <- as.numeric(macro[1:80,"INF"])

KPSS2 <- kpss_2br(INF, lags = "short", model = 4, use = NULL)

KPSS2$teststat

KPSS2$lag

KPSS2$bpoint

KPSS2$cval

Example 23: KPSS two breaks, model 1, T=200, Newey-West / Bartlett (kpss_2br.Rd example)

This is the example block in the R help file kpss_2br.Rd.

Stata

use https://www.eruygurakademi.com/datasets/kpsstest/macro.dta, clear

kpssbr INF in 1/200, breaks(2) model(1) use(nw ba) trace

-> teststat = 0.067800029275150, bp1 = 81, bp2 = 196

R

library(COINT)

load(url("https://www.eruygurakademi.com/datasets/kpsstest/macro.rda"))

INF <- as.numeric(macro[1:200,"INF"])

KPSS2 <- kpss_2br(INF, model = 1, use = c("nw","ba"))

KPSS2$teststat

KPSS2$lag

KPSS2$bpoint

KPSS2$cval

Comparison with the kpss command from SSC

The kpss command from SSC (Baum 2006) defaults to a trend
stationary null with an intercept and a linear trend, and prints a
table of test statistics for lag orders 0 through Maxlag (Schwert
criterion). Our kpssbr defaults to an intercept-only null,
matching the R COINT::kpss reference. To get the same number from
both commands, run kpssbr with the trend option and the
matching lag.

Example 24: kpssbr matches the SSC kpss

use https://www.eruygurakademi.com/datasets/kpsstest/macro.dta, clear

kpss INF

kpssbr INF, trend

kpssbr INF, trend use(15)

kpss INF prints a table; rows lag 6 -> .475, lag 15 -> .233.
kpssbr INF, trend returns 0.475262923729511 (lag 6, the short
rule for T=703), and kpssbr INF, trend use(15) returns
0.233211133758688 (lag 15). The displayed digits agree exactly.

Compared with the SSC kpss, kpssbr additionally offers
(i) Andrews (1991) automatic bandwidth selection, (ii) the Parzen
kernel, and (iii) extensions to one and two unknown structural breaks
via breaks(). For example, the following call uses Andrews
bandwidth with the QS kernel - a combination not available in SSC
kpss:

kpssbr INF, trend use(and qs)

-> teststat = 1.767614551567974, lag = 622

Example 25: Testing the order of integration via differencing

The level series INF rejects the stationarity null
(kpssbr INF returns eta = 3.55 versus the 1% critical value of
0.739), suggesting that INF is at least I(1). To verify, run the test
on the first and second differences. Stata's time-series operators
D. and D2. produce the same series as R's diff(.)
with differences=1 and differences=2.

Stata

use https://www.eruygurakademi.com/datasets/kpsstest/macro.dta, clear

kpssbr d.INF

-> teststat = 0.038699, lag = 6, N = 702

kpssbr d2.INF

-> teststat = 0.006713, lag = 6, N = 701

R

library(COINT)

load(url("https://www.eruygurakademi.com/datasets/kpsstest/macro.rda"))

INF <- as.numeric(macro[,"INF"])

dINF <- diff(INF, lag = 1, differences = 1)

d2INF <- diff(INF, lag = 1, differences = 2)

KPSSd <- kpss(dINF, x = NULL, lags = "short", use = NULL)

KPSSd2 <- kpss(d2INF, x = NULL, lags = "short", use = NULL)

KPSSd$teststat; KPSSd$lag

KPSSd2$teststat; KPSSd2$lag

The first difference of INF gives eta = 0.0387, far below the 10%
critical value of 0.347, so the null of stationarity is not rejected:
D.INF is I(0), and therefore INF itself is I(1). The second
difference gives an even smaller eta = 0.0067, confirming the result.

Stored results

kpssbr stores the following in r():

Scalars

r(teststat) KPSS test statistic eta

r(lag) lag used in the kernel sum

r(N) sample size

r(breaks) number of breaks (0, 1, 2)

r(cv10) 10% critical value

r(cv5) 5% critical value

r(cv1) 1% critical value

r(cv25) 2.5% critical value (only for breaks(0))

r(bpoint) selected break point (breaks(1))

r(bpoint1) first selected break point (breaks(2))

r(bpoint2) second selected break point (breaks(2))

Macros

r(cmd) kpssbr

r(model) deterministic model used in break tests

Implementation notes

kpssbr is a verbatim port of the R functions kpss,
kpss_1br, and kpss_2br from Tsung-wu Ho's COINT package (CRAN,
2025), together with the getBandwidth machinery from cointReg 0.2.0
(Aschoff 2018). All test statistics, bandwidths, lag selections, break
points and critical values match the R reference to 14 decimal places
(only the final IEEE 754 rounding bit may differ).

The OLS step in every candidate regression uses Mata's qrsolve,
which is robust to the rank-deficient design matrices that occasionally
arise for some break-point combinations in breaks(2), model(3) and
model(4). This mirrors the behaviour of R's lm.fit.

References

Andrews, D. W. K. (1991). Heteroskedasticity and autocorrelation
consistent covariance matrix estimation. Econometrica, 59(3),
817-858.

Aschoff, S. (2018). cointReg: parameter estimation and inference in a
cointegrating regression. R package version 0.2.0.

Carrion-i-Silvestre, J. L. and Sanso, A. (2007). The KPSS test with two
structural breaks. Spanish Economic Review, 9(2), 105-127.

Ho, T.-w. (2025). COINT: cointegration analysis of time series. R
package.

Kurozumi, E. (2002). Testing for stationarity with a break.
Journal of Econometrics, 108(1), 105-127.

Kwiatkowski, D., Phillips, P. C. B., Schmidt, P. and Shin, Y. (1992).
Testing the null hypothesis of stationarity against the alternative of a
unit root. Journal of Econometrics, 54(1-3), 159-178.

Newey, W. K. and West, K. D. (1994). Automatic lag selection in
covariance matrix estimation. Review of Economic Studies, 61(4),
631-653.

Phillips, P. C. B. and Jin, S. (2002). The KPSS test with seasonal
dummies. Economics Letters, 77(2), 239-243.

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

kpssbr v1.0.2 -- June 2026

Please cite as:

Eruygur, H. O. 2026. kpssbr: KPSS unit root tests with up to 2
structural breaks. Stata package version 1.0.2. Available from:
https://www.eruygurakademi.com