[R] survMisc

Endy pertsou at yahoo.gr
Sun Mar 8 19:05:07 CET 2015


Hi R users. I have some problems with the package “survMisc”. When I am loading it I am getting the following > library(survMisc)Loading required package: survivalLoading required package: splinesLoading required package: km.ciLoading required package: ggplot2Loading required package: data.tabledata.table 1.9.4  For help type: ?data.table*** NB: by=.EACHI is now explicit. See README to restore previous behaviour.Loading required package: gridExtraLoading required package: gridLoading required package: rpart Attaching package: ‘survMisc’ The following objects are masked from ‘package:stats’:     AIC, BIC, median, quantile    In the above output I noticed the line with the three stars (*). In order to restore the data.table in its previous behavior I tried to locate the README file but I couldn’t.   I ignored that NB in the previous output and I continue to run the example given in the above mentioned package for the routine comp(). The commands and the output are given below.> ### 2 curves> data(kidney,package="KMsurv")> s1 <- survfit(Surv(time=time, event=delta) ~ type, data=kidney )> comp(s1)$tne       t          n          e   n_type=1   e_type=1   n_type=2   e_type=2 1:  1.5    86         2       43                1                  43                1 2:  3.5    80         2       40                1                  40                1 3:  4.5    72         4       36                2                  36                2 4:  5.5    66         2       33                1                  33                1 5:  8.5    60         4       30                2                  30                2 6:  9.5    54         2       27                1                  27                1 7: 10.5   50         2       25                1                  25                1 8: 11.5    44         2       22               1                  22                1 9: 15.5    28         4       14               2                  14                210: 16.5   26         2       13               1                  13                111: 18.5   22         2       11               1                  11                112: 23.5     8         2        4                 1                    4                113: 26.5     6         2        3                 1                    3                1 $tests$tests$lrTests                                                        ChiSq df pLog-rank                                                0  1 1Gehan-Breslow (mod~ Wilcoxon)             0  1 1Tarone-Ware                                          0  1 1Peto-Peto                                              0  1 1Mod~ Peto-Peto (Andersen)                    0  1 1Flem~-Harr~ with p=1, q=1                      0  1 1 $tests$supTests                                                             Q pLog-rank                                                 0 1Gehan-Breslow (mod~ Wilcoxon)              0 1Tarone-Ware                                           0 1Peto-Peto                                               0 1Mod~ Peto-Peto (Andersen)                     0 1Renyi Flem~-Harr~ with p=1, q=1             0 1 Notice the zeros (0) that corresponds to the test statistics. (To my opinion those zeros are strongly related to the NB above).   Next I noticed the following strange, to my opinion, thing.  More precisely I have written the following routine                                                                                proc<-function(){ rm(list=ls()) library(survMisc) d<-read.table("C:\\Program Files\\R\\Data\\Survival\\HosmLem.txt",fill=TRUE,header=TRUE) d4<-as.factor(d[,4]) s<-survfit(Surv(d[,2], d[,5])~d4) ctest<-comp(s)$tests print(ctest)}The data used are those of Hosmer and Lemeshow book on Applied Survival Analysis. The first rows of this data set follow.id Time Age Drug Censor    entdate    enddate  1    5  46    0      1   05/15/1990 10/14/1990  2    6  35    1      0   09/19/1989 03/20/1990  3    8  30    1      1   04/21/1991 12/20/1991  4    3  30    1      1   01/03/1991 04/04/1991  5   22  36    0      1   09/18/1989 07/19/1991  6    1  32    1      0    03/18/1991 04/17/1991When I run the function proc() I am getting the answer> proc()Error in Surv(d[, 2], d[, 5]) : object 'd' not foundIn contrast when I run the same routine command-by-command I am getting the following output$lrTests                                                         ChiSq df pLog-rank                                                 0  1 1Gehan-Breslow (mod~ Wilcoxon)              0  1 1Tarone-Ware                                           0  1 1Peto-Peto                                               0  1 1Mod~ Peto-Peto (Andersen)                     0  1 1Flem~-Harr~ with p=1, q=1                       0  1 1 $supTests                                                              Q pLog-rank                                                  0 1Gehan-Breslow (mod~ Wilcoxon)               0 1Tarone-Ware                                            0 1Peto-Peto                                                0 1Mod~ Peto-Peto (Andersen)                      0 1Renyi Flem~-Harr~ with p=1, q=1              0 1Any assistance will greatly appreciated.CheersEndyI am using theR version 3.1.1 (2014-07-10) -- "Sock it to Me"Copyright (C) 2014 The R Foundation for Statistical ComputingPlatform: i386-w64-mingw32/i386 (32-bit) 

	[[alternative HTML version deleted]]



More information about the R-help mailing list