Skip to contents

This function creates an interactive probability plot for one or more wblr objects. When a list of objects is provided the models are overlaid on the same plot, each rendered in a distinct color. All objects must use the same distribution family. It can include confidence bounds, suspension data (single object only), and a results table.

Usage

plotly_wblr(
  wblr_obj,
  susp = NULL,
  showConf = TRUE,
  showSusp = TRUE,
  showGrid = TRUE,
  main = "Probability Plot",
  xlab = "Time to Failure",
  ylab = "Probability",
  probCol = "black",
  fitCol = "black",
  confCol = "black",
  intCol = "black",
  gridCol = "lightgray",
  signif = 3,
  cols = NULL
)

Arguments

wblr_obj

A single object of class 'wblr', or a list of such objects. This is a required argument. Each object must use the same distribution (e.g. all Weibull or all lognormal). Suspension subplots are only shown when a single object is provided.

susp

An optional numeric vector of suspension data. Default is NULL. Ignored when multiple wblr objects are provided.

showConf

Show the confidence bounds (TRUE) or not (FALSE). Default is TRUE if confidence bounds are available in the wblr object.

showSusp

Show the suspensions plot (TRUE) or not (FALSE). Default is TRUE if susp is provided.

showGrid

Show grid (TRUE) or hide grid (FALSE). Default is TRUE.

main

Main title. Default is 'Probability Plot'.

xlab

X-axis label. Default is 'Time to Failure'.

ylab

Y-axis label. Default is 'Probability'.

probCol

Color of the probability values. Default is 'black'. Used only for a single wblr object; ignored when `cols` is provided or multiple objects are supplied.

fitCol

Color of the model fit. Default is 'black'. Used only for a single wblr object; ignored when `cols` is provided or multiple objects are supplied.

confCol

Color of the confidence bounds. Default is 'black'. Used only for a single wblr object; ignored when `cols` is provided or multiple objects are supplied.

intCol

Color of the intervals for interval censored models. Default is 'black'.

gridCol

Color of the grid. Default is 'lightgray'.

signif

Significant digits of results. Default is 3. Must be a positive integer.

cols

Optional character vector of colors, one per wblr object. When provided, each object's data points, fit line, and confidence bounds are all drawn in the corresponding color. Recycled if shorter than the number of objects.

Value

A `plotly` object representing the interactive probability plot.

Examples

library(WeibullR)
library(ReliaPlotR)
failures <- c(30, 49, 82, 90, 96)
obj <- wblr.conf(wblr.fit(wblr(failures)))
plotly_wblr(obj)
suspensions <- c(100, 45, 10) obj <- wblr.conf(wblr.fit(wblr(failures, suspensions))) plotly_wblr(obj, suspensions, fitCol = "blue", confCol = "blue" )
inspection_data <- data.frame( left = c(0, 6.12, 19.92, 29.64, 35.4, 39.72, 45.32, 52.32), right = c(6.12, 19.92, 29.64, 35.4, 39.72, 45.32, 52.32, 63.48), qty = c(5, 16, 12, 18, 18, 2, 6, 17) ) suspensions <- data.frame(time = 63.48, event = 0, qty = 73) obj <- wblr(suspensions, interval = inspection_data) obj <- wblr.fit(obj, method.fit = "mle") obj <- wblr.conf(obj, method.conf = "fm", lty = 2) suspensions <- as.vector(suspensions$time) plotly_wblr(obj, susp = suspensions, fitCol = "red", confCol = "red", intCol = "blue", main = "Parts Cracking Inspection Interval Analysis", ylab = "Cumulative % Cracked", xlab = "Inspection Time" )
failures <- c(25, 30, 42, 49, 55, 67, 73, 82, 90, 96, 101, 110, 120, 132, 145) fit <- wblr.conf(wblr.fit(wblr(failures), dist = "weibull3p")) plotly_wblr(fit, fitCol = "darkgreen", confCol = "darkgreen")
# Overlay two Weibull models obj2 <- wblr.conf(wblr.fit(wblr(c(20, 40, 60, 80, 100)), method.fit = "mle"), method.conf = "lrb") obj3 <- wblr.conf(wblr.fit(wblr(c(10, 30, 50, 70, 90)), method.fit = "mle"), method.conf = "lrb") plotly_wblr(list(obj2, obj3))