R/plotbands.R

Defines functions plotbands

Documented in plotbands

plotbands<-function(sobj,conf.level=0.95,...){

km<-sobj

n<-length(km$time)

k<-sum(km$n.event>0)

sel<-(1:n)*as.numeric(km$n.event>0)

cbands<-confband(km,conf.level)

plot(km,conf.int=F,mark.time=F,...)

if (km$n.event[n]==0) {lines(c(0,km$time[sel],km$time[n]),c(cbands[,1],cbands[k+1,1]),type="s",lty=2)
                        lines(c(0,km$time[sel],km$time[n]),c(cbands[,2],cbands[k+1,2]),type="s",lty=2)}
	else              {lines(c(0,km$time[sel]),cbands[,1],type="s",lty=2)
                       lines(c(0,km$time[sel]),cbands[,2],type="s",lty=2)}
}

Try the kmconfband package in your browser

Any scripts or data that you put into this service are public.

kmconfband documentation built on May 2, 2019, 2:49 p.m.