7 Simulation

7.1 Simulating a trial

[allowframebreaks] Simulation is a powerful tool at a statisticians disposal and can be incredibly useful when it comes to understanding complex designs.

Let us consider a simple Phase III trial comparing a new treatment T1 with a control T0.

This trial will test the one sided hypothesis

H0:μ0μ1 vs. H1:μ0<μ1

or where θ=μ1-μ0

H0:θ0 vs. H1:θ>0.

We may consider simulating many aspects of the trial by understanding the random variables involved. Let us examine those related to efficacy.

Randomisation
A patient is assigned to a group

G={1 patient assigned toT10 patient assigned toT0

Suppose a patient is assigned to T1 with probability p then

Gbern(p)

Patient observations

Based on the form of the data we may assume observations on each treatment are iid and follow some known distribution, for example:

  • Patients on T1

    XiN(μ1,σ2) for i=1,,n1
  • Patients on T0

    YiN(μ0,σ2) for i=1,,n0

We may find summary statistics for T1 and T0

X¯=1n1Σi=1n1Xi
Y¯=1n0Σi=1n0Yi,

from which we may construct our hypothesis test based on θ^=X¯-Y¯ in the usual way.

7.2 Summarise the trial

[allowframebreaks,fragile] Rather than simulating just a single realisation of a trial, we are typically more interested in using simulation to understand characteristics of a proposed procedure. Suppose

R={1 reject H00 Fail to reject H0,

simulate m realisations of the trial record the results Ri for i=1,,m then we estimate the probability of rejecting H0 by

1mΣi=1mRi

Comments on reliability of this?

It is impractical to simulate the whole trial each time, instead we make use of the summary statistics.

For example, the number of patients assigned to T1 is

n1Bin(n,p)

and hence the number of patients to T0 is determined

n0=n-n1.

From this we know

θ^N(θ,σ2n1+σ2n0)

This allows far easier simulation of the trial.

Assume the randomisation will give us known allocation to each treatment group, and we reject H0 when θ^>k.

The following R code would simulate to find the probability of rejecting H0

#given variables
theta
sd
m
k

#simulate trial
thetahat = rnorm(m,theta,sd)
mean(thetahat>k)

7.3 Further uses for simulation

[allowframebreaks] We have seen one very simple simulation study however simulation would typically be used on much more complex problems where an analytic solution is not possible. In this setting it may be used to answer many other questions.

  • Evaluation of statistical methods

  • complex trial design

  • optimisation of adaptive methods

  • understanding the impact of protocol deviation

  • Bayesian methods (a key part of MCMC)

Further reading Morris, T. P., White, I. R., & Crowther, M. J. (2019). Using simulation studies to evaluate statistical methods. Statistics in medicine, 38(11), 2074-2102.