[R] "survMisc" package

Andrews, Chris chrisaa at med.umich.edu
Mon Mar 9 12:51:07 CET 2015


The package maintainer may be able to give help.  However, I don't get the same output as you (3.1.2).  Perhaps you can update and solve your problem.

> require(survMisc)
Loading required package: survMisc
Loading required package: survival
Loading required package: splines
Loading required package: ggplot2

Attaching package: ‘survMisc’

The following object is masked from ‘package:ggplot2’:

    autoplot

The following objects are masked from ‘package:stats’:

    AIC, BIC, median, quantile

> 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:  0.5 119 6       76        6       43        0
 2:  1.5 103 1       60        0       43        1
 3:  2.5  98 2       56        2       42        0
 4:  3.5  89 2       49        1       40        1
 5:  4.5  79 2       43        0       36        2
 6:  5.5  73 1       40        0       33        1
 7:  6.5  66 1       35        1       31        0
 8:  8.5  55 2       30        0       25        2
 9:  9.5  49 1       27        0       22        1
10: 10.5  45 1       25        0       20        1
11: 11.5  40 1       22        0       18        1
12: 15.5  25 2       14        1       11        1
13: 16.5  23 1       13        0       10        1
14: 18.5  20 1       11        0        9        1
15: 23.5   9 1        5        0        4        1
16: 26.5   5 1        3        0        2        1

$tests
$tests$lrTests
                                    ChiSq df       p
Log-rank                      2.529506318  1 0.11174
Gehan-Breslow (mod~ Wilcoxon) 0.002084309  1 0.96359
Tarone-Ware                   0.402738202  1 0.52568
Peto-Peto                     1.399160019  1 0.23686
Mod~ Peto-Peto (Andersen)     1.275908836  1 0.25866
Flem~-Harr~ with p=1, q=1     9.834062861  1 0.00171

$tests$supTests
                                       Q       p
Log-rank                        1.590442 0.22347
Gehan-Breslow (mod~ Wilcoxon)   1.430499 0.30511
Tarone-Ware                     1.260498 0.41467
Peto-Peto                       1.166979 0.48551
Mod~ Peto-Peto (Andersen)       1.185549 0.47085
Renyi Flem~-Harr~ with p=1, q=1 7.460348 0.00000




-----Original Message-----
From: Endy BlackEndy [mailto:pertsou at gmail.com] 
Sent: Sunday, March 08, 2015 12:44 PM
To: r-help
Subject: [R] "survMisc" package

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: survival

Loading required package: splines

Loading required package: km.ci

Loading required package: ggplot2

Loading required package: data.table

data.table 1.9.4  For help type: ?data.table

*** NB: by=.EACHI is now explicit. See README to restore previous behaviour.

Loading required package: gridExtra

Loading required package: grid

Loading 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                2

10: 16.5   26         2       13               1
13                1

11: 18.5   22         2       11               1
  11                1

12: 23.5     8         2        4                 1
4                1

13: 26.5     6         2        3                 1
3                1



$tests

$tests$lrTests

                                                        ChiSq df p

Log-rank                                                0  1 1

Gehan-Breslow (mod~ Wilcoxon)             0  1 1

Tarone-Ware                                          0  1 1

Peto-Peto                                              0  1 1

Mod~ Peto-Peto (Andersen)                    0  1 1

Flem~-Harr~ with p=1, q=1                      0  1 1



$tests$supTests

                                                             Q p

Log-rank                                                 0 1

Gehan-Breslow (mod~ Wilcoxon)              0 1

Tarone-Ware                                           0 1

Peto-Peto                                               0 1

Mod~ Peto-Peto (Andersen)                     0 1

Renyi 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/1991

When I run the function proc() I am getting the answer

> proc()

Error in Surv(d[, 2], d[, 5]) : object 'd' not found

In contrast when I run the same routine command-by-command I am getting the
following output

$lrTests

                                                         ChiSq df p

Log-rank                                                 0  1 1

Gehan-Breslow (mod~ Wilcoxon)              0  1 1

Tarone-Ware                                           0  1 1

Peto-Peto                                               0  1 1

Mod~ Peto-Peto (Andersen)                     0  1 1

Flem~-Harr~ with p=1, q=1                       0  1 1



$supTests

                                                              Q p

Log-rank                                                  0 1

Gehan-Breslow (mod~ Wilcoxon)               0 1

Tarone-Ware                                            0 1

Peto-Peto                                                0 1

Mod~ Peto-Peto (Andersen)                      0 1

Renyi Flem~-Harr~ with p=1, q=1              0 1

Any assistance will greatly appreciated.

Cheers

Endy

I am using the

R version 3.1.1 (2014-07-10) -- "Sock it to Me"

Copyright (C) 2014 The R Foundation for Statistical Computing

Platform: i386-w64-mingw32/i386 (32-bit)

	[[alternative HTML version deleted]]


**********************************************************
Electronic Mail is not secure, may not be read every day, and should not be used for urgent or sensitive issues 


More information about the R-help mailing list