survfit.ypbp: survfit method for ypbp models

Description Usage Arguments Value Examples

View source: R/survival_ypbp.R

Description

Computes the predicted survivor function for a ypbp model.

Usage

1
2
## S3 method for class 'ypbp'
survfit(formula, newdata, ...)

Arguments

formula

an object of the class ypbp

newdata

a data frame containing the set of explanatory variables.

...

further arguments passed to or from other methods.

Value

a list containing the estimated survival probabilities.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
# ML approach:
library(YPBP)
mle <- ypbp(Surv(time, status)~arm, data=ipass, approach="mle")
summary(mle)
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))

# Bayesian approach:
bayes <- ypbp(Surv(time, status) ~ arm, data = ipass,
              approach = "bayes", chains = 2, iter = 100)
summary(bayes)
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))

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