[Rd] bug in survival package basehaz function (PR#1266)

kohnicho@comp.nus.edu.sg kohnicho@comp.nus.edu.sg
Wed, 16 Jan 2002 07:16:02 +0100 (MET)


Hi,
In the survival analysis package the function basehaz has 2 errors in the
last line
   return(data.frame(hazard=H,time=surv$time,strata=strata))

1) no object surv is created or passed to the function, it should be sfit
2) If there are no strata data.frame barfs bucause strata is NULL

the following is a work around, there may be a better way.
   if(!is.null(strata))
   return(data.frame(hazard=H,time=sfit$time,strata=strata))
   else
   return(data.frame(hazard=H,time=sfit$time))

below is all the version info.

Nicholas

Title: Survival analysis, including penalised likelihood.
Maintainer: Thomas Lumley <tlumley@u.washington.edu>
Priority: recommended
Package: survival
Version: 2.8-2
Requires: R (>= 1.4.0)
Author: S original by Terry Therneau, ported by Thomas Lumley
Description: survival analysis: descriptive statistics, two-sample
  tests, parametric accelerated failure models, Cox model. Delayed entry
  (truncation) allowed for all models; interval censoring for parametric
  models.
License: GPL2



platform i686-pc-linux-gnu
arch     i686             
os       linux-gnu        
system   i686, linux-gnu  
status                    
major    1                
minor    4.0              
year     2001             
month    12               
day      19               
language R                



                 CH3
                  |
                  N             Nicholas Lewin-Koh
                 / \            Dept of Statistics
           N----C   C==O        Program in Ecology and Evolutionary Biology
          ||   ||   |           Iowa State University
          ||   ||   |           Ames, IA 50011
          CH    C   N--CH3      http://www.public.iastate.edu/~nlewin
            \  / \ /            nlewin@iastate.edu
             N    C
             |   ||             Currently
            CH3   O             Graphics Lab
                                School of Computing
                                National University of Singapore
     The Real Part of Coffee    kohnicho@comp.nus.edu.sg


-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-devel-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._