[Rd] Possible bug in summary.survfit - 'scale' argument ignored?

Thomas Lumley tlumley at u.washington.edu
Wed Apr 1 14:08:14 CEST 2009


I've sent a fixed version 2.35-4 to CRAN.  It turned out to be a fairly simple change.

     -thomas


On Tue, 31 Mar 2009, Marc Schwartz wrote:

> On Mar 30, 2009, at 5:55 PM, Marc Schwartz wrote:
>
>> Hi all,
>> 
>> Using:
>> 
>>  R version 2.8.1 Patched (2009-03-07 r48068)
>> 
>> on OSX (10.5.6) with survival version:
>> 
>>  Version:            2.35-3
>>  Date:               2009-02-10
>> 
>> 
>> I get the following using the first example in ?summary.survfit:
>> 
>> > summary( survfit( Surv(futime, fustat)~1, data=ovarian))
>> Call: survfit(formula = Surv(futime, fustat) ~ 1, data = ovarian)
>> 
>> time n.risk n.event survival std.err lower 95% CI upper 95% CI
>>   59     26       1    0.962  0.0377        0.890        1.000
>>  115     25       1    0.923  0.0523        0.826        1.000
>>  156     24       1    0.885  0.0627        0.770        1.000
>>  268     23       1    0.846  0.0708        0.718        0.997
>>  329     22       1    0.808  0.0773        0.670        0.974
>>  353     21       1    0.769  0.0826        0.623        0.949
>>  365     20       1    0.731  0.0870        0.579        0.923
>>  431     17       1    0.688  0.0919        0.529        0.894
>>  464     15       1    0.642  0.0965        0.478        0.862
>>  475     14       1    0.596  0.0999        0.429        0.828
>>  563     12       1    0.546  0.1032        0.377        0.791
>>  638     11       1    0.497  0.1051        0.328        0.752
>> 
>> 
>> > summary( survfit( Surv(futime, fustat)~1, data=ovarian), scale = 365.25)
>> Call: survfit(formula = Surv(futime, fustat) ~ 1, data = ovarian)
>> 
>> time n.risk n.event survival std.err lower 95% CI upper 95% CI
>>   59     26       1    0.962  0.0377        0.890        1.000
>>  115     25       1    0.923  0.0523        0.826        1.000
>>  156     24       1    0.885  0.0627        0.770        1.000
>>  268     23       1    0.846  0.0708        0.718        0.997
>>  329     22       1    0.808  0.0773        0.670        0.974
>>  353     21       1    0.769  0.0826        0.623        0.949
>>  365     20       1    0.731  0.0870        0.579        0.923
>>  431     17       1    0.688  0.0919        0.529        0.894
>>  464     15       1    0.642  0.0965        0.478        0.862
>>  475     14       1    0.596  0.0999        0.429        0.828
>>  563     12       1    0.546  0.1032        0.377        0.791
>>  638     11       1    0.497  0.1051        0.328        0.752
>> 
>> Of course the time periods in the second output should be scaled to years, 
>> that is (time / 365.25).
>> 
>> I noted this today running some Sweave code, but not sure when the actual 
>> change in behavior occurred.  I can replicate the same behavior on a Windows 
>> machine here as well, so this is not OSX specific.
>
>
> A quick follow up here. I reverted to:
>
>  R version 2.8.1 (2008-12-22)
>
> which includes survival version:
>
> Version:       2.34-1
> Date:          2008-03-31
>
>
> In that version, I get:
>
>> summary( survfit( Surv(futime, fustat)~1, data=ovarian), scale = 365.25)
> Call: survfit(formula = Surv(futime, fustat) ~ 1, data = ovarian)
>
>  time n.risk n.event survival std.err lower 95% CI upper 95% CI
> 0.162     26       1    0.962  0.0377        0.890        1.000
> 0.315     25       1    0.923  0.0523        0.826        1.000
> 0.427     24       1    0.885  0.0627        0.770        1.000
> 0.734     23       1    0.846  0.0708        0.718        0.997
> 0.901     22       1    0.808  0.0773        0.670        0.974
> 0.966     21       1    0.769  0.0826        0.623        0.949
> 0.999     20       1    0.731  0.0870        0.579        0.923
> 1.180     17       1    0.688  0.0919        0.529        0.894
> 1.270     15       1    0.642  0.0965        0.478        0.862
> 1.300     14       1    0.596  0.0999        0.429        0.828
> 1.541     12       1    0.546  0.1032        0.377        0.791
> 1.747     11       1    0.497  0.1051        0.328        0.752
>
>
> So the functional loss of the 'scale' argument took place subsequent to that 
> release. From a review of the code in both versions, it would appear that 
> substantive changes took place to the function in the intervening time frame, 
> including the addition of the 'rmean' and 'extend' arguments. One of the 
> changes appears to be the setting of:
>
>  stime <- fit$time/scale
>
> in the old version and I do not see a parallel adjustment in the time scale in 
> the new version and the subsequent use of fit$time later in the new function.
>
> Given the substantive changes to the function code, I am hesitant to propose 
> patches for fear of introducing breakage elsewhere. I also need to get some 
> work done for a client today, before I leave for vacation tomorrow for a week, 
> otherwise I would spend more time evaluating possible patches.
>
> I hope that the above is enough to give Terry and Thomas some narrowed focus.
>
> Regards,
>
> Marc
>
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>

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



More information about the R-devel mailing list