km: Compute survival curves and test difference between the...

Description Usage Arguments Value Author(s) See Also Examples

Description

Computes and draw estimates of survival curves for censored data using Kaplan-Meier's method. In case of >=2 survival curves, use logrank test to assess the difference between the survival curves. Missing values are removed

Usage

1
km(time, status, group = NULL, xlab="Time (years)", ylab="", ...)

Arguments

time

numeric, this is the follow up time (used with right censored data)

status

The status indicator, normally 0=alive, 1=dead (numeric). Other choices are TRUE/FALSE (TRUE = death) or 1/2 (2=death)

group

indicates the group to which is assigned each observation (factor). For one groupe only (no comparison), group is set to null (default)

xlab

(optional): a character string, xlabel of the Kaplan Meier's plot

ylab

(optional): a character string, ylabel of the Kaplan Meier's plot

...

(optional): Additional graphical parameters

Value

A list with

fit.km

results provided by Kaplan Meier analysis. See the R help on survfit for details

lr

results provided by logrank analysis. See the R help on survdiff for details

p.lr

pvalue of the logrank test

Author(s)

Nicolas Servant, Eleonore Gravier, Pierre Gestraud, Cecile Laurent, Caroline Paccard, Anne Biton, Jonas Mandel, Bernard Asselain, Emmanuel Barillot, Philippe Hupe

See Also

survfit, survdiff

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
require(survival)
data(leukemia)
time<-leukemia$time
status<-leukemia$status
# One group
res<-km(time,status)
res$fit.km

# Two groups
group<-leukemia$x
res<-km(time,status,group)
res<-km(time,status,group,title="Kaplan Meier curve")
res<-km(time,status,group,title="Kaplan Meier curve",pdfname="My survival curve")
res<-km(time,status,group,pdfname="My survival curve",pdfwidth=11.69,pdfheight=8.27)
res$fit.km
names(res$fit.km)
res$lr
names(res$lr)
res$p.lr

Example output

################################################################################

Easy Microarray Analysis

EMA stable version

Current release : v1.4.4 - march 2014

################################################################################

Loading required package: survival
Call: survfit(formula = Surv(time, status) ~ group, na.action = na.omit)

      n  events  median 0.95LCL 0.95UCL 
     23      18      27      18      45 
Warning messages:
1: In plot.window(...) : "title" is not a graphical parameter
2: In plot.xy(xy, type, ...) : "title" is not a graphical parameter
3: In axis(side = side, at = at, labels = labels, ...) :
  "title" is not a graphical parameter
4: In axis(side = side, at = at, labels = labels, ...) :
  "title" is not a graphical parameter
5: In box(...) : "title" is not a graphical parameter
6: In title(...) : "title" is not a graphical parameter
There were 12 warnings (use warnings() to see them)
There were 18 warnings (use warnings() to see them)
Call: survfit(formula = Surv(time, status) ~ group, na.action = na.omit)

                     n events median 0.95LCL 0.95UCL
group=Maintained    11      7     31      18      NA
group=Nonmaintained 12     11     23       8      NA
 [1] "n"         "time"      "n.risk"    "n.event"   "n.censor"  "surv"     
 [7] "std.err"   "cumhaz"    "std.chaz"  "strata"    "type"      "logse"    
[13] "conf.int"  "conf.type" "lower"     "upper"     "call"     
Call:
survdiff(formula = Surv(time, status) ~ group, na.action = na.omit)

                     N Observed Expected (O-E)^2/E (O-E)^2/V
group=Maintained    11        7    10.69      1.27       3.4
group=Nonmaintained 12       11     7.31      1.86       3.4

 Chisq= 3.4  on 1 degrees of freedom, p= 0.07 
[1] "n"     "obs"   "exp"   "var"   "chisq" "call" 
[1] 0.06533932

EMA documentation built on March 26, 2020, 8:40 p.m.