[R] p-value from survreg(), library(survival)

Marc Schwartz marc_schwartz at comcast.net
Wed Jul 11 17:10:50 CEST 2007


On Wed, 2007-07-11 at 16:41 +0200, hadley wickham wrote:
> On 7/11/07, Marc Schwartz <marc_schwartz at comcast.net> wrote:
> > Actually, in this case, looking at the code for:
> >
> >   survival:::print.survreg
> >
> > would be better, as the p value is calculate there, rather than being
> > part of the survreg object. As with many R functions, the p value is
> > calculated in the print method for the object.
> 
> I wish print methods wouldn't do that. Printing is supposed to be
> about displaying existing create, not creating new values.
> 
> Hadley

It has been occasionally confusing and I am not sure of the history
behind the diverse approach. To borrow a phrase from the DoD TCSEC
books[1], I don't have my S/R "Rainbow Books" at hand to research it.
Both sets of colors are on shelves in my home office.

The first time I came across this years ago, was with the p value for
the F statistic in a simple linear model. it is calculated in:

  stats:::print.summary.lm

while the individual term p values are calculated in

  summary.lm

versus being part of the returned lm object itself.

I have just become "behaviorally modified" to look in more than one
place for such things...  :-)

Regards,

Marc

[1] http://en.wikipedia.org/wiki/Rainbow_Series



More information about the R-help mailing list