![Page 1: Simulating simple and complex survival data - Data Analysis and … · 2017-06-03 · Analysis I Weibull proportional hazards model I Flexible parametric model with 5 degrees of freedom](https://reader034.vdocument.in/reader034/viewer/2022042104/5e824fed7acf8d7a30701f71/html5/thumbnails/1.jpg)
Background Example Survival simulation Discussion References
Simulating simple and complex
survival dataStata UK User Group Meeting
Cass Business School11th September 2014
Michael J. Crowther
Department of Health SciencesUniversity of Leicester, [email protected]
Michael J. Crowther Survival simulation 26th March 2013 1 / 29
![Page 2: Simulating simple and complex survival data - Data Analysis and … · 2017-06-03 · Analysis I Weibull proportional hazards model I Flexible parametric model with 5 degrees of freedom](https://reader034.vdocument.in/reader034/viewer/2022042104/5e824fed7acf8d7a30701f71/html5/thumbnails/2.jpg)
Background Example Survival simulation Discussion References
Outline
1. Background
2. Motivating dataset
3. Simulating survival times from standard distributions
4. A general algorithm for generating survival times
5. Discussion
Michael J. Crowther Survival simulation 26th March 2013 2 / 29
![Page 3: Simulating simple and complex survival data - Data Analysis and … · 2017-06-03 · Analysis I Weibull proportional hazards model I Flexible parametric model with 5 degrees of freedom](https://reader034.vdocument.in/reader034/viewer/2022042104/5e824fed7acf8d7a30701f71/html5/thumbnails/3.jpg)
Background Example Survival simulation Discussion References
Background
I Simulation studies are conducted to assess theperformance of current and novel statistical models inpre-defined scenarios
I Guidelines for the reporting of simulation studies inmedical research have been published (Burton et al.,2006)
I Many simulation studies involving survival data use theexponential or Weibull models
I Often in clinical trials and population based studies, atleast one turning point in the baseline hazard function isobserved
Michael J. Crowther Survival simulation 26th March 2013 3 / 29
![Page 4: Simulating simple and complex survival data - Data Analysis and … · 2017-06-03 · Analysis I Weibull proportional hazards model I Flexible parametric model with 5 degrees of freedom](https://reader034.vdocument.in/reader034/viewer/2022042104/5e824fed7acf8d7a30701f71/html5/thumbnails/4.jpg)
Background Example Survival simulation Discussion References
Motivating dataset
I webuse brcancer
I 686 women diagnosed with breast cancer in Germany
I 246 were randomised to receive hormonal therapy and440 to receive a placebo
I Outcome of interest is recurrence-free survival, with 299patients experiencing the event
Analysis
I Weibull proportional hazards model
I Flexible parametric model with 5 degrees of freedom
I Treatment included in both models
Michael J. Crowther Survival simulation 26th March 2013 4 / 29
![Page 5: Simulating simple and complex survival data - Data Analysis and … · 2017-06-03 · Analysis I Weibull proportional hazards model I Flexible parametric model with 5 degrees of freedom](https://reader034.vdocument.in/reader034/viewer/2022042104/5e824fed7acf8d7a30701f71/html5/thumbnails/5.jpg)
Background Example Survival simulation Discussion References
Fitted survival functions
0.2
0.4
0.6
0.8
1.0
Sur
viva
l pro
babi
lity
0 2 4 6 8Follow-up (years)
Weibull model
0.2
0.4
0.6
0.8
1.0
Sur
viva
l pro
babi
lity
0 2 4 6 8Follow-up (years)
Flexible parametric model
KM, no therapy Predicted survival, no therapyKM, hormonal therapy Predicted survival, hormonal therapy
Michael J. Crowther Survival simulation 26th March 2013 5 / 29
![Page 6: Simulating simple and complex survival data - Data Analysis and … · 2017-06-03 · Analysis I Weibull proportional hazards model I Flexible parametric model with 5 degrees of freedom](https://reader034.vdocument.in/reader034/viewer/2022042104/5e824fed7acf8d7a30701f71/html5/thumbnails/6.jpg)
Background Example Survival simulation Discussion References
Fitted hazard functions
0.00
0.05
0.10
0.15
0.20
0.25
Haz
ard
rate
0 2 4 6 8Follow-up (years)
Weibull model
0.00
0.05
0.10
0.15
0.20
0.25
Haz
ard
rate
0 2 4 6 8Follow-up (years)
Flexible parametric model
Predicted hazard, no therapyPredicted hazard, hormonal therapy
Michael J. Crowther Survival simulation 26th March 2013 6 / 29
![Page 7: Simulating simple and complex survival data - Data Analysis and … · 2017-06-03 · Analysis I Weibull proportional hazards model I Flexible parametric model with 5 degrees of freedom](https://reader034.vdocument.in/reader034/viewer/2022042104/5e824fed7acf8d7a30701f71/html5/thumbnails/7.jpg)
Background Example Survival simulation Discussion References
Simulating survival times
Bender et al. (2005) provided a simple and efficient method tosimulate survival times from standard parametric distributions
h(t|X ) = h0(t) exp(Xβ), H(t|X ) = H0(t) exp(Xβ)
S(t|X ) = exp[−H(t|X )], F (t|X ) = 1− exp[−H(t|X )]
Michael J. Crowther Survival simulation 26th March 2013 7 / 29
![Page 8: Simulating simple and complex survival data - Data Analysis and … · 2017-06-03 · Analysis I Weibull proportional hazards model I Flexible parametric model with 5 degrees of freedom](https://reader034.vdocument.in/reader034/viewer/2022042104/5e824fed7acf8d7a30701f71/html5/thumbnails/8.jpg)
Background Example Survival simulation Discussion References
If we let T be the simulated survival time
F (T |X ) = 1− exp[−H(T |X )] = u, where u ∼ U(0, 1)
andS(T |X ) = 1− u (or equivalently = u)
This can then simply be re-arranged and solved for T
T = H−10 [− log(u) exp(−Xβ)]
Michael J. Crowther Survival simulation 26th March 2013 8 / 29
![Page 9: Simulating simple and complex survival data - Data Analysis and … · 2017-06-03 · Analysis I Weibull proportional hazards model I Flexible parametric model with 5 degrees of freedom](https://reader034.vdocument.in/reader034/viewer/2022042104/5e824fed7acf8d7a30701f71/html5/thumbnails/9.jpg)
Background Example Survival simulation Discussion References
For example in Stata
. //simulate 1000 survival times
. set obs 1000obs was 0, now 1000
. //set seed for reproducibility
. set seed 398894
. //get uniform draws, representing centiles
. gen u = runiform()
. //geenrated a binary treatment group indicator
. gen treatment = runiform()>0.5
. //Weibull baseline parameters
. local lambda = 0.1
. local gamma = 1.2
. //treatment effect
. local loghr = 0.7
. //simulate survival times from Weibull PH model
. gen stimes = (-log(u)/(`lambda´*exp(`loghr´*treatment)))^(1/`gamma´)
Michael J. Crowther Survival simulation 26th March 2013 9 / 29
![Page 10: Simulating simple and complex survival data - Data Analysis and … · 2017-06-03 · Analysis I Weibull proportional hazards model I Flexible parametric model with 5 degrees of freedom](https://reader034.vdocument.in/reader034/viewer/2022042104/5e824fed7acf8d7a30701f71/html5/thumbnails/10.jpg)
Background Example Survival simulation Discussion References
survsim (from SSC)
survsim newvarname1 [newvarname2 ] [, options ]
I distribution(exp|gomp|weib)
I lambda(#), gamma(#)
I covariates(varname # [varname #] ...)
I tde(varname # [varname #] ...)
I maxtime(#)
. survsim stime event, dist(weib) lambda(0.1)
> gamma(1.2) cov(treatment 0.7)
Michael J. Crowther Survival simulation 26th March 2013 10 / 29
![Page 11: Simulating simple and complex survival data - Data Analysis and … · 2017-06-03 · Analysis I Weibull proportional hazards model I Flexible parametric model with 5 degrees of freedom](https://reader034.vdocument.in/reader034/viewer/2022042104/5e824fed7acf8d7a30701f71/html5/thumbnails/11.jpg)
Background Example Survival simulation Discussion References
Recent use of survival simulation
I Paul Lambert and I recently proposed a generalparametric framework for survival analysis, implementedin stgenreg (Crowther and Lambert, 2013b, 2014)
I Reviews raised questions about benefits/pitfalls comparedto the Cox model
I We set out to compare the efficiency of the Kaplan-Meierestimate of survival with a parametric function usingsplines, when data is sparse in the right tail
Michael J. Crowther Survival simulation 26th March 2013 11 / 29
![Page 12: Simulating simple and complex survival data - Data Analysis and … · 2017-06-03 · Analysis I Weibull proportional hazards model I Flexible parametric model with 5 degrees of freedom](https://reader034.vdocument.in/reader034/viewer/2022042104/5e824fed7acf8d7a30701f71/html5/thumbnails/12.jpg)
Background Example Survival simulation Discussion References
Core of simulation program
. //simulate from a Weibull distribution
. survsim stime died, lambda(0.2) gamma(1.3) maxt(5)
. //censoring times
. gen cens = runiform()*6
. replace died = 0 if cens<stime
. replace stime = cens if cens<stime
. stset stime, f(died=1)
. //KM estimate
. sts gen s1 = s sells = se(lls) lb = lb(s) ub = ub(s)
. //Fit parametric model
. stgenreg, loghaz([xb]) xb(#rcs(df(3)))
. //Get predicted survival at 4 and 5 years
. range t45 4 5 2
. predict surv, survival timevar(t45) ci
Michael J. Crowther Survival simulation 26th March 2013 12 / 29
![Page 13: Simulating simple and complex survival data - Data Analysis and … · 2017-06-03 · Analysis I Weibull proportional hazards model I Flexible parametric model with 5 degrees of freedom](https://reader034.vdocument.in/reader034/viewer/2022042104/5e824fed7acf8d7a30701f71/html5/thumbnails/13.jpg)
Background Example Survival simulation Discussion References
Results
Table : Bias and mean squared error of log(− log(S(t))) at 4 and5 years.
Time Kaplan-Meier Parametric model
4 yearsBias -0.0019 -0.0038
MSE 0.1251 0.1100
5 yearsBias 0.0066 0.0063
MSE 0.1565 0.1481
Median # events = 101Median # events in final year = 5
Michael J. Crowther Survival simulation 26th March 2013 13 / 29
![Page 14: Simulating simple and complex survival data - Data Analysis and … · 2017-06-03 · Analysis I Weibull proportional hazards model I Flexible parametric model with 5 degrees of freedom](https://reader034.vdocument.in/reader034/viewer/2022042104/5e824fed7acf8d7a30701f71/html5/thumbnails/14.jpg)
Background Example Survival simulation Discussion References
Results
Table : Bias and mean squared error of log(− log(S(t))) at 4 and5 years.
Time Kaplan-Meier Parametric model
4 yearsBias -0.0019 -0.0038
MSE 0.1251 0.1100
5 yearsBias 0.0066 0.0063
MSE 0.1565 0.1481
Median # events = 101Median # events in final year = 5
Michael J. Crowther Survival simulation 26th March 2013 13 / 29
![Page 15: Simulating simple and complex survival data - Data Analysis and … · 2017-06-03 · Analysis I Weibull proportional hazards model I Flexible parametric model with 5 degrees of freedom](https://reader034.vdocument.in/reader034/viewer/2022042104/5e824fed7acf8d7a30701f71/html5/thumbnails/15.jpg)
Background Example Survival simulation Discussion References
Results
Table : Bias and mean squared error of log(− log(S(t))) at 4 and5 years.
Time Kaplan-Meier Parametric model
4 yearsBias -0.0019 -0.0038
MSE 0.1251 0.1100
5 yearsBias 0.0066 0.0063
MSE 0.1565 0.1481
Median # events = 101Median # events in final year = 5
Michael J. Crowther Survival simulation 26th March 2013 13 / 29
![Page 16: Simulating simple and complex survival data - Data Analysis and … · 2017-06-03 · Analysis I Weibull proportional hazards model I Flexible parametric model with 5 degrees of freedom](https://reader034.vdocument.in/reader034/viewer/2022042104/5e824fed7acf8d7a30701f71/html5/thumbnails/16.jpg)
Background Example Survival simulation Discussion References
Benefits of the Bender et al. (2005) approach
I Extremely easy to implement
I Quite often we simulate survival times and then applyCox models − > baseline hazard from which we simulateis irrelevent
I What if we wish to simulate from a more complex andbiologically plausible underlying hazard function?
I There is a growing interest in parametric survival models(Royston and Lambert, 2011; Crowther and Lambert,2014)
Michael J. Crowther Survival simulation 26th March 2013 14 / 29
![Page 17: Simulating simple and complex survival data - Data Analysis and … · 2017-06-03 · Analysis I Weibull proportional hazards model I Flexible parametric model with 5 degrees of freedom](https://reader034.vdocument.in/reader034/viewer/2022042104/5e824fed7acf8d7a30701f71/html5/thumbnails/17.jpg)
Background Example Survival simulation Discussion References
Limitations with simulating survival times from
standard distributions with proportional hazards
T = H−10 [− log(u) exp(−Xβ)]
I Must be able to integrate the hazard function in order tocalculate the cumulative hazard function
I We then must be able to invert the cumulative hazardfunction to obtain the simulated survival time
Michael J. Crowther Survival simulation 26th March 2013 15 / 29
![Page 18: Simulating simple and complex survival data - Data Analysis and … · 2017-06-03 · Analysis I Weibull proportional hazards model I Flexible parametric model with 5 degrees of freedom](https://reader034.vdocument.in/reader034/viewer/2022042104/5e824fed7acf8d7a30701f71/html5/thumbnails/18.jpg)
Background Example Survival simulation Discussion References
Simulating from a more complex baseline hazard
function
We can use a mixture of parametric distributions
S0(t) = pS01(t) + (1− p)S02(t) (1)
For example a 2-component mixture Weibull
S0(t) = p exp(−λ1tγ1) + (1− p) exp(−λ2tγ2) (2)
with 0 ≤ p ≤ 1, and λ1, λ2, γ1, γ2 > 0
Michael J. Crowther Survival simulation 26th March 2013 16 / 29
![Page 19: Simulating simple and complex survival data - Data Analysis and … · 2017-06-03 · Analysis I Weibull proportional hazards model I Flexible parametric model with 5 degrees of freedom](https://reader034.vdocument.in/reader034/viewer/2022042104/5e824fed7acf8d7a30701f71/html5/thumbnails/19.jpg)
Background Example Survival simulation Discussion References
0.5
11.
5H
azar
d fu
nctio
n
0 2 4 6 8 10Follow−up time
λ1 = 1, γ1 = 1.5, λ2 = 1,γ2 = 0.5, p = 0.5
0.5
11.
5H
azar
d fu
nctio
n
0 2 4 6 8 10Follow−up time
λ1 = 0.1, γ1 = 3, λ2 = 0.1,γ2 = 1.6, p = 0.80
.51
1.5
Haz
ard
func
tion
0 2 4 6 8 10Follow−up time
λ1 = 1.4, γ1 = 1.3, λ2 = 0.1,γ2 = 0.5, p = 0.9
0.5
11.
5H
azar
d fu
nctio
n
0 2 4 6 8 10Follow−up time
λ1 = 1.5, γ1 = 0.2, λ2 = 0.5,γ2 = 0.1, p = 0.1
Michael J. Crowther Survival simulation 26th March 2013 17 / 29
![Page 20: Simulating simple and complex survival data - Data Analysis and … · 2017-06-03 · Analysis I Weibull proportional hazards model I Flexible parametric model with 5 degrees of freedom](https://reader034.vdocument.in/reader034/viewer/2022042104/5e824fed7acf8d7a30701f71/html5/thumbnails/20.jpg)
Background Example Survival simulation Discussion References
Incorporating proportional hazards gives us a survival function
S(t) = [p exp(−λ1tγ1) + (1− p) exp(−λ2tγ2)]exp(Xβ) (3)
This model is implemented in the stmix command from SSC.Attempting to apply the inversion method, gives
S(t) = u, where u ∼ U(0, 1) (4)
which cannot be re-arranged to directly solve for t.
To solve we can apply iterative root finding techniques, suchas Newton-Raphson iterations, or Brent’s univariate rootfinder. I favour the latter, using mm root() from Ben Jann’smoremata (Jann, 2005)
Michael J. Crowther Survival simulation 26th March 2013 18 / 29
![Page 21: Simulating simple and complex survival data - Data Analysis and … · 2017-06-03 · Analysis I Weibull proportional hazards model I Flexible parametric model with 5 degrees of freedom](https://reader034.vdocument.in/reader034/viewer/2022042104/5e824fed7acf8d7a30701f71/html5/thumbnails/21.jpg)
Background Example Survival simulation Discussion References
survsim
survsim newvarname1 [newvarname2 ] [, options ]
I mixture
I distribution(exp|gomp|weib)
I lambdas(#), gammas(#)
I covariates(varname # [varname #] ...)
I maxtime(#)
. survsim stime event, mixture dist(weib)
> lambdas(0.1 0.2) gammas(1.2 0.5) p(0.3)
Michael J. Crowther Survival simulation 26th March 2013 19 / 29
![Page 22: Simulating simple and complex survival data - Data Analysis and … · 2017-06-03 · Analysis I Weibull proportional hazards model I Flexible parametric model with 5 degrees of freedom](https://reader034.vdocument.in/reader034/viewer/2022042104/5e824fed7acf8d7a30701f71/html5/thumbnails/22.jpg)
Background Example Survival simulation Discussion References
Simulating survival times when the cumulative
hazard doesn’t have a closed form expression -
joint model data
h(t) = h0(t) exp [Xβ + αm(t)]
wherem(t) = β0i + β1i t
I To obtain the cumulative hazard function we requirenumerical integration
I We then require root finding techniques to solve for thesimulated survival time, t
Michael J. Crowther Survival simulation 26th March 2013 20 / 29
![Page 23: Simulating simple and complex survival data - Data Analysis and … · 2017-06-03 · Analysis I Weibull proportional hazards model I Flexible parametric model with 5 degrees of freedom](https://reader034.vdocument.in/reader034/viewer/2022042104/5e824fed7acf8d7a30701f71/html5/thumbnails/23.jpg)
Background Example Survival simulation Discussion References
Numerical integration
∫ 1
−1
g(x)dx =
∫ 1
−1
W (x)g(x)dx ≈m∑i=1
wig(xi)
where W (x) is a known weighting function and g(x) can beapproximated by a polynomial function.∫ ti
t0i
h(x)dx =ti − t0i
2
∫ 1
−1
h
(ti − t0i
2x +
t0i + ti2
)dx
≈ ti − t0i2
m∑i=1
wih
(ti − t0i
2xi +
t0i + ti2
)
Michael J. Crowther Survival simulation 26th March 2013 21 / 29
![Page 24: Simulating simple and complex survival data - Data Analysis and … · 2017-06-03 · Analysis I Weibull proportional hazards model I Flexible parametric model with 5 degrees of freedom](https://reader034.vdocument.in/reader034/viewer/2022042104/5e824fed7acf8d7a30701f71/html5/thumbnails/24.jpg)
Background Example Survival simulation Discussion References
survsim
survsim newvarname1 [newvarname2 ] [, options ]
I [log]hazard()
I [log]cumhazard()
I nodes(#)
I covariates(varname # [varname #] ...)
I tde(varname # [varname #] ...)
I tdefunction()
I centol(#)
I maxtime(#)
. survsim stime event, hazard(0.1:*1.2:*t:̂(1.1:-1))
Michael J. Crowther Survival simulation 26th March 2013 22 / 29
![Page 25: Simulating simple and complex survival data - Data Analysis and … · 2017-06-03 · Analysis I Weibull proportional hazards model I Flexible parametric model with 5 degrees of freedom](https://reader034.vdocument.in/reader034/viewer/2022042104/5e824fed7acf8d7a30701f71/html5/thumbnails/25.jpg)
Background Example Survival simulation Discussion References
Simulating survival data - recap
Does H0(t) have a closed form expression?
Can you solve for T analytically?
(1) Apply method of Bender et. al. (2005)
(2) Use iterative root finding to solve for simulated time, T
(3) Numerically integrate to obtain
H0(t), within iterative root finding to solve
for T
Yes Yes
No No
Figure : Schematic flow diagram of simulation techniques
Crowther and Lambert (2012)
Michael J. Crowther Survival simulation 26th March 2013 23 / 29
![Page 26: Simulating simple and complex survival data - Data Analysis and … · 2017-06-03 · Analysis I Weibull proportional hazards model I Flexible parametric model with 5 degrees of freedom](https://reader034.vdocument.in/reader034/viewer/2022042104/5e824fed7acf8d7a30701f71/html5/thumbnails/26.jpg)
Background Example Survival simulation Discussion References
General survival simulation
Given a well-defined hazard function, h(t), this two-stagealgorithm involving
1. Numerical integration
2. Root-finding
provides a framework for general survival simulation which canincorporate:
I Practically any user-defined baseline hazard function
I Time-varying covariates
I Time-dependent effects
I Delayed entry
I Extends to competing risks, frailty etc.
Michael J. Crowther Survival simulation 26th March 2013 24 / 29
![Page 27: Simulating simple and complex survival data - Data Analysis and … · 2017-06-03 · Analysis I Weibull proportional hazards model I Flexible parametric model with 5 degrees of freedom](https://reader034.vdocument.in/reader034/viewer/2022042104/5e824fed7acf8d7a30701f71/html5/thumbnails/27.jpg)
Background Example Survival simulation Discussion References
Examples
I Fractional polynomial baseline
survsim stime event, logh(-18 :+
7.3:*log(#t):-11.5:*#t:̂(0.5):*log(#t))
I Non-proportional hazards
survsim stime event, logh(-18 :+
7.3:*log(#t):-11.5:*#t:̂(0.5):*log(#t)) cov(trt -0.7)
tde(trt 1) tdefunc(0.01:*t :+ 0.4:*log(t))
Michael J. Crowther Survival simulation 26th March 2013 25 / 29
![Page 28: Simulating simple and complex survival data - Data Analysis and … · 2017-06-03 · Analysis I Weibull proportional hazards model I Flexible parametric model with 5 degrees of freedom](https://reader034.vdocument.in/reader034/viewer/2022042104/5e824fed7acf8d7a30701f71/html5/thumbnails/28.jpg)
Background Example Survival simulation Discussion References
Examples
I Fractional polynomial baseline
survsim stime event, logh(-18 :+
7.3:*log(#t):-11.5:*#t:̂(0.5):*log(#t))
I Non-proportional hazards
survsim stime event, logh(-18 :+
7.3:*log(#t):-11.5:*#t:̂(0.5):*log(#t)) cov(trt -0.7)
tde(trt 1) tdefunc(0.01:*t :+ 0.4:*log(t))
Michael J. Crowther Survival simulation 26th March 2013 25 / 29
![Page 29: Simulating simple and complex survival data - Data Analysis and … · 2017-06-03 · Analysis I Weibull proportional hazards model I Flexible parametric model with 5 degrees of freedom](https://reader034.vdocument.in/reader034/viewer/2022042104/5e824fed7acf8d7a30701f71/html5/thumbnails/29.jpg)
Background Example Survival simulation Discussion References
ExamplesI Joint model data (time-varying covariate)
. //Simulate 1000 survival times
. set obs 1000
. //Define the association between the biomarker and survival
. local alpha = 0.25
. //Generate the random intercept and random slopes
. gen b0 = rnormal(0,1)
. gen b1 = rnormal(1,0.5)
. survsim stime event, loghazard(-2.3:+2:*#t:-#t:^(2):+0.12:*#t:^3> :+ `alpha´ :* (b0 :+ b1 :* #t)) maxt(5)
. //Generate observed biomarker values at times 0, 1, 2, 3 , 4 years
. gen id = _n
. expand 5
. bys id: gen meastime = _n-1
. //Remove observations after event or censoring time
. bys id: drop if meastime>=stime
. //Generate observed biomarker values incorporating measurement error
. gen response = b0 + b1*meastime + rnormal(0,0.5)
Michael J. Crowther Survival simulation 26th March 2013 26 / 29
![Page 30: Simulating simple and complex survival data - Data Analysis and … · 2017-06-03 · Analysis I Weibull proportional hazards model I Flexible parametric model with 5 degrees of freedom](https://reader034.vdocument.in/reader034/viewer/2022042104/5e824fed7acf8d7a30701f71/html5/thumbnails/30.jpg)
Background Example Survival simulation Discussion References
Practical advice
I Although computation time is often minimal, it may be ofuse to simulate your 1000 datasets, say, before applyingany model fits
I With the numerical integration, it is important to assessthe approximation by setting a seed and using anincreasing number of quadrature points
Michael J. Crowther Survival simulation 26th March 2013 27 / 29
![Page 31: Simulating simple and complex survival data - Data Analysis and … · 2017-06-03 · Analysis I Weibull proportional hazards model I Flexible parametric model with 5 degrees of freedom](https://reader034.vdocument.in/reader034/viewer/2022042104/5e824fed7acf8d7a30701f71/html5/thumbnails/31.jpg)
Background Example Survival simulation Discussion References
Practical advice
I Although computation time is often minimal, it may be ofuse to simulate your 1000 datasets, say, before applyingany model fits
I With the numerical integration, it is important to assessthe approximation by setting a seed and using anincreasing number of quadrature points
Michael J. Crowther Survival simulation 26th March 2013 27 / 29
![Page 32: Simulating simple and complex survival data - Data Analysis and … · 2017-06-03 · Analysis I Weibull proportional hazards model I Flexible parametric model with 5 degrees of freedom](https://reader034.vdocument.in/reader034/viewer/2022042104/5e824fed7acf8d7a30701f71/html5/thumbnails/32.jpg)
Background Example Survival simulation Discussion References
DiscussionI We have described a general framework for the generation
of survival data, incorporating any combination ofcomplex hazard functions, time-dependent effects,time-varying covariates, delayed entry, random effects andcovariates measured with error (Crowther and Lambert,2013a)
I As the procedure relies on numerical integration, it isimportant to establish the consistency of the simulatedsurvival times by setting a seed and using an increasingnumber of quadrature nodes
I You can also specify a user-defined [log] cumulativehazard function (Royston, 2012) (stsurvsim)
I Simulating from a fitted model (or observed censoringdistribution) can be particularly useful (Royston, 2012)
Michael J. Crowther Survival simulation 26th March 2013 28 / 29
![Page 33: Simulating simple and complex survival data - Data Analysis and … · 2017-06-03 · Analysis I Weibull proportional hazards model I Flexible parametric model with 5 degrees of freedom](https://reader034.vdocument.in/reader034/viewer/2022042104/5e824fed7acf8d7a30701f71/html5/thumbnails/33.jpg)
Background Example Survival simulation Discussion References
DiscussionI We have described a general framework for the generation
of survival data, incorporating any combination ofcomplex hazard functions, time-dependent effects,time-varying covariates, delayed entry, random effects andcovariates measured with error (Crowther and Lambert,2013a)
I As the procedure relies on numerical integration, it isimportant to establish the consistency of the simulatedsurvival times by setting a seed and using an increasingnumber of quadrature nodes
I You can also specify a user-defined [log] cumulativehazard function (Royston, 2012) (stsurvsim)
I Simulating from a fitted model (or observed censoringdistribution) can be particularly useful (Royston, 2012)
Michael J. Crowther Survival simulation 26th March 2013 28 / 29
![Page 34: Simulating simple and complex survival data - Data Analysis and … · 2017-06-03 · Analysis I Weibull proportional hazards model I Flexible parametric model with 5 degrees of freedom](https://reader034.vdocument.in/reader034/viewer/2022042104/5e824fed7acf8d7a30701f71/html5/thumbnails/34.jpg)
Background Example Survival simulation Discussion References
DiscussionI We have described a general framework for the generation
of survival data, incorporating any combination ofcomplex hazard functions, time-dependent effects,time-varying covariates, delayed entry, random effects andcovariates measured with error (Crowther and Lambert,2013a)
I As the procedure relies on numerical integration, it isimportant to establish the consistency of the simulatedsurvival times by setting a seed and using an increasingnumber of quadrature nodes
I You can also specify a user-defined [log] cumulativehazard function (Royston, 2012) (stsurvsim)
I Simulating from a fitted model (or observed censoringdistribution) can be particularly useful (Royston, 2012)
Michael J. Crowther Survival simulation 26th March 2013 28 / 29
![Page 35: Simulating simple and complex survival data - Data Analysis and … · 2017-06-03 · Analysis I Weibull proportional hazards model I Flexible parametric model with 5 degrees of freedom](https://reader034.vdocument.in/reader034/viewer/2022042104/5e824fed7acf8d7a30701f71/html5/thumbnails/35.jpg)
Background Example Survival simulation Discussion References
DiscussionI We have described a general framework for the generation
of survival data, incorporating any combination ofcomplex hazard functions, time-dependent effects,time-varying covariates, delayed entry, random effects andcovariates measured with error (Crowther and Lambert,2013a)
I As the procedure relies on numerical integration, it isimportant to establish the consistency of the simulatedsurvival times by setting a seed and using an increasingnumber of quadrature nodes
I You can also specify a user-defined [log] cumulativehazard function (Royston, 2012) (stsurvsim)
I Simulating from a fitted model (or observed censoringdistribution) can be particularly useful (Royston, 2012)
Michael J. Crowther Survival simulation 26th March 2013 28 / 29
![Page 36: Simulating simple and complex survival data - Data Analysis and … · 2017-06-03 · Analysis I Weibull proportional hazards model I Flexible parametric model with 5 degrees of freedom](https://reader034.vdocument.in/reader034/viewer/2022042104/5e824fed7acf8d7a30701f71/html5/thumbnails/36.jpg)
Background Example Survival simulation Discussion References
References I
R. Bender, T. Augustin, and M. Blettner. Generating survival times to simulate Coxproportional hazards models. Stat Med, 24(11):1713–1723, 2005.
A. Burton, D. G. Altman, P. Royston, and R. L. Holder. The design of simulationstudies in medical statistics. Stat Med, 25(24):4279–4292, 2006.
M. J. Crowther and P. C. Lambert. Simulating complex survival data. Stata J, 12(4):674–687, 2012.
M. J. Crowther and P. C. Lambert. Simulating biologically plausible complex survivaldata. Stat Med, 32(23):4118–4134, 2013a.
M. J. Crowther and P. C. Lambert. stgenreg: A Stata package for the generalparametric analysis of survival data. J Stat Softw, 53(12), 2013b.
M. J. Crowther and P. C. Lambert. A general framework for parametric survivalanalysis. Stat Med, In Press, 2014.
B. Jann. MOREMATA: Stata module (Mata) to provide various functions. StatisticalSoftware Components, Boston College Department of Economics, 2005.
P. Royston. Tools to simulate realistic censored survival-time distributions. Stata J, 12(4):639–654, 2012.
P. Royston and P. C. Lambert. Flexible Parametric Survival Analysis Using Stata:Beyond the Cox Model. Stata Press, 2011.
Michael J. Crowther Survival simulation 26th March 2013 29 / 29