plot.elife_par | R Documentation |
Because of censoring and truncation, the plotting positions must be adjusted accordingly. For right-censored data, the methodology is described in Waller & Turnbull (1992). Only non-censored observations are displayed, which can create distortion.
## S3 method for class 'elife_par'
plot(
x,
plot.type = c("base", "ggplot"),
which.plot = c("pp", "qq"),
confint = c("none", "pointwise", "simultaneous"),
plot = TRUE,
...
)
x |
a parametric model of class |
plot.type |
string, one of |
which.plot |
vector of string indicating the plots, among |
confint |
logical; if |
plot |
logical; if |
... |
additional arguments, currently ignored by the function. |
For truncated data, we first estimate the distribution function
nonparametrically, F_n
. The uniform plotting positions of the data
v_i = [F_n(y_i) - F_n(a_i)]/[F_n(b_i) - F_n(a_i)].
For probability-probability plots, the empirical quantiles are transformed
using the same transformation, with F_n
replaced by the postulated or estimated
distribution function F_0
.
For quantile-quantile plots, the plotting positions v_i
are mapped back
to the data scale viz.
F_0^{-1}\{F_0(a_i) + v_i[F_0(b_i) - F_0(a_i)]\}
When data are truncated and observations are mapped back to the untruncated scale (with, e.g., exp
), the plotting positions need not be in the same order as the order statistics of the data.
The function produces graphical goodness-of-fit plots using base R or ggplot objects (returned as an invisible list).
set.seed(1234)
samp <- samp_elife(
n = 200,
scale = 2,
shape = 0.3,
family = "gomp",
lower = 0, upper = runif(200, 0, 10),
type2 = "ltrc")
fitted <- fit_elife(
time = samp$dat,
thresh = 0,
event = ifelse(samp$rcens, 0L, 1L),
type = "right",
family = "exp",
export = TRUE)
plot(fitted, plot.type = "ggplot")
# Left- and right-truncated data
n <- 40L
samp <- samp_elife(
n = n,
scale = 2,
shape = 0.3,
family = "gp",
lower = ltrunc <- runif(n),
upper = rtrunc <- ltrunc + runif(n, 0, 15),
type2 = "ltrt")
fitted <- fit_elife(
time = samp,
thresh = 0,
ltrunc = ltrunc,
rtrunc = rtrunc,
family = "gp",
export = TRUE)
plot(fitted, which.plot = "tmd")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.