samp_elife | R Documentation |
This function dispatches simulations accounting for potential left-truncation (remove by setting lower to zero).
If type2=ltrt
, simulated observations will be lower than the upper bounds upper
.
If type2=ltrc
, simulated observations are capped at upper
and the observation is right-censored (rcens=TRUE
).
samp_elife(
n,
scale,
rate,
shape = NULL,
lower = 0,
upper = Inf,
family = c("exp", "gp", "gomp", "gompmake", "weibull", "extgp", "gppiece",
"extweibull", "perks", "beard", "perksmake", "beardmake"),
type2 = c("none", "ltrt", "ltrc", "ditrunc")
)
n |
sample size |
scale |
scale parameter(s) |
rate |
rate parameter(s) |
shape |
shape parameter(s) |
lower |
vector of lower bounds |
upper |
vector of upper bounds |
family |
string; choice of parametric family |
type2 |
string, either |
either a vector of observations or, if type2=ltrc
, a list with n
observations dat
and a logical vector of the same length with TRUE
for right-censored observations and FALSE
otherwise.
As the tails of the Gompertz and Gompertz–Makeham models decrease exponentially fast, the method fails in the rare event case if the lower bound is too large (say larger than the 99.99
set.seed(1234)
n <- 500L
# Simulate interval truncated data
x <- samp_elife(n = n,
scale = 2,
shape = 1.5,
lower = low <- runif(n),
upper = upp <- runif(n, min = 3, max = 15),
type2 = "ltrt",
family = "weibull")
coef(fit_elife(
time = x,
ltrunc = low,
rtrunc = upp,
family = "weibull"))
# Simulate left-truncated right-censored data
x <- samp_elife(n = n,
scale = 2,
shape = 1.5,
lower = low <- runif(n),
upper = upp <- runif(n, min = 3, max = 15),
type2 = "ltrc",
family = "gomp")
#note that the return value is a list...
coef(fit_elife(
time = x$dat,
ltrunc = low,
event = !x$rcens,
family = "gomp"))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.