*! version 1.0.0 Subir Hait 2026

Title

rdstagger_sim -- Simulate staggered RD panel data with network interference

Syntax

rdstagger_sim,
n(#)
periods(#)
cohorts(#)
[cutoff(#)
bw(#)
density(#)
direct(#)
spill(#)
outcome(string)
seed(#)]

Required
n(#) number of units; minimum 10

periods(#) number of time periods; minimum 3

cohorts(#) number of treatment cohorts; minimum 1

Optional
cutoff(#) RD cutoff on the running variable; default 0

bw(#) bandwidth for cohort assignment; default 1

density(#) network edge probability in (0,1); default 0.1

direct(#) true direct ATT; default 0.3

spill(#) true spillover effect; default 0.1

outcome(string) continuous (default), binary, or count

seed(#) random seed for reproducibility; default 42

Description

rdstagger_sim generates synthetic panel data suitable for demonstrating
and testing rdstagger. The data-generating process includes:

Running variable: drawn as x ~ N(0, 1.5). Units with x < cutoff are
treatment-eligible.

Cohort assignment: eligible units are assigned to treatment cohorts
based on their position in the running variable distribution below the
cutoff. The total number of cohorts is controlled by cohorts().
Units with x >= cutoff are never-treated.

Network interference: each unit has a random number of neighbors
drawn from Poisson(density * n). The spillover exposure variable
spill_share records the fraction of a unit's neighbors that are
currently treated.

Outcome: the latent outcome is
y* = alpha_i + lambda_t + 0.2*x + direct*treated + spill*spill_share + epsilon,
where alpha_i ~ N(0, 0.5) is a unit fixed effect and lambda_t ~ N(0, 0.3)
is a time fixed effect. For outcome(binary), y = 1(invlogit(y*) > U[0,1]).
For outcome(count), y ~ Poisson(exp(y*)).

The resulting dataset is in long format with one row per unit per period
and is left in memory (any prior data are replaced).

Options

n(#) total number of units in the cross-section. Must be >= 10.

periods(#) number of calendar periods (T). Must be >= 3 so that
at least one pre-treatment period exists.

cohorts(#) number of staggered treatment cohorts. Cohorts adopt
treatment at evenly spaced periods. Must be >= 1 and < periods.

cutoff(#) threshold on the running variable below which units
are treatment-eligible. Default 0.

bw(#) controls the range of the running variable assigned to
treatment cohorts below the cutoff. Default 1.

density(#) probability that any pair of units is connected by
a network edge (Erdos-Renyi model approximation). Must be in (0,1).
Default 0.1 (sparse network).

direct(#) the true direct ATT used in the data-generating process.
Default 0.3.

spill(#) the true spillover coefficient on spill_share.
Default 0.1.

outcome(string) outcome type. continuous (default) produces
a normally distributed outcome. binary produces a 0/1 outcome via a
logistic link. count produces a non-negative integer via a Poisson link.

seed(#) sets the random-number seed for reproducibility.
Default 42.

Examples

Basic simulation:

. rdstagger_sim, n(400) periods(8) cohorts(3) direct(0.3) spill(0.1) seed(42)

. describe

. tab g

. sum y x treated spill_share

Binary outcome:

. rdstagger_sim, n(500) periods(6) cohorts(2) outcome(binary) seed(1)

Dense network with larger spillovers:

. rdstagger_sim, n(300) periods(6) cohorts(2) density(0.3) spill(0.2) seed(99)

Variables created

id unit identifier

period calendar time period

y outcome variable

x running variable

g cohort (first treated period; . = never-treated)

treated binary treatment indicator

neighbor_treated indicator: at least one neighbor treated

spill_share share of neighbors currently treated

Also see

rdstagger,