Learn R Programming

weibulltools (version 2.0.0)

confint_betabinom.default: Beta Binomial Confidence Bounds for Quantiles and Probabilities

Description

This non-parametric approach computes the beta binomial bounds (BB) for quantiles and failure probabilities using a procedure similar to the calculation of probabilities in terms of (Median Ranks).

Usage

# S3 method for default
confint_betabinom(
  x,
  status,
  dist_params,
  distribution = c("weibull", "lognormal", "loglogistic", "normal", "logistic", "sev",
    "weibull3", "lognormal3", "loglogistic3"),
  b_lives = c(0.01, 0.1, 0.5),
  bounds = c("two_sided", "lower", "upper"),
  conf_level = 0.95,
  direction = c("y", "x"),
  ...
)

Value

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 limit of the confidence region with respect to direction, i.e. quantiles or probabilities.

  • upper_bound : Provided, if bounds is one of "two_sided" or "upper". Upper limit of the confidence region with respect to direction, i.e. quantiles or probabilities.

  • distribution : Specified distribution.

  • bounds : Specified bound(s).

  • direction : Specified direction.

  • cdf_estimation_method : A character that is always NA_character. Due to the generic visualization functions this column has to be provided.

Arguments

x

A numeric vector which consists of lifetime data. Lifetime data could be every characteristic influencing the reliability of a product, e.g. operating time (days/months in service), mileage (km, miles), load cycles.

status

A vector of binary data (0 or 1) indicating whether unit i is a right censored observation (= 0) or a failure (= 1).

dist_params

A (named) numeric vector of (log-)location-scale parameters returned from rank_regression.

distribution

Supposed distribution of the random variable. Has to be in line with the specification made in rank_regression.

b_lives

A numeric vector indicating the probabilities p of the \(B_p\)-lives (quantiles) to be considered.

bounds

A character string specifying of which bounds have to be computed. One of "two_sided", "lower" or "upper".

conf_level

Confidence level of the interval.

direction

A character string specifying the direction of the confidence interval. One of "y" (failure probabilities) or "x" (quantiles).

...

Further arguments passed to or from other methods. Currently not used.

Details

The difference to Median Ranks, i.e. finding the probability of rank j at a 50% level, is to determine the probability of rank j on another level, the specified confidence level.

See Also

confint_betabinom

Examples

Run this code
# Vectors:
obs <- seq(10000, 100000, 10000)
status_1 <- c(0, 1, 1, 0, 0, 0, 1, 0, 1, 0)

cycles <- alloy$cycles
status_2 <- alloy$status

# Probability estimation:
prob_tbl <- estimate_cdf(
  x = obs,
  status = status_1,
  method = "johnson"
)

prob_tbl_2 <- estimate_cdf(
  x = cycles,
  status = status_2,
  method = "johnson"
)

# Model estimation with rank_regression():
rr <- rank_regression(
  x = prob_tbl$x,
  y = prob_tbl$prob,
  status = prob_tbl$status,
  distribution = "weibull",
  conf_level = 0.9
)

rr_2 <- rank_regression(
  x = prob_tbl_2$x,
  y = prob_tbl_2$prob,
  status = prob_tbl_2$status,
  distribution = "lognormal3"
)

# Example 1 - Two-sided 95% confidence interval for probabilities ('y'):
conf_betabin_1 <- confint_betabinom(
  x = prob_tbl$x,
  status = prob_tbl$status,
  dist_params = rr$coefficients,
  distribution = "weibull",
  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 = prob_tbl$x,
  status = prob_tbl$status,
  dist_params = rr$coefficients,
  distribution = "weibull",
  bounds = "lower",
  conf_level = 0.9,
  direction = "x"
)

conf_betabin_2_2 <- confint_betabinom(
  x = prob_tbl$x,
  status = prob_tbl$status,
  dist_params = rr$coefficients,
  distribution = "weibull",
  bounds = "upper",
  conf_level = 0.9,
  direction = "x"
)

# Example 3 - Two-sided 90% confidence intervals for both directions using
# a three-parametric model:

conf_betabin_3_1 <- confint_betabinom(
  x = prob_tbl_2$x,
  status = prob_tbl_2$status,
  dist_params = rr_2$coefficients,
  distribution = "lognormal3",
  bounds = "two_sided",
  conf_level = 0.9,
  direction = "y"
)

conf_betabin_3_2 <- confint_betabinom(
  x = prob_tbl_2$x,
  status = prob_tbl_2$status,
  dist_params = rr_2$coefficients,
  distribution = "lognormal3",
  bounds = "two_sided",
  conf_level = 0.9,
  direction = "x"
)

Run the code above in your browser using DataLab