Signature
T = beta * (-log(U))^(1 / gamma)
| Inputs | Definition | Unit |
|---|---|---|
beta | Scale of the Weibull distribution, the time by which about 63.2% of patients have had the event | time, for example years |
U | Random number drawn from a uniform distribution between 0 and 1, excluding 0 | no unit |
gamma | Shape of the Weibull distribution; 1 gives the exponential | no unit, greater than zero |
T | Simulated time to the event for one patient | time, in the unit of beta |
|---|
Function
Event time sampling function
Maps a uniform random number and a fitted time-to-event distribution to a sampled time to the next event for one simulated patient. The sampled time is the value at which the survival function equals the random number, so repeated draws reproduce the fitted distribution. The simulation clock then advances to the earliest scheduled event.
Implementations
Excel
Weibull time to event in one cell
Excel samples from named cells holding the scale and shape parameters.
=Scale*(-LN(1-RAND()))^(1/Shape)
Assumptions
Weibull parameterisation stated
beta and gamma follow the survival function S(t) = exp(-(t/beta)^gamma). Fitted parameters reported in another parameterisation are converted first.
Sampling from time zero
The formula samples a time from the origin of the fitted curve. Sampling a remaining time for a patient who has already survived to time a, with a rising or falling hazard, requires sampling conditional on survival to a.
Worked examples
Rising hazard with shape 1.5
With U of 0.30, a scale of 10 years and a shape of 1.5, the sampled time is about 11.3173 years. The fitted survival function at that time equals 0.30.
U = 0.30; beta = 10; gamma = 1.5; T = 11.3173
Shape of 1 reduces to the exponential
With the same draw and scale and a shape of 1, the sampled time is about 12.0397 years, identical to the exponential formula with a hazard of 0.10 per year.
U = 0.30; beta = 10; gamma = 1; T = 12.0397
Common errors
Swapping the shape and scale parameters
Entering the scale of 10 as the shape and the shape of 1.5 as the scale gives a time of about 1.53 years instead of 11.3173 for the same draw, and a distribution with a very different hazard.
Sampling a remaining time from time zero
Resampling a patient's time to an event from the start of the curve after a previous event restarts a rising or falling hazard at its initial value, unless the model deliberately resets the clock.
Sources
Weibull sampling formula in NICE DSU guidance
Davis S, Stevenson M, Tappenden P, Wailoo A. NICE DSU Technical Support Document 15: Cost-effectiveness modelling using patient-level simulation. Sheffield: Decision Support Unit, ScHARR, University of Sheffield; April 2014. Section 4.5, Table 1 (sample from a Weibull with shape alpha and scale beta as beta times minus ln(U) raised to the power 1 divided by alpha).
Generating Weibull survival times for simulation
Bender R, Augustin T, Blettner M. Generating survival times to simulate Cox proportional hazards models. Statistics in Medicine. 2005;24(11):1713-1723.
Canonical Identity
Stable URI · Machine-readable · Resolvable · CC BY 4.0