---
title: Functional Data Approach to DiD
url: https://www.emergentmind.com/topics/functional-data-approach-to-did
type: topic
---

# Functional Data Approach to DiD

The functional data approach to Difference-in-Differences (DiD) reframes the standard discrete-time panel event study within a continuous-time, infinite-dimensional stochastic process framework. Each unit’s outcome trajectory is modeled as a random element in the Banach space of continuous functions, enabling rigorous simultaneous causal inference over time intervals, not just at isolated points. This paradigm, introduced by Fang & Liebl [2512.06804], replaces conventional pointwise inference with uniform functional inference, directly addressing limitations in common event study plots where the parallel trends and no-anticipation assumptions may be violated. The approach yields estimators that converge to Gaussian processes, supports construction of honest simultaneous confidence bands (SCBs), and enables principled equivalence and relevance testing across intervals—transforming event study plots into comprehensive causal inference tools.

## 1. Functional Data Framework

Let each observational unit $i=1,\ldots,n$ generate an outcome trajectory $Y_i(\cdot)$ as a function in $C[-T_{\text{pre}},T_{\text{post}}]$, but only discrete-time samples $Y_{i,t}=Y_i(t)$ for $t\in\{-T_{\text{pre}},\ldots,T_{\text{post}}\}$ are observed. Each unit is assigned a post-treatment indicator $D_i\in\{0,1\}$, so that observed outcomes follow the potential outcome model:
$$
Y_i(t) = D_i\,Y_i(t,1) + (1-D_i)\,Y_i(t,0)
$$
where $Y_i(t,d)$ denotes the potential outcome under treatment status $d$. The canonical event-study DiD parameter process is defined as:
$$
\beta(t) := \mathbb{E}[Y_i(t)-Y_i(0)\mid D_i=1] - \mathbb{E}[Y_i(t)-Y_i(0)\mid D_i=0], \quad t\in [-T_{\text{pre}}, T_{\text{post}}]
$$
with $\beta(0)=0$ by construction.

Under standard DiD assumptions:

- **No anticipation:** $\mathbb{E}[Y_i(0,1)-Y_i(0,0)\mid D_i=1]=0$
- **Parallel trends:** $\mathbb{E}[Y_i(t,0)-Y_i(0,0)\mid D_i=1]=\mathbb{E}[Y_i(t,0)-Y_i(0,0)\mid D_i=0]$ for all $t$
- **Overlap:** $\epsilon < P(D_i=1) < 1-\epsilon$ for some $\epsilon>0$

it follows that $\beta(t) = \mathbb{E}[Y_i(t,1)-Y_i(t,0)\mid D_i=1] \equiv \theta_{\text{ATT}}(t)$, the average treatment effect on the treated at each $t$.

To handle unit and time fixed effects, the model employs “double-demeaning” in $i$ and $t$, resulting in the oracle regression
$$
\ddot Y_i(t) = \gamma(t)\,\dot D_i + \ddot \varepsilon_i(t)
$$
where $\dot D_i = D_i - \bar D$, $\gamma(t) = \beta(t) + \text{const}$, and $\ddot\varepsilon_i(t)$ is a mean-zero error process in $C[-T_{\text{pre}},T_{\text{post}}]$.

The least-squares estimator for $\beta(t)$ is constructed as
$$
\hat\beta_n(t) = \left( \frac{1}{n}\sum_{i=1}^n\dot D_i^2 \right)^{-1} \left( \frac{1}{n}\sum_{i=1}^n \dot D_i\,[\dot Y_i(t)-\dot Y_i(0)] \right)
$$
with $\hat\beta_n(0)=0$, $\dot Y_i(t) = Y_i(t) - n^{-1}\sum_{i=1}^n Y_i(t)$.

Regularity conditions include independence of $(Y_i(\cdot),D_i)$, bounded higher moments $\mathbb{E}[Y(t)^4]<\infty$, $\mathbb{E}[D^4]<\infty$, $\mathbb{E}[\Vert Y'(\cdot)\Vert_\infty^2]<\infty$, $\mathbb{E}[\Vert Y(\cdot)\Vert_\infty^2]<\infty$, and twice-continuous differentiability of $\phi$, $\varepsilon_i$, $\beta$, and $C_\beta$.

## 2. Uniform Central Limit Theorem and Gaussian Process Limit

The estimator $\hat\beta_n$ constitutes a stochastic process indexed by $t$ in $C[-T_{\text{pre}},T_{\text{post}}]$, furnished with the sup-norm $\Vert \cdot \Vert_\infty$. The population covariance kernel is given by:
$$
C_\beta(s,t) = \mathbb{E}\left[\dot D^2\,(\varepsilon(s)-\varepsilon(0))\,(\varepsilon(t)-\varepsilon(0))\right]\,\mathbb{E}[\dot D^2]^{-2}
$$

Under the stated regularity conditions, the following functional CLT holds:
$$
\sqrt{n}\{\hat\beta_n(\cdot) - \beta(\cdot)\} \Rightarrow GP\left(0, C_\beta(\cdot,\cdot)\right) \quad \text{in}\ (C[-T_{\text{pre}},T_{\text{post}}],\Vert\cdot\Vert_\infty)
$$

The formal proof comprises three components:
- Pointwise CLTs at each $t$,
- Equicontinuity bounds via C$^2$-smoothness,
- Application of functional CLT machinery (Pollard 1984; Hahn 1977; Billingsley).

No-anticipation and parallel trends are not required for this functional CLT.

## 3. Honest Simultaneous Confidence Bands

From the Gaussian process limit, simultaneous confidence bands in sup-norm covering are constructed as:
$$
\text{SCB}^{\text{sup}}_{1-\alpha}(t) = \left[\, \hat\beta_n(t) \pm u^{\text{sup}}_{1-\alpha/2}\sqrt{\widehat{C}_\beta(t,t)/n}\,\right]
$$
for $t$ in the post-treatment window $[0,T_{\text{post}}]$. The critical value $u^{\text{sup}}_{1-\alpha/2}$ is calibrated such that
$$
\mathbb{P}\left\{\sup_{t\in[0,T_{\text{post}}]}|T_n(t)| > u^{\text{sup}}_{1-\alpha/2} \right\}\approx\alpha/2
$$
where $T_n(t) = \sqrt{n}\,(\hat\beta_n(t)-\beta(t))/\sqrt{\widehat{C}_\beta(t,t)}$.

Calibration approaches include:

- Parametric (Gaussian) bootstrap: Simulating GP samples $N(\hat\beta_n,\widehat{C}_\beta/n)$ at the grid, spline interpolation, and quantile computation.
- Multiplier bootstrap: Reweighting residuals by i.i.d. weights and recomputing estimators.
- Kac-Rice formula: Closed-form quantile approximation utilizing covariance curvature traces (Liebl–Reimherr 2023).

Uniform coverage is guaranteed asymptotically:
$$
\lim_{n\to\infty}\mathbb{P}\{ \beta(\cdot)\notin \text{SCB}^{\text{sup}}_{1-\alpha}(\cdot)\ \text{for any}\ t\in[0,T_{\text{post}}] \}\leq\alpha
$$

## 4. Equivalence Testing for Pre-Anticipation Window

Suppose a reference band $[\Delta_\ell(t), \Delta_u(t)]$ for $\Delta(t)=\beta(t)$ is postulated under a compound null $H_0:\beta(t)=\Delta(t)$ for $t\in[-T_{\text{pre}},t_A]$, with $t_A\leq0$ defining the anticipation window’s start. The test distinguishes:

- $H_0$: $\exists\, t\in[-T_{\text{pre}},t_A]$ such that $\beta(t)\notin [\Delta_\ell(t),\Delta_u(t)]$
- $H_1$: $\forall\, t\in[-T_{\text{pre}},t_A]$, $\beta(t)\in [\Delta_\ell(t),\Delta_u(t)]$

Infimum SCBs are constructed:
$$
\text{SCB}^{\text{inf},+}_{1-\alpha}(t) = [-\infty, \hat\beta_n(t)+u^{\text{inf}}_{1-\alpha}\sqrt{\widehat{C}_\beta(t,t)/n}]
$$
$$
\text{SCB}^{\text{inf},-}_{1-\alpha}(t) = [\hat\beta_n(t)-u^{\text{inf}}_{1-\alpha}\sqrt{\widehat{C}_\beta(t,t)/n},\infty]
$$

Reject $H_0^-$ (“$\exists t:\beta(t)\leq\Delta_\ell(t)$”) if $\Delta_\ell(t)<\text{SCB}^{\text{inf},-}_{1-\alpha}(t)$ $\forall t$; reject $H_0^+$ (“$\exists t:\beta(t)\geq\Delta_u(t)$”) if $\text{SCB}^{\text{inf},+}_{1-\alpha}(t)<\Delta_u(t)$ $\forall t$.

A joint $2\alpha$-level test requires both bands to be contained within $[\Delta_\ell(t), \Delta_u(t)]$ $\forall t$. The test enjoys asymptotic size $\alpha$ via the functional CLT and consistent covariance estimation.

## 5. Relevance Testing for Post-Treatment Effects

A parallel relevance test is formulated for the post-treatment window using the same reference band:
- $H_0$: $\beta(t)\in [\Delta_\ell(t),\Delta_u(t)]$ $\forall t\in(0,T_{\text{post}}]$
- $H_1$: $\exists t:\beta(t)\notin [\Delta_\ell(t),\Delta_u(t)]$

Rejection occurs if the supremum confidence band $\text{SCB}^{\text{sup}}_{1-\alpha}(t)$ fails to intersect $[\Delta_\ell(t),\Delta_u(t)]$ for any $t$. This test holds asymptotic size $\alpha$.

## 6. Empirical Validation and Applications

Simulation results indicate:

- Interpolation error decays at rate $O_P(1/\sqrt{n}) + O(1/T)$.
- Under parallel-trends violations, sup-SCB tests maintain nominal Type I error control and exhibit higher detection power than Bonferroni-corrected pointwise bands, which are invalid.
- Under anticipation, inf-SCB equivalence tests control size when the reference band coincides with $\beta$ during $[-T_{\text{pre}},t_A]$ and demonstrate power against mis-specified bands.

Case studies demonstrate robust practical utility:
- For gender bias in livestreamed courts (Chen et al 2025), the honest event study plot first validates the reference band via infimum-SCB over $t\leq -1$ and then confirms significant uniform post-period effects over $[5.5,9]$ via supremum-SCB.
- For duty-to-bargain laws and female employment (Lovenheim & Willén 2019), the reference band could not be rigorously validated (inf-SCB intersects band), yet the post-treatment sup-band fails to reject the null, indicating no significant causal effect once pre-trend is accommodated.

## 7. Software Implementation

The R package **fdid** (fang_liebl_2025_R) operationalizes the functional DiD approach by:

1. Fitting the functional DiD estimator via TWFE.
2. Performing natural-cubic-spline interpolation.
3. Estimating the covariance surface.
4. Computing sup- and inf-SCBs through parametric, multiplier, or Kac-Rice procedures.
5. Executing relevance and equivalence tests.
6. Rendering “honest” event-study plots.

This comprehensive workflow provides transparent, uniform inference for causal effects over time, rectifying deficiencies inherent in pointwise event study analysis [2512.06804].

Source: https://www.emergentmind.com/topics/functional-data-approach-to-did