surv_prob: Survival probability based on parametric distribution

Description Usage Arguments Examples

View source: R/surv_prob.R

Description

Computes probability of survival beyond time t given that the data follows a specified parametric distribution.

Usage

1
2
surv_prob(data, dist, x, lower.tail = F, time = "time",
  censor = "censor", by = "")

Arguments

data

A dataframe containing a time column and a censor column.

dist

A string name for a distribution that has a corresponding density function and a distribution function. Examples include "norm", "lnorm", "exp", "weibull", "logis", "llogis", "gompertz", etc.

x

A scalar quantity, time at which the probability of survival is computed

lower.tail

Logical; if F (default), probability is P(T > x), otherwise, P(T < x).

time

The string name of the time column of the dataframe. Defaults to "time".

censor

The string name of the censor column of the dataframe. Defaults to "censor". The censor column must be a numeric indicator variable where complete times correspond to a value of 1 and incomplete times correspond to 0.

by

The string name of a grouping variable. If specified, the function prints probability for each group individually along with the overall probability. Variable can contain logical, string, character, or numeric data.

Examples

1
2
3
data("rearrest")
surv_prob(rearrest, "lnorm", 110, time = "months")
surv_prob(rearrest, "weibull", 90, time = "months", lower.tail = TRUE)

parmsurvfit documentation built on May 2, 2019, 5:41 a.m.