crossTime-methods: Computes the crossing survival times

Description Usage Arguments Value Examples

Description

Computes the crossing survival times along with their corresponding confidence/credible intervals.

Usage

1
2
## S3 method for class 'ypbp'
crossTime(object, newdata1, newdata2, conf.level = 0.95, nboot = 4000, ...)

Arguments

object

an object of class ypbp

newdata1

a data frame containing the first set of explanatory variables

newdata2

a data frame containing the second set of explanatory variables

conf.level

level of the confidence/credible intervals; default is conf.level = 0.95

nboot

number of bootstrap samples (default nboot=4000); ignored if approach="bayes".

...

further arguments passed to or from other methods.

Value

the crossing survival time

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# ML approach:
library(YPBP)
mle <- ypbp(Surv(time, status)~arm, data=ipass, approach="mle")
summary(mle)
newdata1 <- data.frame(arm=0)
newdata2 <- data.frame(arm=1)
tcross <- crossTime(mle, newdata1, newdata2, nboot = 100)
tcross
ekm <- survival::survfit(Surv(time, status)~arm, data=ipass)
newdata <- data.frame(arm=0:1)
St <- survfit(mle, newdata)
plot(ekm, col=1:2)
with(St, lines(time, surv[[1]]))
with(St, lines(time, surv[[2]], col=2))
abline(v=tcross, col="blue")

# Bayesian approach:
bayes<-ypbp(Surv(time,status)~arm,data=ipass,approach="bayes",chains=2,iter=100)
summary(bayes)
newdata1 <- data.frame(arm=0)
newdata2 <- data.frame(arm=1)
tcross <- crossTime(bayes, newdata1, newdata2)
tcross
ekm <- survival::survfit(Surv(time, status)~arm, data=ipass)
newdata <- data.frame(arm=0:1)
St <- survfit(bayes, newdata)
plot(ekm, col=1:2)
with(St, lines(time, surv[[1]]))
with(St, lines(time, surv[[2]], col=2))
abline(v=tcross, col="blue")

YPBP documentation built on July 1, 2020, 10:19 p.m.