The function creates an interactive reliability growth plot for one or more `rga` objects. When a list of objects is provided the models are overlaid on the same plot, each rendered in a distinct color. The plot includes cumulative failures over time, the model fit, and optional confidence bounds. Vertical lines indicate change points if breakpoints are specified in the rga object.
Usage
plotly_rga(
rga_obj,
showConf = TRUE,
showGrid = TRUE,
main = "Reliability Growth Plot",
xlab = "Cumulative Time",
ylab = "Cumulative Failures",
pointCol = "black",
fitCol = "black",
confCol = "black",
gridCol = "lightgray",
breakCol = "black",
signif = 3,
cols = NULL
)Arguments
- rga_obj
An object of class 'rga', or a list of such objects. Each object is created using the `rga()` function from the `ReliaGrowR` package.
- showConf
Show the confidence bounds (TRUE) or not (FALSE). Default is TRUE.
- showGrid
Show grid (TRUE) or hide grid (FALSE). Default is TRUE.
- main
Main title. Default is "Reliability Growth Plot".
- xlab
X-axis label. Default is "Cumulative Time".
- ylab
Y-axis label. Default is "Cumulative Failures".
- pointCol
Color of the point values. Default is "black". Used only for a single rga 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 rga 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 rga object; ignored when `cols` is provided or multiple objects are supplied.
- gridCol
Color of the grid. Default is "lightgray".
- breakCol
Color of the breakpoints. Default is "black". Used only for a single rga object; ignored when `cols` is provided or multiple objects are supplied.
- signif
Significant digits of results. Default is 3. Must be a positive integer.
- cols
Optional character vector of colors, one per rga object. When provided, each object's points, fit line, confidence bounds, and breakpoints are all drawn in the corresponding color. Recycled if shorter than the number of objects.
Examples
library(ReliaGrowR)
times <- c(100, 200, 300, 400, 500)
failures <- c(1, 2, 1, 3, 2)
rga <- rga(times, failures)
plotly_rga(rga)
times <- c(100, 200, 300, 400, 500, 600, 700, 800, 900, 1000)
failures <- c(1, 2, 1, 1, 1, 2, 3, 1, 2, 4)
breakpoints <- 400
rga2 <- rga(times, failures, model_type = "Piecewise NHPP", breaks = breakpoints)
#> Warning: Breakpoint estimate(s) outdistanced to allow finite estimates and st.errs
plotly_rga(rga2, fitCol = "blue", confCol = "blue", breakCol = "red")
# Overlay two models
rga3 <- rga(c(50, 150, 250, 350, 450), c(2, 1, 3, 1, 2))
plotly_rga(list(rga, rga3))