[R] Simulation from a model fitted by survreg.

Thomas Lumley tlumley at u.washington.edu
Wed Jul 28 17:10:10 CEST 2004


On Wed, 28 Jul 2004, Sixten Borg wrote:

> Dear list,
>
> I would like to simulate individual survival times from a model that has
> been fitted using the survreg procedure (library survival). Output shown
> below.
>
> My plan is to extract the shape and scale arguments for use with
> rweibull() since my error terms are assumed to be Weibull, but it does
> not make any sense. The mean survival time is easy to predict, but I
> would like to simulate individual survival times.
>

It's parametrized differently from rweibull. The linear predictor for the
model is the logarithm of the scale, and the scale parameter from the
model is the reciprocal of the shape.

As with the gamma family you always need to check the parametrisation for
weibull distributions.

	-thomas



> I am probably missing something completely obvious. Any hints or advice
> are appreciated.
>
> Thanks
> Sixten
>
> > summary(mod1)
>
> Call:
> survreg(formula = Surv(tid, study$first.event.death) ~ regim +
>     age + stadium2, data = study, dist = "weibull")
>               Value Std. Error      z        p
> (Intercept) 11.6005     0.7539 15.387 2.01e-53
> regimposto  -0.1350     0.1558 -0.867 3.86e-01
> age         -0.0362     0.0102 -3.533 4.11e-04
> stadium2ii  -0.0526     0.2794 -0.188 8.51e-01
> Log(scale)  -0.5148     0.1116 -4.615 3.93e-06
>
> Scale= 0.598
>
> Weibull distribution
> Loglik(model)= -680.7   Loglik(intercept only)= -689.2
>         Chisq= 16.87 on 3 degrees of freedom, p= 0.00075
> Number of Newton-Raphson Iterations: 8
> n=1183 (4 observations deleted due to missing)
>
> > version
>          _
> platform i386-pc-mingw32
> arch     i386
> os       mingw32
> system   i386, mingw32
> status
> major    1
> minor    8.1
> year     2003
> month    11
> day      21
> language R
> >
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
>

Thomas Lumley			Assoc. Professor, Biostatistics
tlumley at u.washington.edu	University of Washington, Seattle




More information about the R-help mailing list