*! version 1.0.0 15may2026

Title

harwald -- Wald test with fixed-b critical values after harreg

Syntax

Test coefficients equal zero:

harwald [coeflist]
[, options]

Test linear hypotheses:

harwald (exp) [(exp) ...]
[, options]

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

critdraws(#) Monte Carlo draws; default is 5000

seed(#) random-number seed for simulations

harwald can be used only after harreg.

exp is a linear expression of coefficients such as x1 + x2,
2*x1 - x2, or x1 + x2 - 1 (to test whether the sum equals 1).
Each term is a coefficient name, optionally preceded by a numeric constant
and *; terms are combined with + or -.
An expression may also use = to separate the left- and right-hand
sides of a restriction, e.g. 2*x1 - x2 = 1 (equivalent to
2*x1 - x2 - 1); each parenthesized expression may contain at most
one =.

Description

harwald performs a Wald test using the fixed-b reference distribution
that matches the estimator from the preceding harreg command.

When coeflist is specified (without parentheses), harwald tests the
joint hypothesis that all listed coefficients equal zero.
Equality syntax such as harwald x1 = x2 is not accepted in this mode;
each restriction must be wrapped in parentheses (see below).
If coeflist is not specified, all estimated slope coefficients
in the model are tested (the constant and any factor-variable base or
omitted columns are excluded).

When parenthesized expressions are specified, harwald tests linear
hypotheses of the form exp = 0. Multiple expressions can be tested
jointly by specifying multiple parenthesized expressions. This is similar
to the functionality of test after regress.

For ewc and ewp estimators, the test uses an
F(q, nu-q+1) distribution,
where q is the number of tested coefficients and
nu is the degrees of freedom from e(df_fb).

For nw and qs estimators, harwald simulates the
fixed-b null distribution to obtain the p-value and critical value.

Options

level(#) specifies the confidence level, as a percentage, for the
critical value. The default is level(95) or as set by set level.

critdraws(#) specifies the number of Monte Carlo draws used
to simulate the fixed-b critical value when the estimator is
nw or qs. The default is 5000; the minimum is 1000.

seed(#) specifies the random-number seed for simulations.
The default ensures reproducible critical values across runs.
Specify seed(0) to use a different random seed each time.

Examples

Setup

. webuse lutkepohl2

. tsset

. harreg dln_inv dln_inc dln_consump

Joint test of all slope coefficients

. harwald

Test specific coefficients

. harwald dln_inc dln_consump

Test at 90% confidence level

. harwald dln_inc, level(90)

Test a linear combination (sum of coefficients equals zero)

. harwald (dln_inc + dln_consump)

Test equality of coefficients (difference equals zero)

. harwald (dln_inc - dln_consump)

Test with explicit coefficient weights

. harwald (2*dln_inc - dln_consump)

Test whether sum of coefficients equals 1

. harwald (dln_inc + dln_consump - 1)

Test using = syntax (equivalent restriction)

. harwald (dln_inc + dln_consump = 1)

Joint test of multiple linear hypotheses

. harwald (dln_inc + dln_consump) (dln_inc - dln_consump)

Test after NW estimation with more Monte Carlo draws

. harreg dln_inv dln_inc dln_consump, estimator(nw) lags(8)

. harwald dln_inc, critdraws(10000)

Stored results

harwald stores the following in r():

Scalars

r(F) Wald F statistic

r(q) number of constraints (coefficients or linear hypotheses) tested

r(df) alias of r(q) (for test-style script compatibility)

r(df_r) denominator df shown in the printed header

r(p) p-value

r(cv) critical value at specified level

Authors

Eben Lazarus, UC Berkeley

lazarus@berkeley.edu

Daniel J. Lewis, University College London

daniel.j.lewis@ucl.ac.uk