[R] p-value from survreg
Terry Therneau
therneau at mayo.edu
Thu Jul 12 16:33:13 CEST 2007
The question was how to get the p-value from the fit below, as an S object
sr<-survreg(s~groups, dist="gaussian")
Coefficients:
(Intercept) groups
-0.02138485 0.03868351
Scale= 0.01789372
Loglik(model)= 31.1 Loglik(intercept only)= 25.4
Chisq= 11.39 on 1 degrees of freedom, p= 0.00074
n= 16
----
In general, good places to start are
> names(sr)
> help(survreg.object)
> ssr <- summary(sr)
> names(ssr)
As someone else pointed out, it's also easy to look at the print.survreg
function and see how the value was created -- one of the things I love
about S.
Unfortunately, doing the above myself showed that I have let the documentation
page for survreg.object get seriously out of date -- quite embarassing as
that is logically the first place to start.
As to the print function creating things "on the fly": there is an area where
there is no good answer. Does one make the return object from a fit such
that it contains only minimal data, or add in all of the other computations
that can be derived from these? The Chambers and Hastie book "Statistical
Models in S", which was the starting point for model objects, leaned towards
the former, and this still influences many functions. Often the summary
function will "fill in" these derived values, the std and t-tests for
the individual coefficients for instance.
Terry T.
More information about the R-help
mailing list