Navigation: Package overview · Previous: Notebook 6 · Next: Notebook 8
Use the Code menu to show or hide all code, or choose Download Rmd to download the source notebook.
Table of Contents
Another way of deriving the decomposition is to specify reference distributions for version assignment and for the population over which potential outcomes are averaged. These choices define hypothetical randomized experiments whose mean outcomes can be compared in a two-by-two table. Choosing the observed population references recovers the population-centered decomposition. We assess sensitivity by varying both references between the female and male groups while keeping the observed female-minus-male contrast fixed.
The notebook reuses the saved nuisance predictions and reports pointwise inference. The Female and Male reference specifications, in which both centering quantities come from the same gender, are passed to Notebook 8.
Load the saved main analysis and construct the reference mixtures without refitting nuisance models. The helper retains the main covariance convention and verifies the decomposition identities.
library(causalDML)
library(tidyverse)
input_file = knitr::current_input(dir = TRUE)
if (!length(input_file) || !nzchar(input_file)) {
input_file = rstudioapi::getActiveDocumentContext()$path
}
notebook_dir = dirname(normalizePath(input_file, winslash = "/", mustWork = TRUE))
project_dir = dirname(notebook_dir)
results_dir = file.path(project_dir,"results","7_centering")
image_file = file.path(project_dir,"images","Image_centering.RData")
knitr::opts_chunk$set(fig.path = file.path(tempdir(),"knitr-"),
dpi = 150,dev = "png",dev.args = list(type = "cairo"))
source(file.path(notebook_dir,"centering_support.R"))
centering_results = prepare_centering_analysis(project_dir,results_dir)
reference_delta_results = save_centering_handoff(centering_results,image_file)
centering_plots = make_centering_plots(centering_results)
save_centering_plots(centering_plots,results_dir)
delta2_range = subset(centering_results$ranges,component == "Delta2")
inline_money = function(value) {
paste0(ifelse(value < 0,"-",""),"$",sprintf("%.2f",abs(value)))
}
Appendix A.4 of the paper discusses these alternative reference distributions. To separate the roles of version shares and group outcomes, choose a common reference for each. Both references run from female at zero to male at one. Treatment-reference weight \(\alpha\) and outcome-reference weight \(\beta\) define
\[ e_{ta}^{\mathrm{ref}}(\alpha) =(1-\alpha)e_{ta}(\mathcal X_{\mathrm{female}}) +\alpha e_{ta}(\mathcal X_{\mathrm{male}}), \] \[ \mu_t^{\mathrm{ref}}(\beta) =(1-\beta)\mu_t(\mathcal X_{\mathrm{female}}) +\beta\mu_t(\mathcal X_{\mathrm{male}}), \qquad 0\leq\alpha,\beta\leq1. \]
Here, \(\alpha\) specifies the randomized version mix, while \(\beta\) specifies a reference population with female weight \(1-\beta\) and male weight \(\beta\). Both references are used for both groups. Changing them leaves the underlying group-specific potential outcomes and \(d(a,g)\) unchanged.
These references define three additional synthetic means:
| Randomized version assignment | Mean in reference population | Mean for group \(g\) |
|---|---|---|
| Reference shares \(e_{ta}^{\mathrm{ref}}(\alpha)\) | \(s_0(a;\alpha,\beta):=\sum_{t\in\mathcal T_a}e_{ta}^{\mathrm{ref}}(\alpha)\mu_t^{\mathrm{ref}}(\beta)\) | \(s_1(a,g;\alpha):=\sum_{t\in\mathcal T_a}e_{ta}^{\mathrm{ref}}(\alpha)\mu_t(\mathcal X_g)\) |
| Group \(g\)’s shares \(e_{ta}(\mathcal X_g)\) | \(s_2(a,g;\beta):=\sum_{t\in\mathcal T_a}e_{ta}(\mathcal X_g)\mu_t^{\mathrm{ref}}(\beta)\) | \(d(a,g):=\sum_{t\in\mathcal T_a}e_{ta}(\mathcal X_g)\mu_t(\mathcal X_g)\) |
Each cell averages outcomes over the column’s population under random assignment using the row’s version shares. In \(s_2(a,g;\beta)\), group \(g\)’s shares are applied to everyone in the reference population.
Adding and subtracting the three synthetic means yields
\[ \begin{aligned} d_0(a;\alpha,\beta)&=s_0(a;\alpha,\beta),\\ d_1(a,g;\alpha,\beta)&=s_1(a,g;\alpha)-s_0(a;\alpha,\beta),\\ d_2(a,g;\alpha,\beta)&=s_2(a,g;\beta)-s_0(a;\alpha,\beta),\\ d_3(a,g;\alpha,\beta)&=d(a,g)-s_1(a,g;\alpha)-s_2(a,g;\beta)+s_0(a;\alpha,\beta), \end{aligned} \] \[ d(a,g)=d_0(a;\alpha,\beta)+d_1(a,g;\alpha,\beta)+d_2(a,g;\alpha,\beta)+d_3(a,g;\alpha,\beta). \]
The baseline \(d_0(a;\alpha,\beta)\) is the reference-population mean under the reference assignment. The outcome contribution \(d_1(a,g;\alpha,\beta)\) compares group \(g\) with the reference population under the same assignment. The treatment contribution \(d_2(a,g;\alpha,\beta)\) compares assignment rules for the same reference population. The joint contribution \(d_3(a,g;\alpha,\beta)\) is the difference between the effects of switching assignment rules in group \(g\) and in the reference population:
\[ \begin{aligned} d_3(a,g;\alpha,\beta) &=[d(a,g)-s_1(a,g;\alpha)]-[s_2(a,g;\beta)-s_0(a;\alpha,\beta)]\\ &=\sum_{t\in\mathcal T_a} [e_{ta}(\mathcal X_g)-e_{ta}^{\mathrm{ref}}(\alpha)] [\mu_t(\mathcal X_g)-\mu_t^{\mathrm{ref}}(\beta)]. \end{aligned} \]
Under fully randomized version assignment, all treatment-reference mixtures equal the actual version probabilities, so \(d_2(a,g;\alpha,\beta)=d_3(a,g;\alpha,\beta)=0\), introducing no artificial treatment or joint heterogeneity components.
With a single control condition,
\[ \Delta_1(\alpha)=\sum_{t\in\mathcal T_a}e_{ta}^{\mathrm{ref}}(\alpha) [\tau_{t,0}(\mathcal X_{\mathrm{female}})-\tau_{t,0}(\mathcal X_{\mathrm{male}})], \] \[ \Delta_2(\beta)=\sum_{t\in\mathcal T_a} [e_{ta}(\mathcal X_{\mathrm{female}})-e_{ta}(\mathcal X_{\mathrm{male}})] \tau_{t,0}^{\mathrm{ref}}(\beta), \] \[ \begin{aligned} \Delta_3(\alpha,\beta) &=(\alpha+\beta-1)\sum_{t\in\mathcal T_a} [e_{ta}(\mathcal X_{\mathrm{female}})-e_{ta}(\mathcal X_{\mathrm{male}})]\\ &\qquad\times[\tau_{t,0}(\mathcal X_{\mathrm{female}})-\tau_{t,0}(\mathcal X_{\mathrm{male}})]. \end{aligned} \]
Here, \(\tau_{t,0}^{\mathrm{ref}}(\beta)=\mu_t^{\mathrm{ref}}(\beta)-\mu_0^{\mathrm{ref}}(\beta)\). The mixed reference-only terms cancel in the group difference, leaving no \(\alpha\beta\) term. Thus, \(\Delta_1\) varies only with the probability reference, \(\Delta_2\) only with the outcome reference, and \(\Delta_3\) offsets both changes. \(\Delta_4\) is unchanged.
Choosing
\[ \alpha=P(X\in\mathcal X_{\mathrm{male}}\mid A=a), \qquad \beta=P(X\in\mathcal X_{\mathrm{male}}) \]
yields \(e_{ta}^{\mathrm{ref}}(\alpha)=e_{ta}\) and \(\mu_t^{\mathrm{ref}}(\beta)=\mu_t\), recovering the population-centered synthetic means and decomposition. The corresponding thought experiments preserve the observed population version mix and average outcomes over the full analysis population.
The fitted coordinates use the corresponding observed male shares:
population_coordinates = data.frame(
Reference = c("Treatment version probabilities","Potential outcome means"),
Male_weight = unname(centering_results$population),
Female_weight = 1-unname(centering_results$population)
)
knitr::kable(population_coordinates,digits=5,row.names=FALSE)
| Reference | Male_weight | Female_weight |
|---|---|---|
| Treatment version probabilities | 0.54038 | 0.45962 |
| Potential outcome means | 0.57143 | 0.42857 |
The heatmap uses a common dollar scale across the four components. The horizontal axis varies the treatment-probability reference \(\alpha\) and the vertical axis the outcome reference \(\beta\). Both references are common to women and men. Diamonds mark the fitted population centering.
centering_plots$point_estimates
The color scale is logarithmic, but the legend reports the original two-sided p-values. All tests are pointwise, with Student-\(t\) tails and \(N\) degrees of freedom, where \(N\) is the analysis sample size. The gender-specific probabilities and outcomes are estimated; the grid mixing weights are fixed. There is no multiplicity adjustment.
Gray cells on the \(\Delta_3\) diagonal are structural zeros: both the component and its influence function are identically zero, so no p-value is reported. Away from this line, the estimate and standard error scale together and the \(\Delta_3\) p-value is constant. At the diamond, the plotted p-value concerns the fixed-coordinate grid estimand; the original population specification additionally estimates its mixing shares.
centering_plots$p_values_log
Vary \(\alpha\) or \(\beta\) while holding the other reference at its fitted population coordinate. The ribbons show pointwise 95% intervals. Diamonds mark the original population point estimates. \(\Delta_4\) is omitted because it is invariant to both centering choices.
centering_plots$one_reference_slices
Download the centering curves and pointwise intervals (CSV) and the population estimates shown as diamonds (CSV).
The observed female-minus-male contrast is -$9.53 per week (SE $8.05). Changing the reference quantities reallocates this fixed contrast among the components.
Across the reference mixtures, \(\Delta_2\) ranges from -$11.55 to -$7.68. It remains negative and larger in absolute value than every other component. The pointwise test rejects \(\Delta_2=0\) at 5% at every reference mixture on the plotted grid (largest pointwise p = 0.018).
range_table = centering_results$ranges[,c("component","estimate_min","estimate_max",
"se_min","se_max","p_min","p_max")]
range_table$se_min = ifelse(range_table$component == "Delta3" & range_table$se_min == 0,
"0 (structural)",sprintf("%.4f",range_table$se_min))
for (column in c("p_min","p_max")) {
p = range_table[[column]]
range_table[[column]] = ifelse(p < .0001,"< .0001",sprintf("%.4f",p))
}
names(range_table) = c("Component","Estimate min","Estimate max","SE min","SE max",
"p min (where defined)","p max (where defined)")
knitr::kable(range_table,digits=4,row.names=FALSE,align="lrrrrrr",
caption="Exact point-estimate ranges; SE and defined p-value ranges over the plotted grid")
| Component | Estimate min | Estimate max | SE min | SE max | p min (where defined) | p max (where defined) |
|---|---|---|---|---|---|---|
| Delta1 | -0.2100 | 3.6643 | 7.7104 | 8.0708 | 0.6429 | 0.9978 |
| Delta2 | -11.5494 | -7.6752 | 2.0647 | 3.2403 | < .0001 | 0.0179 |
| Delta3 | -3.8743 | 3.8743 | 0 (structural) | 4.1196 | 0.3470 | 0.3470 |
| Delta4 | -1.6480 | -1.6480 | 3.1244 | 3.1244 | 0.5979 | 0.5979 |
Note: Point-estimate and standard-error ranges include all grid points. For \(\Delta_3\), the zero minimum standard error is structural: on \(\alpha+\beta=1\), both the estimate and its standard error are identically zero. These points are excluded from the p-value range because the usual t-statistic is undefined. The zero standard error reflects an algebraic identity, not precision gained from the data.