Learn R Programming

Temporal (version 0.3.0.1)

GenData: Data Generation with Censoring

Description

Generates data from survival distributions as parameterized in this package, with optional non-informative random right censoring.

Usage

GenData(n, dist = "exp", theta = NULL, p = 0)

Value

Data.frame including the observation times and status.

Arguments

n

Integer sample size.

dist

String, distribution name selected from among: "exp","gamma","gen-gamma","log-normal","weibull".

theta

Numeric parameter vector. Elements will vary according to the distribution.

p

Expected censoring proportion.

Details

The parameter vector theta should contain the following elements, in order, depending on the distribution:

Exponential

Rate \(\lambda\).

Gamma

Shape \(\alpha\), rate \(\lambda\).

Generalized Gamma

Shape 1 \(\alpha\), shape 2 \(\beta\), rate \(\lambda\).

Log-Normal

Locaion \(\mu\), scale \(\sigma\).

Weibull

Shape \(\alpha\), rate \(\lambda\).

Examples

Run this code
# Gamma event times with shape 2 and rate 2.
# Expected censoring proportion of 20%.
data <- GenData(n = 1e3, dist = "gamma", theta = c(2, 2), p = 0.20)

# Generalized gamma event times with shapes (2,3) and rate 1.
# Expected censoring proportion of 15%.
data <- GenData(n = 1e3, dist = "gen-gamma", theta = c(2, 3, 1), p = 0.15)

# Log-normal event times with location 0 and rate 1.
# Expected censoring proportion of 10%.
data <- GenData(n = 1e3, dist = "log-normal", theta = c(0, 1), p = 0.10)

# Weibull event times with shape 2 and rate 2.
# Expected censoring proportion of 5%.
data <- GenData(n = 1e3, dist = "weibull", theta = c(2, 2), p = 0.05)

Run the code above in your browser using DataLab