plot_conf.default {weibulltools} | R Documentation |
Add Confidence Region(s) for Quantiles and Probabilities
Description
This function is used to add estimated confidence region(s) to an existing probability plot which also includes the estimated regression line.
Usage
## Default S3 method:
plot_conf(
p_obj,
x,
y,
distribution = c("weibull", "lognormal", "loglogistic", "sev", "normal", "logistic",
"weibull3", "lognormal3", "loglogistic3", "exponential", "exponential2"),
direction = c("y", "x"),
title_trace = "Confidence Limit",
...
)
Arguments
p_obj |
A plot object returned by plot_mod. |
x |
A list containing the x-coordinates of the confidence region(s). The list can be of length 1 or 2. For more information see Details. |
y |
A list containing the y-coordinates of the Confidence Region(s). The list can be of length 1 or 2. For more information see Details. |
distribution |
Supposed distribution of the random variable. |
direction |
A character string specifying the direction of the plotted
interval(s). |
title_trace |
A character string which is assigned to the legend trace. |
... |
Further arguments passed to or from other methods. Currently not used. |
Details
It is important that the length of the vectors provided as lists in x
and
y
match with the length of the vectors x
and y
in the function plot_mod.
For this reason the following procedure is recommended:
Calculate confidence intervals with the function confint_betabinom or confint_fisher and store it in a
data.frame
. For instance call it df.Inside plot_mod use the output
df$x
forx
anddf$prob
fory
of the function(s) named before.In Examples the described approach is shown with code.
Value
A plot object containing the probability plot with plotting positions, the estimated regression line and the estimated confidence region(s).
References
Meeker, William Q; Escobar, Luis A., Statistical methods for reliability data, New York: Wiley series in probability and statistics, 1998
See Also
Examples
# Vectors:
cycles <- alloy$cycles
status <- alloy$status
prob_tbl <- estimate_cdf(x = cycles, status = status, method = "johnson")
# Example 1 - Probability Plot, Regression Line and Confidence Bounds for Three-Parameter-Weibull:
rr <- rank_regression(
x = prob_tbl$x,
y = prob_tbl$prob,
status = prob_tbl$status,
distribution = "weibull3"
)
conf_betabin <- confint_betabinom(
x = prob_tbl$x,
status = prob_tbl$status,
dist_params = rr$coefficients,
distribution = "weibull3"
)
plot_weibull <- plot_prob(
x = prob_tbl$x,
y = prob_tbl$prob,
status = prob_tbl$status,
id = prob_tbl$id,
distribution = "weibull"
)
plot_reg_weibull <- plot_mod(
p_obj = plot_weibull,
x = conf_betabin$x,
y = conf_betabin$prob,
dist_params = rr$coefficients,
distribution = "weibull3"
)
plot_conf_beta <- plot_conf(
p_obj = plot_reg_weibull,
x = list(conf_betabin$x),
y = list(conf_betabin$lower_bound, conf_betabin$upper_bound),
direction = "y",
distribution = "weibull3"
)
# Example 2 - Probability Plot, Regression Line and Confidence Bounds for Three-Parameter-Lognormal:
rr_ln <- rank_regression(
x = prob_tbl$x,
y = prob_tbl$prob,
status = prob_tbl$status,
distribution = "lognormal3"
)
conf_betabin_ln <- confint_betabinom(
x = prob_tbl$x,
status = prob_tbl$status,
dist_params = rr_ln$coefficients,
distribution = "lognormal3"
)
plot_lognormal <- plot_prob(
x = prob_tbl$x,
y = prob_tbl$prob,
status = prob_tbl$status,
id = prob_tbl$id,
distribution = "lognormal"
)
plot_reg_lognormal <- plot_mod(
p_obj = plot_lognormal,
x = conf_betabin_ln$x,
y = conf_betabin_ln$prob,
dist_params = rr_ln$coefficients,
distribution = "lognormal3"
)
plot_conf_beta_ln <- plot_conf(
p_obj = plot_reg_lognormal,
x = list(conf_betabin_ln$x),
y = list(conf_betabin_ln$lower_bound, conf_betabin_ln$upper_bound),
direction = "y",
distribution = "lognormal3"
)