Comparing Treatments in the Same Population
When starting conditions affect treatment choice, standardisation can compare both treatments using one target population, if the measured conditions suffice to control confounding.
13 sections · 4 questions · 2 coding challenges
The arrow keys move between sections too.
Choosing Variables by Their Causal Role
BOTIE
The important step is deciding whether an adjustment set is justified. A numerical standardisation can always be computed from a complete table; a causal interpretation cannot be obtained from arithmetic alone.
Sources for this history
Can We Make the Dry and Moist Beds Count Equally in Both Groups?
Botie cannot rerun an old season as a randomised experiment. He does have starting soil measurements and outcomes under both schedules in each soil group.
We can calculate an outcome mean for each schedule within each group, then average both using the same target-population proportions. Whether that adjusted number is causal depends on what the measurements and causal assumptions leave out.
The supplied means illustrate adjustment under the causal assumptions explained in the lesson.
Step 1 of 3
Compare within starting soil groups
Both schedules have observations in each group.
| Starting soil | Treatment means | Control means |
|---|---|---|
| Dry soil | 4 | 3 |
| Moist soil | 9 | 8 |
Dry soil
- Treatment means
- 4
- Control means
- 3
Moist soil
- Treatment means
- 9
- Control means
- 8
Step 2 of 3
Choose the target population
Use the same group proportions for both schedules.
| Starting soil | Dry/moist target weights |
|---|---|
| Dry soil | 0.6 |
| Moist soil | 0.4 |
Dry soil
- Dry/moist target weights
- 0.6
Moist soil
- Dry/moist target weights
- 0.4
Step 3 of 3
Standardise both outcomes
Their difference now refers to the shared target mixture.
Adjusted treatment mean = (0.6 × 4) + (0.4 × 9) = 6 Adjusted control mean = (0.6 × 3) + (0.4 × 8) = 5 Adjusted difference = 6 − 5 = 1
Adjustment compares both interventions in one specified population
Both interventions are compared in the same target mixture.
What if both schedules served the same mix of beds?
Use the same target proportions to combine both schedules' outcomes. Change that target mix and see how the average effect depends on the population we are asking about.
BOTIE
Adjusted contrast in the target population
1
Follow the operations
1. Treatment stratum means
- 04
- 19
2. Control stratum means
- 03
- 18
3. Subtract
- 01
- 11
4. Target stratum proportions
- 00.6
- 10.4
5. Check a probability distribution
- 00.6
- 10.4
6. Dot product
1
7. Result
1
Causal interpretation requires a sufficient adjustment set, consistency, overlap, and the other stated design assumptions.
1. Specify the Causal Assumptions
Assume measured starting soil condition blocks the relevant common causes of schedule and outcome. Also require well-defined treatments, consistency between observed and specified treatment, no relevant interference, and positive chances of both treatments in the target strata.
These conditions are not established merely because a model fits outcomes well. Unmeasured plant health could still confound the comparison.
The example states identification assumptions so readers can see exactly what the arithmetic depends on.
2. Select a Target Population
Suppose we want the effect for a particular mix of dry and moist beds. The target weights record the proportions of those starting conditions. They must be nonnegative and sum to one.
Use that same mix to average the outcomes under both schedules. If we instead use the treated group's proportions for one average and the control group's for the other, differences in starting conditions enter the comparison again.
Target weights = [0.6,0.4]
Standardised treatment = 0.6 × 4 + 0.4 × 9 = 6
Standardised control = 0.6 × 3 + 0.4 × 8 = 5
Difference = 1Changing the target population can change an average effect when stratum effects differ.
3. Do Not Adjust for Every Available Column
A mediator is affected by treatment and lies on a pathway to the outcome. Adjusting for it can remove part of the total effect. A collider is a common effect; conditioning on it can open an otherwise blocked association path.
Use the causal story and measurement timing to decide roles. A feature-selection algorithm designed for prediction cannot decide this from predictive usefulness alone.
Our adjustment uses a pretreatment common cause, not a later moisture measurement caused by the schedule.
Apply one target population to the condition-specific effects
The schedule's difference is not the same in the two starting conditions. Give both schedules the same target mixture so the final comparison answers one population's question.
import numpy as np
treatment = np.array([3., 8.])
control = np.array([1., 7.])
target_mix = np.array([0.5, 0.5])
effects = treatment - control
print(effects.tolist())
print(float(target_mix @ effects))[2.0, 1.0]
1.5The adjusted contrast lies between the two condition-specific differences. Changing the target mix changes whose average effect is being described, under the lesson's identification assumptions.
4. Inspect Empty and Sparse Strata
If one schedule never occurs in a soil group, its outcome mean there cannot be estimated directly from those observations. A regression may still return a value, but it is extrapolating.
Report overlap, sample counts, model dependence, and sensitivity to unmeasured confounding. More elaborate fitting does not create missing treatment comparisons.
The workshop assumes all supplied stratum means are estimable; the limitations remain part of the result.
5. Both Treatments Must Describe the Same Target Population
Within each pre-treatment group, estimate the outcome mean under each treatment. Then average both sets of means using the same group weights. Subtracting those standardised outcomes answers what the difference would be for that target mixture under the identification assumptions.
The target could be the study population or another specified population. Changing the weights changes the estimand. Keep their source explicit rather than letting whichever group has more records decide the question.
6. Carry Group Means into Two Target Populations
Treatment effects can differ between soil groups. In that case, two target populations can have different average effects even when every group-specific estimate is unchanged.
This is a reason to report the group estimates and support, not only one overall adjusted number.
Change the target mixture deliberately
The supplied group means concern dry and moist beds.
import numpy as np
untreated = np.array([2.,7.])
treated = np.array([6.,8.])
effect = treated-untreated
for weights in [np.array([.5,.5]), np.array([.8,.2])]:
print(round(float(weights@effect), 3))2.5
3.4The target with more dry beds has a larger average effect because that group benefits more in this supplied table.
7. An Empty Treatment Cell Requires Extrapolation
If every dry bed received treatment, we have no untreated dry-bed mean to compare. An outcome model can produce a numerical prediction there, but it extrapolates beyond observed treatment overlap.
Inspect the counts behind every estimated group mean. Combining sparse groups or restricting the target population changes assumptions or the question. State the change. More flexible modelling does not create observations of a treatment that was never used in that group.
Check yourself
Questions on Parts 1 to 7
Question 1 of 4
What is the standardised difference?
Use the information below.
Treatment means [4,9], control [3,8], target weights [0.6,0.4].Try it with Botie
Build with Botie
Write and run Python