[R] Simulation from a model fitted by survreg.
spencer.graves at pdf.com
Wed Jul 28 16:15:45 CEST 2004
Please check the documentation, e.g., Venables and Ripley (2002)
Modern Applied Statistics with S, p. 360. The Weibull shape parameter
is the reciprocal of the scale parameter 0.598 in your printout, so
shape = 1/0.598 = 1.672; see also Meeker & Escobar (1998) Statistical
Methods for Reliability Data (Wiley).
Does this answer the question? You can get coefficients with
coef(mod1). Also, have you looked at attributes(summary(mod1))? If
"mod1" follows the old S3 standard, attributes may give you a list of
names you can access via summary(mod1)$whateverthenameis (or via
summary(mod1)[["whateverthenameis"]]). If "mod1" follows the new S4
standard, then getSlots(mod1) and getSlots(summary(mod1)) will give you
the names of the slots and their classes, which can then be accessed via
mod1 at nameofslotofinterest. Sorry, I don't have time to construct an
example myself, but I've done this kind of thing many times.
hope this helps.
Sixten Borg wrote:
>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.
>I am probably missing something completely obvious. Any hints or advice are appreciated.
>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
>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)
>system i386, mingw32
>R-help at stat.math.ethz.ch mailing list
>PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
More information about the R-help