This function is a wrapper around constrained optimization routines for different models with non-informative censoring and truncation patterns.
Usage
fit_elife(
time,
time2 = NULL,
event = NULL,
type = c("right", "left", "interval", "interval2"),
ltrunc = NULL,
rtrunc = NULL,
thresh = 0,
status = NULL,
family = c("exp", "gp", "weibull", "gomp", "gompmake", "extgp", "gppiece",
"extweibull", "perks", "perksmake", "beard", "beardmake"),
weights = NULL,
export = FALSE,
start = NULL,
restart = FALSE,
arguments = NULL,
check = FALSE,
...
)
Arguments
- time
excess time of the event of follow-up time, depending on the value of event
- time2
ending excess time of the interval for interval censored data only.
- event
status indicator, normally 0=alive, 1=dead. Other choices are
TRUE
/FALSE
(TRUE
for death). For interval censored data, the status indicator is 0=right censored, 1=event at time, 2=left censored, 3=interval censored. Although unusual, the event indicator can be omitted, in which case all subjects are assumed to have experienced an event.- type
character string specifying the type of censoring. Possible values are "
right
", "left
", "interval
", "interval2
".- ltrunc
lower truncation limit, default to
NULL
- rtrunc
upper truncation limit, default to
NULL
- thresh
vector of thresholds
- status
integer vector giving status of an observation. If
NULL
(default), this argument is computed internally based ontype
.- family
string; choice of parametric family
- weights
weights for observations
- export
logical; should data be included in the returned object to produce diagnostic plots? Default to
FALSE
.- start
vector of starting values for the optimization routine. If
NULL
, the algorithm attempts to find default values and returns a warning with false convergence diagnostic if it cannot.- restart
logical; should multiple starting values be attempted? Default to
FALSE
.- arguments
a named list specifying default arguments of the function that are common to all
elife
calls- check
logical; if
TRUE
, fit all submodels to ensure that simpler models fit worst or as well- ...
additional parameters, currently ignored
Note
The extended generalized Pareto model is constrained to avoid regions where the likelihood is flat so \(\xi \in [-1, 10]\) in the optimization algorithm.
The standard errors are obtained via the observed information matrix, calculated using the hessian. In many instances, such as when the shape parameter is zero or negative, the hessian is singular and no estimates are returned.
Examples
data(ewsim, package = "longevity")
fit1 <- fit_elife(
arguments = ewsim,
export = TRUE,
family = "exp")
fit2 <- fit_elife(
arguments = ewsim,
export = TRUE,
family = "gp")
plot(fit1)
summary(fit1)
#> Model: exponential distribution.
#> Sampling: interval truncated
#> Log-likelihood: -219.797
#>
#> Threshold: 0
#> Number of exceedances: 179
#>
#> Estimates
#> scale
#> 1.35
#>
#> Standard Errors
#> scale
#> 0.108
#>
#> Optimization Information
#> Convergence: TRUE
anova(fit2, fit1)
#> npar Deviance Df Chisq Pr(>Chisq)
#> gp 2 439.594 NA NA NA
#> exp 1 439.594 1 3.419987e-05 0.9953339