survfit.survstan: survfit method for survstan models

View source: R/survfit.R

survfit.survstanR Documentation

survfit method for survstan models

Description

Computes the predicted survivor function for a phpe model.

Usage

## S3 method for class 'survstan'
survfit(formula, newdata = NULL, ...)

Arguments

formula

an object of the class survstan

newdata

a data frame containing the set of explanatory variables; if NULL, a data.frame with the observed failure times and their corresponding estimated baseline survivals is returned.

...

further arguments passed to or from other methods.

Value

a data.frame containing the estimated survival probabilities.

Examples


library(survstan)
library(ggplot2)
data(ipass)
ipass$arm <- as.factor(ipass$arm)
fit <- ypreg(Surv(time, status)~arm, data=ipass, baseline = "weibull")
summary(fit)
newdata <- data.frame(arm=as.factor(0:1))
surv <- survfit(fit, newdata)
ggplot(surv, aes(x=time, y=surv, color = arm)) +
  geom_line()



survstan documentation built on May 29, 2024, 8:41 a.m.