[R] predicted time length differs from survfit.coxph:

Thomas Lumley tlumley at u.washington.edu
Thu Apr 1 18:35:19 CEST 2010


On Wed, 31 Mar 2010, Parminder Mankoo wrote:

> Hello All,
>
> Does anyone know why length(fit1$time) < length(fit2$n) in survfit.coxph
> output? Why is the predicted time length is not the same as the number of
> samples (n)?


In fact it is not true that length(fit1$time) < length(fit2$n), since length(fit2$n) is 1. Presumably you are asking why length(fit1$time) < fit2$n, or perhaps why length(fit2$time) < fit2$n.

The reason is that fit2$time has entries for the unique times in the data set.  There are 241 records, but only 230 unique times. 10 times have two failures and 1 time has a failure and a censoring.

As the documentation (?survfit.object) says
   n    total number of subjects in each curve.
   time    the time points at which the curve has a step.


     -thomas

> I tried: example(survfit.coxph).
>
> Thanks,
> parmee
>
>> fit2$n
> [1] 241
>
>> fit2$time
>  [1]     0    31    32    60    61   152   153   174   273   277   362
> 365   499   517   518   547
> [17]   566   638   700   760   791   792   809   822   845   944  1005
> 1077  1116  1125  1218  1369
> [33]  1392  1400  1431  1492  1625  1642  1673  1674  1706  1766  1767
> 1795  1815  1826  1851  1857
> [49]  2006  2010  2070  2084  2099  2121  2160  2191  2223  2230  2236
> 2314  2345  2400  2422  2434
> [65]  2435  2495  2556  2557  2587  2588  2678  2802  2815  2833  2844
> 2860  2861  2910  2922  2953
> [81]  2989  3010  3012  3014  3091  3167  3186  3226  3227  3242  3318
> 3346  3380  3448  3560  3561
> [97]  3590  3773  3775  3805  3837  3895  3932  3943  3962  3987  4119
> 4139  4201  4206  4224  4232
> [113]  4249  4321  4370  4453  4536  4539  4627  4656  4758  4763  4810
> 4939  4959  4962  5024  5047
> [129]  5068  5088  5181  5216  5236  5308  5354  5384  5550  5757  5789
> 5796  5824  5917  5930  5934
> [145]  6008  6025  6089  6117  6126  6143  6155  6209  6256  6349  6479
> 6607  6626  6642  6723  6760
> [161]  6763  6789  6800  6878  6931  6970  7003  7065  7085  7093  7160
> 7184  7198  7247  7280  7288
> [177]  7301  7364  7370  7381  7397  7410  7417  7470  7479  7519  7533
> 7545  7555  7668  7732  7736
> [193]  7758  7807  7862  7867  7875  7884  7899  7911  7954  7958  7965
> 8006  8009  8023  8030  8080
> [209]  8100  8133  8165  8308  8327  8381  8389  8569  8600  8697  8761
> 8806  8887  8961  9257  9510
> [225]  9560  9598  9993 10122 10359 12457
>
> 	[[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

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



More information about the R-help mailing list