*! version 1 2024-05-04

Title

stute_test -- Stute (1997) linearity test.

Syntax

stute_test Y D [G T] [if] [in]
[,
order(#)
seed(#)
brep(#)
baseline(#)]

where:

Y is the dependent variable.

D is the independent variable.

G is the group variable.

T is the time variable.

Description

This program implements the non-parametric test that
the expectation of Y given D is linear proposed by Stute (1997).
In the companion vignette, we sketch the intuition behind the test, as
to motivate the use of the package and its options.
Please refer to Stute (1997) and
Section 3 of de Chaisemartin and D'Haultfoeuille (2024) for further details.

This package allows for two estimation settings:

1. cross-section: stute_test Y D

The test is run using the full dataset, treating each
observation as an independent realization of
(Y, D).

2. panel: stute_test Y D G T

The test is run for all values of T, using a panel
with G groups/units and T periods.
In this mode, the test statistics will be computed
among observations having the same value of T.
The program will also return a joint test on the sum
of the period-specific estimates.
Due to the fact that inference on the joint statistic
is performed via the bootstrap distribution of the
sum of the test statistics across time periods, this
mode requires a strongly balanced panel with no gaps.
This requirement can be checked by running xtset G T.

Vignettes

Before calling the vignette, please
make sure to run the following lines:

ssc install stute_test, replace

net get stute_test

The first line updates the package to its latest version,
while the second updates the vignette.
If there is no error message, the following line
calls the html file of the stute_test vignette:

The intuition behind stute_test.

Options

order(#)
If this option is specified, the program tests
whether the conditional expectation of Y given D is
a #-degree polynomial in D.
With order(0), the command tests
the hypothesis that the conditional mean of Y
given D is constant.

seed(#)
This option allows to specify the seed
for the wild bootstrap routine.

brep(#)
This option allows to specify the number
of wild bootstrap replications. The default is 500.

baseline(#)
This option allows to select one of the periods
in the data as the baseline or omitted period.
For instance, in a dataset with the support
of T equal to (2001, 2002, 2003),
stute_test Y D G T, baseline(2001) will
test the hypotheses that the expectations of
Y_2002 - Y_2001 and Y_2003
- Y_2001 are linear functions of
D_2002 - D_2001 and D_2003
- D_2001. This option can only be
specified in panel mode.

Examples

clear

set seed 0

set obs 200

gen G = mod(_n-1, 40) + 1

gen T = floor((_n-1)/40) + 1

gen D = uniform()

gen Y = 1 + uniform()*D

stute_test Y D, seed(0)

stute_test Y D G T, seed(0)

stute_test Y D G T, baseline(1) seed(0)

Saved results

r(main): Matrix with results from the output table.

r(joint): Matrix with joint test results.

References

de Chaisemartin, C, D'Haultfoeuille, X (2024).
Two-way Fixed Effects and Difference-in-Difference Estimators in Heterogeneous Adoption Designs.

Stute, W (1997).
Nonparametric model checks for regression.

Authors

Clément de Chaisemartin, Economics Department, Sciences Po, France.

Xavier D'Haultfoeuille, CREST-ENSAE, France.

Diego Ciccia, Economics Department, Sciences Po, France.

Felix Knau, Economics Department, Sciences Po, France.

Doulo Sow, CREST-ENSAE, France.

Contact

If you wish to inquire about the functionalities of this package or to report bugs/suggestions, feel free to post your question in the Issue section of the stute_test GitHub repository.

Acknowledgement

The development of this package was funded by the European Union (ERC, REALLYCREDIBLE,GA N°101043899).