*! version 1.0.1 24aug2026

Title

ardldml examples -- a worked session with ardldml

The data

The package ships the monthly series behind the paper's main application:
exchange-rate pass-through to U.S. prices, nine FRED-MD series over 1973m1 to
2020m12. Retrieve them with net get:

. net get ardldml

. use ardldml_passthrough, clear

. describe

The paper takes the log CPI as the outcome and the log trade-weighted dollar as
the focal regressor, conditioning on seven macroeconomic and financial controls.
Take the logs yourself -- ardldml does no transformation:

. foreach v in cpi neer m2 ip oil {

. replace `v' = ln(`v')

. }

. tsset mdate

The four interest and unemployment rates stay in levels: they are already in
percentage-point units and can approach zero.

A first fit

The late Great Moderation, 1999m1-2007m12, which is the regime where the paper's
diagnostic changes the verdict:

. keep if inrange(mdate, tm(1999m1), tm(2007m12))

. ardldml cpi neer, controls(m2 ffr ip unrate oil gs10 baa)

integrated(m2 ip oil gs10 baa ffr) lags(4) blocks(5) buffer(6)

breps(999) seed(20260625) showfirst

Points worth noticing in the output. The design length is 103, not 108: the
lag structure consumes p+1 observations. Six of the seven controls are being
treated as I(1), which is what makes the trend-absorption mechanism live. And
showfirst reports that the m_Z projection kept just one control level --
the empirical counterpart of a high effective integrated count, meaning very
little trend was absorbed here.

Do not read the statistic against 4.94 or 5.73. The bootstrap critical
value in the table is the only valid reference.

The full workflow

A single fit is never the answer. The three checks below are what turn it into a
result.

1. Is the control set eating the relation?

. estat absorption, drop(m2 oil)

Money and the oil price are dropped because they are the controls most likely to
share a stochastic trend with the pass-through relation itself. Read Delta_W and
the verdict line together with the four standard errors.

2. Does the verdict survive the tuning choices?

. estat penalty

Watch the selZ column and whether theta keeps its sign across the grid.

3. What would the classical test have said?

. estat classical

The bracket is simulated at this sample size, so it is a fair comparison rather
than an asymptotic table applied to 103 observations.

And look at the null you are testing against:

. estat null

. estat blocks, graph

Four regimes at once

The paper's Table 11 runs the test separately across four monetary regimes. The
loop below reproduces its structure and collects the results:

. use ardldml_passthrough, clear

. foreach v in cpi neer m2 ip oil {

. replace `v' = ln(`v')

. }

. tsset mdate

. tempname M

. matrix `M' = J(4, 4, .)

. local i = 0

. foreach r in "1973m1 1985m12" "1986m1 1998m12" ///

"1999m1 2007m12" "2008m1 2020m12" {

. local ++i

. local a : word 1 of `r'

. local b : word 2 of `r'

. preserve

. keep if inrange(mdate, tm(`a'), tm(`b'))

. ardldml cpi neer, controls(m2 ffr ip unrate oil gs10 baa) ///

integrated(m2 ip oil gs10 baa ffr) lags(4) blocks(5) ///

buffer(6) breps(999) seed(`=20260625 + `i'') notable nolegend

. matrix `M'[`i',1] = e(N)

. matrix `M'[`i',2] = e(F)

. matrix `M'[`i',3] = e(crit)

. matrix `M'[`i',4] = e(p)

. restore

. }

. matrix colnames `M' = n F boot_cv95 boot_p

. matrix list `M', format(%9.3f)

Note the seed() is varied across regimes. Reusing one seed would give
every regime the same wild-weight stream, which is not wrong but is needlessly
correlated across the table.

Simulated data: does it have size and power?

The shipped ardldml_example.do includes a Monte Carlo check on the
paper's own design: independent random walks under the null, and a genuinely
cointegrated system under the alternative, with high-dimensional nuisance in
both. Run it to see the rejection rate near or below nominal under the null and
high under the alternative:

. net get ardldml

. do ardldml_example.do

The one trap when writing your own size study: vary the seed on every
replication. Calling ardldml with a fixed seed() resets the
random-number stream to the same state each time, so every replication draws the
same wild weights and the size estimate becomes degenerate. The data varying per
replication is not enough.

Reproducing the reference implementation

ardldml_validate.do checks sixty quantities against an independent Python
implementation of the same paper, on the paper's own application:

. do ardldml_validate.do

It prints reference and Stata values side by side and exits with an error if any
disagree. See ardldml methods for what "agree" means
here and for the one published figure that turns out to be a solver-tolerance
artifact in the reference rather than a difference in method.

To reproduce a bootstrap exactly across languages, export the wild weights
from the other implementation as a B-by-n text matrix and feed them in:

. ardldml cpi neer, controls(...) integrated(...) etafile(eta.txt)

where n is the design length e(N). Seeding alone will not do it: Stata's
random-number generator is not NumPy's.

Author

Dr Merwan Roudane

merwanroudane920@gmail.com

https://github.com/merwanroudane