Dynamic Treatment Effect

The package supports Debiased Machine Learning (DML) for two-period dynamic treatment effects. The observed data are \(W=(X_1,D_1,X_2,D_2,Y)\), where \(X_1\) are baseline covariates, \(D_1 \in \{0,1\}\) is the first-period treatment, \(X_2\) are intermediate covariates, \(D_2 \in \{0,1\}\) is the second-period treatment, and \(Y\) is the final outcome.

Dynamic treatment mean

For a treatment path \(d=(d_1,d_2)\), the target estimand is \(\mathbb{E}[Y(d_1,d_2)]\).

Let \(S_1=(1,X_1^\top)^\top\) and \(S_2=(1,X_1^\top,X_2^\top)^\top\). First define the path-specific sequential propensities

\[\begin{split}\begin{aligned} \pi_{1d}(S_1) &= \mathbb{P}(D_1=d_1 \mid S_1), \\ \pi_{2d}(S_2) &= \mathbb{P}(D_2=d_2 \mid S_2,D_1=d_1). \end{aligned}\end{split}\]

Following the package’s nuisance notation, define

\[\begin{split}\begin{aligned} \nu_{d}(W) &= \mathbb{E}[\delta_{d}(W) \mid S_1,D_1=d_1], \\ \delta_{d}(W) &= \mathbb{E}[Y \mid S_2,D_1=d_1,D_2=d_2], \\ \alpha_{d}(W) &= \frac{\mathbb{1}(D_1=d_1,D_2=d_2)} {\pi_{1d}(S_1)\pi_{2d}(S_2)}, \\ \eta_{d}(W) &= \frac{\mathbb{1}(D_1=d_1)} {\pi_{1d}(S_1)}. \end{aligned}\end{split}\]

The implemented multiply robust score is

\[\begin{split}\begin{aligned} \psi_d(W) = \nu_d(W) &+ \alpha_d(W)\{Y-\delta_d(W)\} \\ &+ \eta_d(W)\{\delta_d(W)-\nu_d(W)\}. \end{aligned}\end{split}\]

This is the same bilinear influence-function structure used in the nested NPIV paper. In the paper’s generic notation,

\[h_1(B_1)+h_3(B_3)\{Y-h_2(B_2)\}+h_4(B_4)\{h_2(B_2)-h_1(B_1)\},\]

the dynamic-treatment specialization is

\[h_1=\nu_d,\qquad h_2=\delta_d,\qquad h_3=\alpha_d,\qquad h_4=\eta_d.\]

Thus the dynamic score follows the same convention as the long-term and mediated scores: \(\nu_d\) is the outer outcome/state regression, \(\delta_d\) is the inner outcome regression, and \(\alpha_d,\eta_d\) are the balancing weights multiplying the two residuals.

The first-period nuisance \(\nu_d(W)\) can be fitted by regressing \(\hat{\delta}_d(W)\) on \(S_1\) among observations with \(D_1=d_1\), or with the sequential doubly robust learner (S-DRL) pseudo-outcome

\[\hat{\delta}_d(W) + \frac{\mathbb{1}(D_2=d_2)}{\hat{\pi}_{2d}(S_2)} \{Y-\hat{\delta}_d(W)\}.\]

Localization works as in the other semiparametric DML classes. Since dynamic effects localize on period-1 variables, V is appended to X1 when include_V=True and is also used to form local kernel weights. For the uncentered path-specific score \(\psi_d\), the finite-bandwidth target is

\[\theta_{d,\lambda}(v) =\frac{\mathbb{E}[K\{(V-v)/\lambda\}\psi_d]} {\mathbb{E}[K\{(V-v)/\lambda\}]}.\]

Writing \(\ell_{\lambda,v}=K/\mathbb{E}[K]\), its centered score contribution is \(\ell_{\lambda,v}\{\psi_d-\theta_{d,\lambda}(v)\}\). When CHIM=True, the overlap indicator multiplies both the score and its loading, so estimation remains a ratio moment for the overlap-restricted localized target. Inference treats the estimated trimming rule as fixed.

OR and IPW use the same centering; see Localized Ratio Targets for its inferential interpretation.

The outcome stage is always nested/sequential. By default, DML_dynamic uses an RKHS IV learner for both \(\delta_d\) and \(\nu_d\), matching the default style of the other DML classes. Outcome learners should follow the package NPIV-style interface fit(Z, T, Y) and predict(T); linear notebook examples use nnpiv.tsls.tsls for this reason. To use distinct learners for the two nested regressions, pass them as model1=[delta_model, nu_model]. Neural network learners can be used by setting nn_1=True for both stages or nn_1=[delta_is_nn, nu_is_nn] for stage-specific control. The propensity score model defaults to LogisticRegression(); overlap trimming is handled through CHIM=True.

nnpiv.semiparametrics.DML_dynamic(Y, D1, D2)

Debiased Machine Learning for two-period dynamic treatment effects.

References