R/confidence_intervals.R
confint_betabinom.Rd
This function computes the non-parametric beta binomial confidence bounds (BB) for quantiles and failure probabilities.
A list with class wt_model
(and further classes) returned by
rank_regression.
Further arguments passed to or from other methods. Currently not used.
A numeric vector indicating the probabilities \(p\) of the \(B_p\)-lives (quantiles) to be considered.
A character string specifying the bound(s) to be computed.
Confidence level of the interval.
A character string specifying the direction of the confidence
interval. "y"
for failure probabilities or "x"
for quantiles.
A tibble with class wt_confint
containing the following columns:
x
: An ordered sequence of the lifetime characteristic regarding the
failed units, starting at min(x)
and ending up at max(x)
. With
b_lives = c(0.01, 0.1, 0.5)
the 1%, 10% and 50% quantiles are additionally
included in x
, but only if the specified probabilities are in the range of
the estimated probabilities.
rank
: Interpolated ranks as a function of probabilities, computed with
the converted approximation formula of Benard.
prob
: An ordered sequence of probabilities with specified b_lives
included.
lower_bound
: Provided, if bounds
is one of "two_sided"
or "lower"
.
Lower confidence limits with respect to direction
, i.e. limits for
quantiles or probabilities.
upper_bound
: Provided, if bounds
is one of "two_sided"
or "upper"
.
Upper confidence limits with respect to direction
, i.e. limits for
quantiles or probabilities.
cdf_estimation_method
: Method for the estimation of failure probabilities which was specified in estimate_cdf.
Further information is stored in the attributes of this tibble:
distribution
: Distribution which was specified in rank_regression.
bounds
: Specified bound(s).
direction
: Specified direction.
model_estimation
: Input list with class wt_model
.
The procedure is similar to the Median Ranks method but with the difference that instead of finding the probability for the j-th rank at the 50% level the probability (probabilities) has (have) to be found at the given confidence level.
# Reliability data preparation:
## Data for two-parametric model:
data_2p <- reliability_data(
shock,
x = distance,
status = status
)
## Data for three-parametric model:
data_3p <- reliability_data(
alloy,
x = cycles,
status = status
)
# Probability estimation:
prob_tbl_2p <- estimate_cdf(
data_2p,
methods = "johnson"
)
prob_tbl_3p <- estimate_cdf(
data_3p,
methods = "johnson"
)
prob_tbl_mult <- estimate_cdf(
data_3p,
methods = c("johnson", "mr")
)
#> The 'mr' method only considers failed units (status == 1) and does not retain intact units (status == 0).
# Model estimation with rank_regression():
rr_2p <- rank_regression(
prob_tbl_2p,
distribution = "weibull"
)
rr_3p <- rank_regression(
prob_tbl_3p,
distribution = "lognormal3",
conf_level = 0.90
)
rr_lists <- rank_regression(
prob_tbl_mult,
distribution = "loglogistic3",
conf_level = 0.90
)
# Example 1 - Two-sided 95% confidence interval for probabilities ('y'):
conf_betabin_1 <- confint_betabinom(
x = rr_2p,
bounds = "two_sided",
conf_level = 0.95,
direction = "y"
)
# Example 2 - One-sided lower/upper 90% confidence interval for quantiles ('x'):
conf_betabin_2_1 <- confint_betabinom(
x = rr_2p,
bounds = "lower",
conf_level = 0.90,
direction = "x"
)
conf_betabin_2_2 <- confint_betabinom(
x = rr_2p,
bounds = "upper",
conf_level = 0.90,
direction = "x"
)
# Example 3 - Two-sided 90% confidence intervals for both directions using
# a three-parametric model:
conf_betabin_3_1 <- confint_betabinom(
x = rr_3p,
bounds = "two_sided",
conf_level = 0.90,
direction = "y"
)
conf_betabin_3_2 <- confint_betabinom(
x = rr_3p,
bounds = "two_sided",
conf_level = 0.90,
direction = "x"
)
# Example 4 - Confidence intervals if multiple methods in estimate_cdf, i.e.
# "johnson" and "mr", were specified:
conf_betabin_4 <- confint_betabinom(
x = rr_lists,
bounds = "two_sided",
conf_level = 0.99,
direction = "y"
)