Learn R Programming

Temporal (version 0.3.0.1)

FitParaSurv: Fit Parametric Survival Distribution

Description

Estimates parametric survival distributions using event times subject to non-informative right censoring. Available distributions include: exponential, gamma, generalized gamma, log-normal, and Weibull.

Usage

FitParaSurv(
  data,
  beta_lower = 0.1,
  beta_upper = 10,
  dist = "weibull",
  eps = 1e-06,
  init = NULL,
  maxit = 10,
  report = FALSE,
  sig = 0.05,
  status_name = "status",
  tau = NULL,
  time_name = "time"
)

Value

An object of class fit containing the following:

Parameters

The estimated shape and rate parameters.

Information

The observed information matrix.

Outcome

The fitted mean, median, and variance.

RMST

The estimated RMSTs, if tau was specified.

Arguments

data

Data.frame containing the time to event and status.

beta_lower

If dist="gen-gamma", lower limit on possible values for beta.

beta_upper

If dist="gen-gamma", upper limit on possible values for beta.

dist

String, distribution to fit, selected from among: exp, gamma, gen-gamma log-normal, and weibull.

eps

Tolerance for Newton-Raphson iterations.

init

List of initial parameters. See individual distributions for the expected parameters.

maxit

Maximum number of NR iterations.

report

Report fitting progress?

sig

Significance level, for CIs.

status_name

Name of the status indicator, 1 if observed, 0 if censored.

tau

Optional truncation time for calculating RMSTs.

time_name

Name of column containing the time to event.

See Also

  • Between group comparison of survival experience CompParaSurv

  • Exponential distribution FitExp

  • Gamma distribution FitGamma

  • Generalized gamma distribution FitGenGamma

  • Log-normal distribution FitLogNormal

  • Weibull distribution FitWeibull

Examples

Run this code
# Generate Gamma data with 20% censoring.
data <- GenData(n = 1e3, dist = "gamma", theta = c(2, 2), p = 0.2)
# Fit gamma distribution.
fit <- FitParaSurv(data, dist = "gamma")

# Generate Weibull data with 10% censoring.
data <- GenData(n = 1e3, dist = "weibull", theta = c(2, 2), p = 0.1)
# Fit weibull distribution, calculate RMST at tau=0.5.
fit <- FitParaSurv(data, dist = "weibull", tau = 0.5)

Run the code above in your browser using DataLab