Tutorials › Response-Adaptive Randomization › Build Data-Generating Mechanisms For Adaptive Trials

Simulation Studies · Tutorial 486 of 501

Build Data-Generating Mechanisms For Adaptive Trials

Build coherent data-generating mechanisms by specifying covariates, potential outcomes, and treatment effects before simulating an adaptive trial.

Intermediate 10 min read

What You'll Learn

  • Specify covariate distributions and outcome models for trial participants.
  • Distinguish a sharp null from a zero average treatment effect.
  • Represent treatment-effect heterogeneity in continuous and binary outcomes.
  • Translate model parameters into clinically interpretable effects.
  • Check that a proposed mechanism produces plausible outcomes and probabilities.

Why the Data-Generating Mechanism Matters

A simulation comparison is only as informative as the trial conditions it represents. An allocation rule is evaluated against data generated under a specified population, outcome process, and treatment effect. If those ingredients are vague or inconsistent, the resulting operating characteristics may answer a different question from the one intended. A data-generating mechanism (DGM) makes those ingredients explicit: it describes how each participant’s covariates and potential outcomes arise.

The focus here is the construction of outcome, covariate, and treatment-effect models for adaptive trials. The allocation mechanism determines which potential outcome is observed, but it does not define the population response process. For a proposed DGM, specify that response process first, including what “no effect” means and how any effect varies across participants.

Definition: For participant \(i\), let \(X_i\) denote baseline covariates, \(A_i\) the assigned treatment, and \(Y_i(a)\) the potential outcome that would be observed under treatment \(a\). The observed outcome is \(Y_i=Y_i(A_i)\). A DGM specifies the joint distribution of the covariates and potential outcomes, together with any assumptions needed to generate them.

A common construction is to generate \(X_i\), then define potential outcomes \(Y_i(0)\) and \(Y_i(1)\), and finally record the outcome corresponding to the assigned treatment. This separates the response model from the allocation rule. It also forces a clear statement of the target effect: for example, a difference in mean outcome, a difference in event risk, or a subgroup-specific contrast.

Specify Covariates and Outcomes Before Effects

Begin by deciding what covariates matter to the trial question and how they are distributed. A binary prognostic covariate might represent a disease subgroup; a continuous covariate might represent baseline severity. The model should state whether covariates are generated independently, jointly, or with a specified association. It should also reflect the intended target population: for instance, a subgroup prevalence in a simulation should not be chosen accidentally through an arbitrary sampling scheme.

Next specify how outcomes depend on covariates in the absence of treatment. For a continuous outcome, a simple model is \(Y_i(0)=\beta_0+\beta_X X_i+\varepsilon_i\), where \(\varepsilon_i\) has mean zero and a stated variance. For a binary outcome, one standard choice is a logistic model, which maps a linear predictor to an event probability. These are modeling choices, not universal truths. Their assumptions include the chosen functional form, the error distribution or link function, and the covariate distribution.

Modeling principle: Specify the control response and the treatment contrast on a scale that is meaningful for the scientific question. A treatment coefficient in a conditional model is not automatically the same as a marginal risk difference or marginal mean difference.

The potential outcomes need a joint specification if the simulation will use individual treatment effects, paired potential outcomes, or quantities depending on their dependence. Their marginal distributions alone do not determine how \(Y_i(0)\) and \(Y_i(1)\) co-vary within a participant. One simple choice is to use a shared exogenous error or uniform random variable across treatment conditions. Another is to generate the potential outcomes independently conditional on covariates. Either choice can yield the same marginal treatment-specific outcome distributions, but the distribution of individual effects \(Y_i(1)-Y_i(0)\) may differ.

Null Effects and Heterogeneity

A sharp null of no treatment effect states that every participant’s potential outcomes are equal: \(Y_i(1)=Y_i(0)\) for all \(i\). A convenient way to generate it is to use exactly the same outcome-generating expression under both treatments. A weaker null can instead concern an average effect, such as \(E\{Y_i(1)-Y_i(0)\}=0\). That condition permits some participants to benefit and others to be harmed, provided the effects average to zero. Thus, a zero average effect does not by itself imply a sharp null.

Heterogeneity can be modeled by allowing the treatment contrast to depend on baseline covariates. In a continuous-outcome model, the treatment term may include an interaction with a subgroup indicator. In a binary-outcome model, an interaction on the log-odds scale describes heterogeneity in conditional log odds; it does not directly specify the same degree of heterogeneity in risk differences. Always calculate the effect on the scale that will be interpreted.

Worked Example: A Sharp Null With Prognostic Covariates

Suppose a hypothetical trial has a binary covariate \(X_i\), with \(P(X_i=1)=0.40\), and a continuous outcome measured in points. Let \(\varepsilon_i\sim N(0,100)\), independently across participants and independently of \(X_i\). Define the potential outcomes by

$$ Y_i(0)=50+3X_i+\varepsilon_i,\qquad Y_i(1)=50+3X_i+\varepsilon_i. $$

The covariate is prognostic: changing from \(X_i=0\) to \(X_i=1\) increases the conditional mean by 3 points. The treatment contrast is nevertheless exactly zero for every participant, because

$$ Y_i(1)-Y_i(0) =(50+3X_i+\varepsilon_i)-(50+3X_i+\varepsilon_i)=0. $$

For a participant with \(X_i=1\) and generated error \(\varepsilon_i=-2\), both potential outcomes equal \(50+3-2=51\) points. The model has a sharp null despite covariate variation and outcome noise. Its assumptions are explicit: the covariate is Bernoulli with probability 0.40, the error is normal with variance \(100\), and the same error is used in both potential outcomes.

Worked Example: Binary Outcomes With a Covariate-Dependent Response

Consider a hypothetical binary endpoint and a binary baseline subgroup \(Z_i\), with \(P(Z_i=1)=0.50\). Define treatment-specific event probabilities by

$$ P\{Y_i(a)=1\mid Z_i\} =\operatorname{logit}^{-1}(-1.386+0.8Z_i-0.55a), \qquad a\in\{0,1\}. $$

Here \(\operatorname{logit}^{-1}(u)=1/(1+e^{-u})\). The subgroup is prognostic, and the treatment coefficient is constant on the conditional log-odds scale. For \(Z_i=0\), the control and treatment linear predictors are \(-1.386\) and \(-1.936\); the event risks are approximately 0.2000 and 0.1261. For \(Z_i=1\), the predictors are \(-0.586\) and \(-1.136\), giving risks approximately 0.3576 and 0.2431.

With equal subgroup prevalence, the marginal risks are

$$ P\{Y_i(0)=1\}\approx\frac{0.2000+0.3576}{2}=0.2788,\qquad P\{Y_i(1)=1\}\approx\frac{0.1261+0.2431}{2}=0.1846. $$

Thus the marginal risk difference, treatment minus control, is approximately \(0.1846-0.2788=-0.0942\), a reduction of about 9.42 percentage points in event risk. This calculation also shows why the model coefficient \(-0.55\) should not be reported as a risk difference: it is a conditional log-odds contrast. To generate binary potential outcomes with these marginal risks, one possible coupling is to draw \(U_i\sim\operatorname{Uniform}(0,1)\) and set \(Y_i(a)=1\) when \(U_i\) is below the treatment-specific risk. This shared-\(U_i\) choice specifies their joint dependence as well as their marginal probabilities.

Represent Clinically Relevant Alternatives

A useful alternative scenario should be defined in an interpretable scale, not merely by choosing a nonzero coefficient. For a continuous endpoint, specify the treatment effect in outcome units and state how it varies by subgroup. For a binary endpoint, report treatment-specific risks and a marginal contrast when that is the clinical quantity of interest. An effect can be clinically relevant even if it is not constant across participants.

Worked Example: A Clinically Relevant Heterogeneous Mean Effect

Suppose a hypothetical continuous endpoint is measured in points, lower values being better. Let \(X_i=1\) identify a higher-severity subgroup, with \(P(X_i=1)=0.30\). Assume the control potential outcome is \(Y_i(0)=60+8X_i+\varepsilon_i\), where \(\varepsilon_i\sim N(0,64)\). Define treatment response by

$$ Y_i(1)=Y_i(0)-5-7X_i. $$

The treatment effect is \(-5\) points for \(X_i=0\), and \(-12\) points for \(X_i=1\). The marginal mean effect is

$$ E\{Y_i(1)-Y_i(0)\} =0.70(-5)+0.30(-12) =-3.5-3.6=-7.1\text{ points}. $$

If a reduction of 6 points in the population mean had been defined in advance as clinically important, this scenario represents an alternative exceeding that threshold in magnitude. The conclusion follows from the stated subgroup prevalence and effects; it does not follow from the interaction coefficient alone. The model assumes the same error term in both potential outcomes, a normal error with variance \(64\), and the stated subgroup distribution.

Construction Checks and Common Failure Modes

Before using a DGM, inspect what it implies. For continuous outcomes, calculate conditional means, treatment contrasts, and a plausible range of generated values. For binary outcomes, evaluate event probabilities at relevant covariate combinations and confirm that each lies strictly between zero and one. For either outcome type, check that subgroup prevalence and treatment-effect summaries match the intended population. A model can be mathematically valid yet clinically implausible.

A useful derivation is to obtain the marginal treatment effect by averaging conditional effects over the covariate distribution. If \(X_i\) takes values \(x\) with probabilities \(P(X_i=x)\), then for a mean outcome contrast,

$$ E\{Y_i(1)-Y_i(0)\} =\sum_x P(X_i=x)\, E\{Y_i(1)-Y_i(0)\mid X_i=x\}. $$

This follows by partitioning the expectation over the mutually exclusive covariate values. It is the required calculation when subgroup effects are specified but the target is an overall mean effect. For binary outcomes, the same averaging applies to conditional risks to obtain marginal risks; subtract those two marginal risks to get the marginal risk difference.

Common errors include confusing a sharp null with a zero average effect, describing a conditional logistic coefficient as a marginal risk difference, and choosing a subgroup prevalence that is inconsistent with the intended population. Another mistake is specifying only the separate distributions of \(Y_i(0)\) and \(Y_i(1)\) while assuming that this uniquely determines individual treatment effects. It does not: the within-person dependence between potential outcomes must also be stated when it matters.

There are several reasonable alternatives when specifying a response model. A logistic model is convenient for conditional odds and ensures valid probabilities, while direct risk models may make marginal risk contrasts easier to target but need constraints to keep probabilities in range. Fixed covariate values can represent a deliberately balanced population; randomly generated covariates represent population sampling variation. Neither choice is universally preferable. The choice should match the scientific target and be stated. Simple models are often easier to interpret, while richer models can represent nonlinear prognostic effects or multiple subgroups—but require more parameters and more careful plausibility checks.

These mechanisms have limits. A chosen model is not evidence that the real response process follows it. Results can depend on the covariate distribution, the effect scale, the assumed outcome variability, and the coupling of potential outcomes. A finite collection of scenarios cannot cover every plausible trial population. The purpose is to make assumptions visible and to evaluate conclusions under clearly defined conditions, not to disguise assumptions as empirical facts.

1
Define the target population.
Specify covariates, their distributions, and any dependence that matters to the trial question.
2
Build the control response.
Choose an outcome scale, covariate effects, and an error or probability model, then state their assumptions.
3
Add the treatment contrast.
Define a sharp null, a zero-average-effect scenario, heterogeneous effects, or a clinically relevant alternative in a stated scale.
4
Check implications.
Calculate subgroup and marginal effects, inspect outcome ranges or risks, and confirm that the generated conditions match the intended scenario.
Key takeaway: A defensible adaptive-trial simulation begins with an explicit population and potential-outcome model. State whether the null is sharp or average, compute effects on the intended scale, and verify that the model implies plausible outcomes.

Check Your Understanding

Answer each question, then compare your reasoning with the solutions.

  1. A binary-outcome DGM has no treatment term and uses the same uniform random variable to construct both potential outcomes. What null does this specify?
  2. A trial has subgroup prevalence 0.25 and mean treatment effects of \(-2\) points and \(-10\) points in the two subgroups. Find the marginal mean effect.
  3. Why is a logistic treatment coefficient not automatically a marginal risk difference?
  4. What additional modeling choice is needed if a simulation will examine individual treatment effects?

Solutions. (1) It specifies a sharp null: the two potential outcomes are equal participant by participant. (2) The marginal effect is \(0.75(-2)+0.25(-10)=-1.5-2.5=-4\) points. (3) The coefficient is a conditional log-odds contrast; a marginal risk difference requires calculating and averaging treatment-specific risks over the covariate distribution, then subtracting. (4) Specify the joint dependence of the two potential outcomes, for example by stating whether they share an error or uniform random variable; their separate marginal distributions alone do not determine the individual-effect distribution.

Clinical Biostats