Tutorials › Multi-Arm Multi-Stage (MAMS) Designs › Generating Continuous Outcomes Across Arms and Stages

Simulation and Software · Tutorial 428 of 499

Generating Continuous Outcomes Across Arms and Stages

Build and validate participant-level generators for continuous outcomes across treatment arms and stages, including common and stage-specific effects and variances.

Intermediate 12 min read

What You'll Learn

  • Define arm, stage, and participant indices for continuous outcome data.
  • Translate treatment effects and control means into arm-stage outcome means.
  • Generate outcomes with common or arm- and stage-specific variances.
  • Work through participant-level normal outcome generation using standardized draws.
  • Diagnose errors in generated means, variances, sample sizes, and participant records.
  • Distinguish raw-data generation from generating summary statistics or analysis decisions.

Why Generate Outcomes at the Participant Level?

A MAMS simulation needs data that match the trial scenario being studied. For a continuous outcome, this means specifying what an individual participant's outcome would be in each arm and stage, then generating an observation for each participant. A generator that encodes the wrong treatment effect, variance, or stage pattern can produce convincingly formatted data while answering the wrong simulation question.

This tutorial focuses on constructing those participant-level outcomes. It does not determine which arms continue or how interim decisions are made. The generator's job is to create outcomes under a clearly stated model, with each record assigned to the correct arm and stage.

Definition: Let \(j=0\) denote control and \(j=1,\ldots,J\) denote treatment arms. Let \(k=1,\ldots,K\) index stages, and let \(i=1,\ldots,n_{jk}\) index participants in arm \(j\) at stage \(k\). The outcome for participant \(i\) in arm \(j\) and stage \(k\) is \(Y_{ijk}\). A normal-outcome generator specifies the mean \(\mu_{jk}\) and variance \(\sigma_{jk}^2\) for each arm-stage cell, then generates \(Y_{ijk}\sim N(\mu_{jk},\sigma_{jk}^2)\).

The usual model assumes that outcomes are independent across participants and cells, conditional on the specified arm-stage distributions. It also assumes that the normal distribution and its parameters are an adequate representation of the scenario. These are modelling choices, not properties guaranteed by the act of generating random numbers. If participants contribute repeated measurements, are clustered, or are otherwise dependent, the independent model here is not sufficient.

Define the treatment effect at stage \(k\) as \(\Delta_{jk}=\mu_{jk}-\mu_{0k}\). This convention makes a positive effect mean a higher average outcome in treatment than control. If lower outcomes are beneficial, the effect can still be defined this way, but the direction of benefit must be stated separately. A common scenario has a shared control mean across stages and a treatment effect that does not change by stage; more general scenarios can specify separate means for each cell.

From Scenario Parameters to Participant Outcomes

For a common control mean \(\mu_0\) and a treatment effect \(\Delta_j\) that is constant over stages, set \(\mu_{0k}=\mu_0\) and \(\mu_{jk}=\mu_0+\Delta_j\). If the effect varies by stage, use \(\mu_{jk}=\mu_{0k}+\Delta_{jk}\). Variances can likewise be common, arm-specific, stage-specific, or fully arm-stage-specific, provided each value is positive.

$$ Y_{ijk}=\mu_{jk}+\sigma_{jk}Z_{ijk}, \qquad Z_{ijk}\sim N(0,1) $$

This representation is a direct way to construct the outcomes: generate an independent standard normal draw \(Z_{ijk}\) for every participant and transform it using that cell's mean and standard deviation. The standard deviation is \(\sigma_{jk}\), not the variance \(\sigma_{jk}^2\). For example, a cell with variance \(100\) uses a multiplier of \(10\).

1
Write the scenario.
Specify the control mean, treatment effects, variances, and participant counts by arm and stage. State the outcome units and which direction is beneficial.
2
Construct cell means.
Convert effects into means using \(\mu_{jk}=\mu_{0k}+\Delta_{jk}\). Check that every treatment effect is defined relative to the control mean at the same stage.
3
Generate one outcome per participant.
For each arm-stage cell, generate \(n_{jk}\) independent standard normal draws and transform each using that cell's mean and standard deviation.
4
Check the generated records.
Verify the cell counts, labels, and parameter settings. Across repeated simulated data sets, check that cell averages and variances behave consistently with the specified model.

Worked Examples

Worked Example: Three Arms With a Common Effect Across Stages

Suppose a hypothetical two-stage trial has a continuous outcome measured in points, with higher values designated as better. The control mean is \(50\) points and its standard deviation is \(10\) points. Treatment A has a constant effect of \(+5\) points, and treatment B has an effect of \(0\). There are three participants in each arm at each stage, and all cells have the same standard deviation.

The cell means are \(\mu_{0k}=50\), \(\mu_{1k}=50+5=55\), and \(\mu_{2k}=50+0=50\) for both stages. For every participant, generate \(Y_{ijk}=\mu_{jk}+10Z_{ijk}\), with independent standard normal draws. For example, in stage 1, control draws \(Z=(-1,0,1)\) produce outcomes \(50+10(-1)=40\), \(50+10(0)=50\), and \(50+10(1)=60\) points.

If the stage 1 draws for A are \((-0.5,0,0.5)\), the generated outcomes are \(55+10(-0.5)=50\), \(55+10(0)=55\), and \(55+10(0.5)=60\). Their observed mean is \((50+55+60)/3=55\) points, so the observed A-minus-control difference is \(55-50=5\) points. This agrees with the specified effect in this particular set of draws; it is not guaranteed to do so in every simulated data set.

For stage 2, generate a new set of draws for its participants. For instance, control draws \((-0.8,0.4,1.1)\) give outcomes \(42,54,61\), with mean \(157/3=52.33\) points. These differ from the control mean of \(50\) because of sampling variation. Stage 2 participants are separate records, not copies of the stage 1 outcomes.

Worked Example: Unequal Variances and Cell Sizes

Consider a hypothetical study with a control mean of \(100\) units. Treatment A has mean \(108\) and standard deviation \(15\); treatment B has mean \(104\) and standard deviation \(9\). Control has standard deviation \(12\). At stage 1, the cell sizes are \(n_{01}=4\), \(n_{11}=3\), and \(n_{21}=2\). The model allows different variances by arm, so the correct generator uses the standard deviation belonging to each arm.

For control, use \(Y_{i01}=100+12Z_{i01}\). The hypothetical draws \((-1,0,1,2)\) yield \(88,100,112,124\) units. Their mean is \(424/4=106\) units. For A, use \(Y_{i11}=108+15Z_{i11}\). Draws \((-0.5,0,1)\) yield \(100.5,108,123\), with mean \(331.5/3=110.5\) units.

For B, use \(Y_{i21}=104+9Z_{i21}\). Draws \((-1,1)\) yield \(95,113\), with mean \(104\) units. The observed A-minus-control mean difference is \(110.5-106=4.5\) units, and the observed B-minus-control difference is \(104-106=-2\) units. These observed differences need not equal the specified differences of \(8\) and \(4\) units: finite samples fluctuate around the scenario means.

The cell sizes are also part of the generator. Generating four A records instead of three would change the simulated design, even if the outcome formula were otherwise correct. Each record should retain its stage and arm labels so it can be checked against the intended cell counts.

Worked Example: Stage-Specific Effects and Variances

A hypothetical two-stage scenario has a control mean of \(20\) points in stage 1 and \(22\) points in stage 2. Control standard deviations are \(4\) and \(5\) points, respectively. Treatment A improves the mean by \(3\) points in stage 1 and by \(1\) point in stage 2. Its standard deviations are \(6\) and \(7\) points. There are two participants per arm per stage.

The treatment means are \(\mu_{11}=20+3=23\) and \(\mu_{12}=22+1=23\) points. In stage 1, control standard-normal draws \((-1,1)\) give outcomes \(20+4(-1)=16\) and \(20+4(1)=24\), with mean \(20\). Treatment draws \((0,1)\) give \(23+6(0)=23\) and \(23+6(1)=29\), with mean \(26\). The observed difference is \(26-20=6\) points, while the specified treatment effect is \(3\) points.

In stage 2, control draws \((-0.5,0.5)\) give \(22+5(-0.5)=19.5\) and \(22+5(0.5)=24.5\), with mean \(22\). Treatment draws \((-1,1)\) give \(23+7(-1)=16\) and \(23+7(1)=30\), with mean \(23\). The observed difference is \(23-22=1\) point, matching the specified stage 2 effect for these draws. This example illustrates why an effect and variance should be assigned to the correct stage rather than silently reusing one setting everywhere.

Why the Generator Has the Intended Mean and Variance

The transformation \(Y_{ijk}=\mu_{jk}+\sigma_{jk}Z_{ijk}\) preserves the specified distribution because a standard normal variable has mean \(0\) and variance \(1\). Linearity of expectation and the variance rule for a constant multiple give:

$$ E(Y_{ijk})=\mu_{jk}+\sigma_{jk}E(Z_{ijk})=\mu_{jk}, \qquad \operatorname{Var}(Y_{ijk})=\sigma_{jk}^2\operatorname{Var}(Z_{ijk})=\sigma_{jk}^2. $$

Thus the generator targets the intended cell mean and variance. For \(n_{jk}\) independent participants in one cell, the sample mean \(\bar{x}\) has expectation \(\mu_{jk}\) and variance \(\sigma_{jk}^2/n_{jk}\). This follows because the expectation of an average is the average of the expectations, and the variance of a sum of independent outcomes is the sum of their variances. Therefore, small generated samples can have cell means far from their targets without indicating a coding error.

For independent treatment and control samples at one stage, the difference in sample means has expected value \(\Delta_{jk}\) and variance \(\sigma_{jk}^2/n_{jk}+\sigma_{0k}^2/n_{0k}\). The first statement follows by subtracting the two expected sample means. The second follows by adding their variances, since the two samples are independent. This provides a useful check on the scale of variation in simulated differences; it does not require each individual replicate's difference to equal the target effect.

Implementation Checks and Common Failure Modes

Before using generated data, inspect both the construction and its repeated-simulation behaviour. A few checks are exact: the number of records in each cell must equal \(n_{jk}\), all outcomes must use the correct arm-stage parameters, and participant identifiers must not accidentally duplicate records. Other checks are statistical: over many independent data sets, the average cell mean should approach \(\mu_{jk}\), and the variation within a cell should be compatible with \(\sigma_{jk}^2\). These empirical checks are noisy, especially for small samples or few replicates.

  • Using a variance as a standard deviation. If the intended variance is \(100\), multiplying standard normal draws by \(100\) creates a variance of \(10{,}000\). Use \(\sigma=10\) in the transformation.
  • Applying the treatment effect with the wrong sign. Under the convention here, \(\Delta_{jk}=\mu_{jk}-\mu_{0k}\). A positive effect raises the mean. Confirm that this matches the chosen beneficial direction.
  • Applying one stage's parameters to every stage unintentionally. Explicitly construct and check each arm-stage mean and standard deviation, even when some are equal.
  • Copying control records into multiple treatment comparisons. A stage's control participants are one set of participants with unique outcomes. Do not create duplicate versions of them merely to represent comparisons with different treatment arms.
  • Resampling participants when assembling accumulated data. A participant's generated outcome should remain the same record wherever that participant appears in a later data set. Add new stage participants as new records rather than regenerating earlier observations.

There are alternatives to generating individual outcomes. Under the independent normal model, some calculations can be made from simulated sample means and their known standard errors, which may be faster when only summary statistics are needed. But that approach does not provide participant records for checking data assembly or analyses that require individual observations. Direct normal generation is transparent and flexible for the model stated here; it is not suitable if the actual scenario requires skewness, censoring, repeated measures, or dependence that the model omits.

Key takeaway: A continuous-outcome generator is defined by its arm-stage means, variances, participant counts, and dependence assumptions. Generate one correctly labelled outcome per participant, and validate both the exact record structure and the approximate distribution across repeated data sets.

Check Your Understanding

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

  1. Under the convention \(\Delta_{jk}=\mu_{jk}-\mu_{0k}\), what mean should be assigned to treatment arm \(j\) if the stage-specific control mean is \(40\) and the treatment effect is \(-3\)?
  2. A normal outcome has variance \(49\). What standard deviation should multiply a standard normal draw in the participant-level generator?
  3. Why can a generated treatment-control difference in one replicate differ from the specified treatment effect, even when the generator is correct?
  4. A stage has 12 control participants and two treatment arms. Should the same 12 control outcomes be copied into separate records for each comparison? Explain.

Solutions. (1) The treatment mean is \(40+(-3)=37\). (2) The standard deviation is \(\sqrt{49}=7\). (3) The observed difference varies because the participant outcomes are random; the specified effect is the difference between population means, not a requirement on each sample. (4) No. Generate one set of 12 control records and retain their unique identities; duplicating them as new participants would misrepresent the data. Comparisons can refer to that same control group without creating extra control observations.

Clinical Biostats