tstab {longevity} | R Documentation |
Threshold stability plots
Description
The generalized Pareto and exponential distribution
are threshold stable. This property, which is used
for extrapolation purposes, can also be used to diagnose
goodness-of-fit: we expect the parameters \xi
and \tilde{\sigma} = \sigma + \xi u
to be constant over a range of thresholds. The threshold stability
plot consists in plotting maximum likelihood estimates with pointwise confidence interval.
This function handles interval truncation and right-censoring.
Usage
tstab(
time,
time2 = NULL,
event = NULL,
thresh = 0,
ltrunc = NULL,
rtrunc = NULL,
type = c("right", "left", "interval", "interval2"),
family = c("gp", "exp"),
method = c("wald", "profile"),
level = 0.95,
plot = TRUE,
plot.type = c("base", "ggplot"),
which.plot = c("scale", "shape"),
weights = NULL,
arguments = NULL,
...
)
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 |
thresh |
vector of thresholds |
ltrunc |
lower truncation limit, default to |
rtrunc |
upper truncation limit, default to |
type |
character string specifying the type of censoring. Possible values are " |
family |
string; distribution, either generalized Pareto ( |
method |
string; the type of pointwise confidence interval, either Wald ( |
level |
probability level for the pointwise confidence intervals |
plot |
logical; should a plot be returned alongside with the estimates? Default to |
plot.type |
string; either |
which.plot |
string; which parameters to plot; |
weights |
weights for observations |
arguments |
a named list specifying default arguments of the function that are common to all |
... |
additional arguments for optimization, currently ignored. |
Details
The shape estimates are constrained
Value
an invisible list with pointwise estimates and confidence intervals for the scale and shape parameters
See Also
tstab.gpd
from package mev
, gpd.fitrange
from package ismev
or tcplot
from package evd
, among others.
Examples
set.seed(1234)
n <- 100L
x <- samp_elife(n = n,
scale = 2,
shape = -0.2,
lower = low <- runif(n),
upper = upp <- runif(n, min = 3, max = 20),
type2 = "ltrt",
family = "gp")
tstab_plot <- tstab(time = x,
ltrunc = low,
rtrunc = upp,
thresh = quantile(x, seq(0, 0.5, length.out = 4)))
plot(tstab_plot, plot.type = "ggplot")