*! version 1.0 11mar2026

Title

fourierdfdf -- Double Frequency Fourier Dickey-Fuller unit root test

Syntax

fourierdfdf
varname
[if] [in]
[, options]

model(#) deterministic specification: 1=constant, 2=constant+trend; default is model(2)

kmax(#) maximum frequency; default is kmax(3)

dk(#) search precision (Delta k); default is dk(1)

pmax(#) maximum lag order; default is pmax(8)

ic(#) information criterion: 1=AIC, 2=SIC, 3=t-stat; default is ic(3)

notrend equivalent to model(1)

graph display comparison plot of single vs. double frequency fit

bootstrap compute Sieve Bootstrap critical values (Gerolimetto & Magrini, 2026)

breps(#) number of bootstrap replications; default is breps(500)

Description

fourierdfdf implements the Double Frequency Fourier Dickey-Fuller (DFDF)
unit root test proposed by Cai and Omay (2021),
with an optional Sieve Bootstrap extension following
Gerolimetto and Magrini (2026).

Key innovation: Unlike standard Fourier tests that use a single
frequency k for both sine and cosine components, the DFDF test allows
different frequencies: k_s for the sine component and k_c for the cosine
component. This enables the test to capture asymmetrically located
structural breaks, where the timing and magnitude of upward and downward shifts
differ.

This test is more powerful than single-frequency methods when structural breaks
are (i) located at the beginning or end of the sample, (ii) asymmetrically
distributed, or (iii) involve complex smooth transitions (LSTAR, ESTAR).

The data must be tsset before using this command.

Options

model(#) deterministic specification: model(1) = constant only;
model(2) = constant + trend. Default is model(2).

kmax(#) maximum frequency for the grid search. Cai and Omay (2021) use
kmax(3) in their simulations. Default is kmax(3).

dk(#) search precision (Delta k). Controls the step size of the grid
search over frequency pairs.

dk(1) searches integer frequencies only (k_s, k_c = 1, 2, ..., kmax).

dk(0.1) searches fractional frequencies (k_s, k_c = 0.1, 0.2, ..., kmax).

Smaller values yield more precise frequency selection but increase computation time.
Default is dk(1). Cai and Omay (2021) recommend dk(0.1) for
maximum power.

pmax(#) maximum lag order for augmented lags. Default is pmax(8).

ic(#) lag selection criterion. Default is ic(3).

notrend equivalent to model(1).

graph displays a three-line comparison plot:

Black (thick) = observed series

Red = double frequency Fourier fit (k_s, k_c)

Blue (thin) = single frequency Fourier fit (best integer k)

This matches the visualization style in Cai and Omay (2021, Figs 1-4).

bootstrap activates the Sieve Bootstrap for computing empirical critical
values, following Gerolimetto and Magrini (2026). This avoids reliance on
tabulated asymptotic critical values and can improve finite-sample performance.
Warning: Computation time increases substantially with this option.

breps(#) number of bootstrap replications. Default is breps(500).
Gerolimetto and Magrini (2026) use 500 replications in their Monte Carlo
experiments.

Methodology

Double frequency deterministic trend (Eq. 2 of Cai and Omay 2021):

d_t^Dfr = c_0 [+ c_1*t] + alpha*sin(2*pi*k_s*t/T) + beta*cos(2*pi*k_c*t/T)

Note that k_s (sine frequency) and k_c (cosine frequency) can differ.
When k_s = k_c, this reduces to the standard single-frequency specification
of Enders and Lee (2012b).

Augmented DFDF regression (Eq. 10):

Delta(y_t) = c_0 [+ c_1*t] + alpha*sin(2*pi*k_s*t/T) + beta*cos(2*pi*k_c*t/T)
+ rho*y_ + sum_^

phi_j*Delta(y_) + epsilon_t

The test statistic tau_Dfr is the t-ratio on rho (H0: rho = 0, i.e., unit root).

Grid search procedure (Section 2.3): The optimal frequency pair (k_s*, k_c*)
is determined by minimizing the SSR over all (k_s, k_c) pairs from dk to kmax
with step size dk.

F-test for nonlinearity (Eq. 6): Tests H0: alpha = beta = 0. If the F-test
fails to reject, the Fourier terms are not significant and a standard ADF test
should be used instead.

Sieve Bootstrap (Gerolimetto & Magrini, 2026)

The bootstrap option implements the Pre-filtered Sieve Bootstrap Double
Frequency Dickey-Fuller (SB-DFDF) test. The algorithm:

1. First-difference the series: x_t = Delta(y_t)

2. Fit AR(p) to x_t (p selected by AIC)

3. Resample residuals with replacement to get epsilon_t*

4. Generate bootstrap stationary series x_t* using AR coefficients and epsilon_t*

5. Reconstruct bootstrap series y_t* by cumulative sum of x_t*

6. Compute tau_Dfr on y_t*

7. Repeat B times to obtain the empirical distribution

8. Bootstrap critical values = quantiles of the empirical distribution

Advantages:

- Does not rely on asymptotic tables (which are only available for T = 50, 150, 300)

- Gerolimetto and Magrini (2026) show systematically better finite-sample power

- Especially useful when T does not match tabulated sample sizes

Interpretation

Null hypothesis: The series has a unit root.

Alternative: The series is stationary around a double-frequency Fourier
deterministic trend.

Decision rule: Reject H0 if tau_Dfr is more negative than the critical value.

Interpreting the frequency pair:

- k_s = k_c: The double-frequency method reduces to single-frequency. The series
has symmetric structural breaks.

- k_s != k_c: The series has asymmetric structural breaks. The sine and cosine
components capture different aspects of the deterministic trend.

- Small frequencies (< 1): Indicate very slow smooth changes.

- Larger frequencies: Indicate more rapid or multiple changes.

When to use dk(0.1) vs dk(1):

- Use dk(1) (integer frequencies) as a baseline. This is computationally
faster and uses the exact critical values from Table 1 of Cai and Omay (2021).

- Use dk(0.1) (fractional frequencies) for maximum power, especially if
the series may contain complex or asymmetric breaks. Cai and Omay (2021, Table 8)
show that power with dk=0.1 can be 70% higher than with integer frequencies.

Cautions and Warnings:

1. Always check the F-test first. If H0: alpha = beta = 0 cannot be rejected,
the Fourier terms are not needed and a standard ADF test is more powerful.

2. Critical values are only tabulated for T = 50, 150, and 300. For other
sample sizes, the nearest tabulated value is used. Consider using the bootstrap
option for more precise critical values.

3. With fractional frequencies (dk(0.1)) and kmax(3), the grid
search evaluates 30x30 = 900 frequency pairs. This is computationally intensive
for large datasets.

4. When combined with bootstrap, computation time is B * 900
regressions. Consider reducing breps or increasing dk.

5. The test is most powerful for smooth breaks (LSTAR, ESTAR) and
asymmetric breaks. For sharp instantaneous breaks, dummy-based tests may be
more appropriate.

Stored results

Scalars

r(tau_dfr) tau_Dfr test statistic

r(ks) optimal sine frequency

r(kc) optimal cosine frequency

r(p) optimal lag order

r(F_dfr) F-statistic for Fourier terms

r(cv1) 1% asymptotic critical value

r(cv5) 5% asymptotic critical value

r(cv10) 10% asymptotic critical value

r(Fcv90) F-test 90% critical value

r(Fcv95) F-test 95% critical value

r(Fcv99) F-test 99% critical value

r(bcv1) 1% bootstrap critical value (if bootstrap)

r(bcv5) 5% bootstrap critical value (if bootstrap)

r(bcv10) 10% bootstrap critical value (if bootstrap)

Examples

Setup

. sysuse gnp96, clear

. tsset date

DFDF test with integer frequencies (default)

. fourierdfdf gnp96

DFDF test with fractional frequencies (Dk=0.1)

. fourierdfdf gnp96, dk(0.1)

DFDF test with graph (3-line comparison plot)

. fourierdfdf gnp96, dk(0.1) graph

DFDF test with Sieve Bootstrap critical values

. fourierdfdf gnp96, dk(0.1) bootstrap breps(500)

DFDF test with constant-only model

. fourierdfdf gnp96, notrend

View stored results

. return list

References

Cai, Y. and Omay, T. (2021). Using double frequency in Fourier Dickey-Fuller
unit root test. Computational Economics, 59, 445-470.

Gerolimetto, M. and Magrini, S. (2026). Bootstrap double frequency Dickey
Fuller test for unit roots. Rivista Italiana di Economia Demografia e
Statistica, LXXX(3), 332-342.

Enders, W. and Lee, J. (2012b). The flexible Fourier form and Dickey-Fuller
type unit root tests. Economics Letters, 117(1), 196-199.

Omay, T. (2015). Fractional frequency flexible Fourier form to approximate
smooth breaks in unit root testing. Economics Letters, 134, 123-126.

Authors

Dr. Merwan Roudane

Email: merwanroudane920@gmail.com

Also see

Help: fourierlm, fourierdf, fouriergls,
fourierkpss, fourierfffff, fourierall