r_ltrc_elife: Sample observations from a left-truncated right-censored...

View source: R/simulation.R

r_ltrc_elifeR Documentation

Sample observations from a left-truncated right-censored excess lifetime distribution

Description

Sample observations from a left-truncated right-censored excess lifetime distribution

Usage

r_ltrc_elife(
  n,
  scale,
  rate,
  shape,
  lower,
  upper,
  family = c("exp", "gp", "gomp", "gompmake", "weibull", "extgp", "gppiece",
    "extweibull", "perks", "beard", "perksmake", "beardmake")
)

Arguments

n

sample size

scale

scale parameter

shape

shape parameter(s)

lower

vector of lower bounds

upper

vector of upper bounds above which data are right-truncated

family

string; choice of parametric family, either exponential (exp), Weibull (weibull), generalized Pareto (gp), Gompertz (gomp) or extended generalized Pareto (extgp).

Value

a list with n observations dat and a logical vector of the same length with TRUE for right-censored observations and FALSE otherwise.

Examples

n <- 100L
# the lower and upper bound are either scalar,
# or else vectors of length n
r_ltrc_elife(n = n, scale = 5, shape = -0.1,
               lower = pmax(0, runif(n, -0.5, 1)),
               upper = 5,
               family = "gp")

longevity documentation built on Nov. 12, 2023, 5:07 p.m.