| Title: | Reliability Growth Analysis and Repairable Systems Modeling |
|---|---|
| Description: | Modeling and plotting functions for Reliability Growth Analysis (RGA) and Non-Homogeneous Poisson Process (NHPP) models for repairable systems. RGA models include the Duane (1962) <doi:10.1109/TA.1964.4319640>, NHPP by Crow (1975) (No. AMSAATR138), Piecewise Weibull NHPP by Guo et al. (2010) <doi:10.1109/RAMS.2010.5448029>, and Piecewise Weibull NHPP with Change Point Detection based on the 'segmented' package by Muggeo (2024) <https://cran.r-project.org/package=segmented>. Repairable systems functions include the Mean Cumulative Function (MCF) using the Nelson-Aalen estimator, parametric Power Law and Log-Linear NHPP models, and forecasting. |
| Authors: | Paul Govan [aut, cre, cph] (ORCID: <https://orcid.org/0000-0002-1821-8492>) |
| Maintainer: | Paul Govan <[email protected]> |
| License: | CC BY 4.0 |
| Version: | 0.7 |
| Built: | 2026-05-22 16:31:44 UTC |
| Source: | https://github.com/paulgovan/reliagrowr |
This function performs a Duane analysis (1962) https://doi.org/10.1109/TA.1964.4319640
on failure data by fitting a log-log linear regression of cumulative Mean Time
Between Failures (MTBF) versus cumulative time. The function accepts either
two numeric vectors (times, failures) or a data frame containing both.
duane(times, failures = NULL, conf_level = 0.95, conf.level = NULL)duane(times, failures = NULL, conf_level = 0.95, conf.level = NULL)
times |
Either:
|
failures |
A numeric vector of the number of failures at each corresponding
time in |
conf_level |
Confidence level for the confidence bounds (default: |
conf.level |
Deprecated. Use |
The scaling relationship between the size of input data (numbers of observations) and speed of algorithm execution is approximately linear (O(n)). The function is efficient and can handle large data sets (e.g., thousands of observations) quickly. The function uses base R functions and does not require any additional packages. The function includes comprehensive input validation and error handling to ensure robustness. The function is tested with a standard data set from a published paper and includes unit tests to verify correctness and performance.
A list of class "duane" containing:
times |
The input exact failure times. |
failures |
The input number of failures. |
n_obs |
The number of observations (failures). |
MTBF |
The cumulative mean time between failures. |
model |
The fitted |
logLik |
The log-likelihood of the fitted model. |
AIC |
Akaike Information Criterion (AIC). |
BIC |
Bayesian Information Criterion (BIC). |
conf_level |
The confidence level. |
Cumulative_Time |
The cumulative operating times. |
Cumulative_MTBF |
The cumulative mean time between failures. |
Fitted_Values |
The fitted values on the MTBF scale. |
Confidence_Bounds |
Matrix of fitted values and confidence bounds on the MTBF scale. |
Residuals_Log |
Residuals on the log(MTBF) scale (from the regression). |
Residuals_MTBF |
Residuals on the MTBF scale (observed - fitted). |
Other Duane functions:
plot.duane(),
plot.duane_predict(),
predict_duane(),
print.duane(),
print.duane_predict()
times <- c(100, 200, 300, 400, 500) failures <- c(1, 2, 1, 3, 2) fit1 <- duane(times, failures, conf_level = 0.90) print(fit1) df <- data.frame(times = times, failures = failures) fit2 <- duane(df, conf_level = 0.95) print(fit2)times <- c(100, 200, 300, 400, 500) failures <- c(1, 2, 1, 3, 2) fit1 <- duane(times, failures, conf_level = 0.90) print(fit1) df <- data.frame(times = times, failures = failures) fit2 <- duane(df, conf_level = 0.95) print(fit2)
Computes exposure (total operating time at risk) across one or more repairable systems as a function of time. Exposure is defined as the total accumulated observation time summed across all systems still under observation. The function also computes the number of systems at risk and the event rate (events per unit exposure) at each event time.
exposure(id = NULL, time = NULL, event = NULL, data = NULL)exposure(id = NULL, time = NULL, event = NULL, data = NULL)
id |
A vector of system/unit identifiers. Each unique value represents a distinct system. |
time |
A numeric vector of event or censoring times. Must be positive and finite. |
event |
An optional numeric vector of event indicators: 1 for an
event, 0 for censoring (end of observation). If |
data |
An optional data frame containing columns named |
Exposure is the total amount of operating time during which events
can occur. For a fleet of systems observed up to times
, the total exposure is
.
The cumulative exposure at time is
,
i.e., each system contributes time up to the lesser of or its
observation end.
The event rate at time is the cumulative number of events
divided by the cumulative exposure: .
An object of class exposure containing:
time |
Sorted unique event times (excluding censoring-only times). |
n_at_risk |
Number of systems under observation at each event time. |
cum_exposure |
Cumulative total exposure (system-time) up to each event time. |
cum_events |
Cumulative number of events up to each event time. |
event_rate |
Cumulative event rate (cum_events / cum_exposure) at each event time. |
total_exposure |
Total exposure across all systems and the full observation period. |
total_events |
Total number of events. |
n_systems |
Number of distinct systems. |
end_times |
Named numeric vector of end-of-observation times per
system. Can be passed directly to |
Other Repairable Systems Analysis:
mcf(),
nhpp(),
overlay_nhpp(),
plot.exposure(),
plot.mcf(),
plot.nhpp(),
plot.nhpp_predict(),
predict_nhpp(),
print.exposure(),
print.mcf(),
print.nhpp(),
print.nhpp_predict()
id <- c(1, 1, 1, 2, 2, 2, 3, 3, 3, 3) time <- c(100, 350, 500, 80, 300, 600, 150, 250, 400, 700) result <- exposure(id, time) print(result) plot(result) # With censoring id <- c(1, 1, 1, 2, 2, 2, 3, 3, 3) time <- c(100, 350, 500, 80, 300, 400, 150, 250, 700) event <- c( 1, 1, 0, 1, 1, 0, 1, 1, 1) result2 <- exposure(id, time, event) print(result2)id <- c(1, 1, 1, 2, 2, 2, 3, 3, 3, 3) time <- c(100, 350, 500, 80, 300, 600, 150, 250, 400, 700) result <- exposure(id, time) print(result) plot(result) # With censoring id <- c(1, 1, 1, 2, 2, 2, 3, 3, 3) time <- c(100, 350, 500, 80, 300, 400, 150, 250, 700) event <- c( 1, 1, 0, 1, 1, 0, 1, 1, 1) result2 <- exposure(id, time, event) print(result2)
Computes numerical goodness-of-fit statistics for a fitted Reliability Growth
Analysis (RGA) model using the time-transformation approach. For a
Crow-AMSAA (Power Law NHPP) model with parameters and
, the transformed values
should follow a Uniform(0, 1) distribution if the model fits. The
Cramér-von Mises and Kolmogorov-Smirnov statistics are computed against
this null distribution.
gof(x, ...) ## Default S3 method: gof(x, ...) ## S3 method for class 'rga' gof(x, ...)gof(x, ...) ## Default S3 method: gof(x, ...) ## S3 method for class 'rga' gof(x, ...)
x |
An object for which a goodness-of-fit method is defined. |
... |
Additional arguments passed to methods. |
An object of class gof.
Other goodness-of-fit:
ppplot.rga(),
print.gof(),
qqplot.rga()
times <- c(5, 10, 15, 20, 25) failures <- c(1, 2, 1, 3, 2) fit <- rga(times, failures) g <- gof(fit) print(g)times <- c(5, 10, 15, 20, 25) failures <- c(1, 2, 1, 3, 2) fit <- rga(times, failures) g <- gof(fit) print(g)
This function provides an interface to the ReliaGrowR API.#' This function provides an interface to the ReliaGrowR API.
grwr_api()grwr_api()
Launches the ReliaGrowR API on a local server.
## Not run: grwr_api() ## End(Not run)## Not run: grwr_api() ## End(Not run)
Computes the non-parametric Mean Cumulative Function (MCF) for recurrent event data from one or more repairable systems, using the Nelson-Aalen estimator. The MCF estimates the expected cumulative number of events per system as a function of time, properly accounting for system exposure (observation windows).
mcf( id = NULL, time = NULL, event = NULL, end_time = NULL, data = NULL, conf_level = 0.95 )mcf( id = NULL, time = NULL, event = NULL, end_time = NULL, data = NULL, conf_level = 0.95 )
id |
A vector of system/unit identifiers. Each unique value represents
a distinct system. Ignored if |
time |
A numeric vector of event or censoring times. Must be positive
and finite. Ignored if |
event |
An optional numeric vector of event indicators: 1 for an event,
0 for censoring (end of observation). If |
end_time |
An optional named numeric vector of end-of-observation times
per system, where names correspond to system identifiers. This defines
the actual exposure window for each system. When provided, a system
remains in the risk set until its |
data |
An optional data frame containing columns named |
conf_level |
Confidence level for bounds (default 0.95). |
The MCF at time is estimated as:
where is the number of events at time and is
the number of systems still under observation at . Variance is
estimated as .
The risk set is determined by each system's exposure window.
A system is considered at risk at time if its end-of-observation
time (from end_time, censoring records, or last event) is
. Specifying end_time is important when systems were
observed beyond their last event – without it, the MCF may overestimate
the true recurrence rate because systems with no late events are assumed to
have left observation at their last event time.
An object of class mcf containing:
time |
Unique event times. |
mcf |
MCF values at each event time. |
variance |
Variance estimates at each event time. |
lower_bounds |
Lower confidence bounds. |
upper_bounds |
Upper confidence bounds. |
conf_level |
Confidence level used. |
n_systems |
Number of distinct systems. |
n_events |
Total number of events. |
end_times |
Named vector of end-of-observation times per system. |
Other Repairable Systems Analysis:
exposure(),
nhpp(),
overlay_nhpp(),
plot.exposure(),
plot.mcf(),
plot.nhpp(),
plot.nhpp_predict(),
predict_nhpp(),
print.exposure(),
print.mcf(),
print.nhpp(),
print.nhpp_predict()
# Basic usage (end of observation inferred from last event) id <- c(1, 1, 1, 2, 2, 3, 3, 3, 3) time <- c(100, 300, 500, 150, 400, 50, 200, 350, 600) result <- mcf(id, time) print(result) plot(result, main = "Mean Cumulative Function") # With explicit end-of-observation times (exposure-adjusted) end_time <- c("1" = 800, "2" = 800, "3" = 800) result2 <- mcf(id, time, end_time = end_time) print(result2) df <- data.frame(id = id, time = time) result3 <- mcf(data = df) print(result3)# Basic usage (end of observation inferred from last event) id <- c(1, 1, 1, 2, 2, 3, 3, 3, 3) time <- c(100, 300, 500, 150, 400, 50, 200, 350, 600) result <- mcf(id, time) print(result) plot(result, main = "Mean Cumulative Function") # With explicit end-of-observation times (exposure-adjusted) end_time <- c("1" = 800, "2" = 800, "3" = 800) result2 <- mcf(id, time, end_time = end_time) print(result2) df <- data.frame(id = id, time = time) result3 <- mcf(data = df) print(result3)
Fits a parametric NHPP model to recurrent event data from repairable systems. Supported models include the Power Law process and the Log-Linear process. The Power Law model can also be fit as a piecewise (segmented) model with automatic change point detection or user-specified breakpoints.
nhpp( time, event = NULL, data = NULL, model_type = "Power Law", breaks = NULL, method = c("MLE", "LS"), conf_level = 0.95 )nhpp( time, event = NULL, data = NULL, model_type = "Power Law", breaks = NULL, method = c("MLE", "LS"), conf_level = 0.95 )
time |
A numeric vector of cumulative event times, or a data frame
containing columns |
event |
An optional numeric vector of event counts at each time. If
|
data |
An optional data frame containing columns |
model_type |
Model type: |
breaks |
Optional vector of breakpoints for piecewise Power Law model. |
method |
Estimation method: |
conf_level |
Confidence level for bounds (default 0.95). |
The Power Law NHPP models the cumulative number of events as
. The parameter
indicates a deteriorating system (increasing event rate),
an improving system, and a constant rate
(HPP).
The Log-Linear NHPP models the intensity as
with cumulative
function .
An object of class nhpp containing:
time |
The input cumulative event times. |
event |
The event counts. |
cum_events |
Cumulative event counts. |
n_obs |
Number of observations. |
model |
Fitted model object (lm or segmented), or NULL for MLE. |
model_type |
|
method |
|
params |
Named list of estimated parameters. |
params_se |
Named list of standard errors. |
vcov |
Variance-covariance matrix (MLE only). |
fitted_values |
Fitted cumulative events. |
lower_bounds |
Lower confidence bounds. |
upper_bounds |
Upper confidence bounds. |
residuals |
Model residuals. |
logLik |
Log-likelihood. |
AIC |
Akaike Information Criterion. |
BIC |
Bayesian Information Criterion. |
breakpoints |
Breakpoints (log scale) if piecewise model. |
conf_level |
Confidence level used. |
Other Repairable Systems Analysis:
exposure(),
mcf(),
overlay_nhpp(),
plot.exposure(),
plot.mcf(),
plot.nhpp(),
plot.nhpp_predict(),
predict_nhpp(),
print.exposure(),
print.mcf(),
print.nhpp(),
print.nhpp_predict()
time <- c(200, 400, 600, 800, 1000) event <- c(3, 5, 4, 7, 6) result <- nhpp(time, event) print(result) plot(result, main = "Power Law NHPP") result_ll <- nhpp(time, event, model_type = "Log-Linear") print(result_ll)time <- c(200, 400, 600, 800, 1000) event <- c(3, 5, 4, 7, 6) result <- nhpp(time, event) print(result) plot(result, main = "Power Law NHPP") result_ll <- nhpp(time, event, model_type = "Log-Linear") print(result_ll)
Plots multiple fitted nhpp objects on a single set of axes, using
distinct colors per model. Observed data points, fitted lines, and optional
confidence bounds are drawn for every model. Models may have been fit to
different datasets.
overlay_nhpp( models, conf_bounds = TRUE, legend = TRUE, legend_pos = "topleft", colors = NULL, ... )overlay_nhpp( models, conf_bounds = TRUE, legend = TRUE, legend_pos = "topleft", colors = NULL, ... )
models |
A named or unnamed list of objects of class |
conf_bounds |
Logical; draw confidence bounds for each model
(default: |
legend |
Logical; draw a legend (default: |
legend_pos |
Legend position keyword (default: |
colors |
Optional character vector of colors, one per model. If
|
... |
Additional arguments passed to the initial |
Invisibly returns NULL.
Other Repairable Systems Analysis:
exposure(),
mcf(),
nhpp(),
plot.exposure(),
plot.mcf(),
plot.nhpp(),
plot.nhpp_predict(),
predict_nhpp(),
print.exposure(),
print.mcf(),
print.nhpp(),
print.nhpp_predict()
t1 <- c(200, 400, 600, 800, 1000) e1 <- c(3, 5, 4, 7, 6) t2 <- c(300, 600, 900, 1200, 1500) e2 <- c(4, 6, 5, 8, 7) m1 <- nhpp(t1, e1) m2 <- nhpp(t2, e2) overlay_nhpp(list(System_A = m1, System_B = m2), main = "NHPP Overlay", xlab = "Time", ylab = "Cumulative Events" )t1 <- c(200, 400, 600, 800, 1000) e1 <- c(3, 5, 4, 7, 6) t2 <- c(300, 600, 900, 1200, 1500) e2 <- c(4, 6, 5, 8, 7) m1 <- nhpp(t1, e1) m2 <- nhpp(t2, e2) overlay_nhpp(list(System_A = m1, System_B = m2), main = "NHPP Overlay", xlab = "Time", ylab = "Cumulative Events" )
Plots multiple fitted rga objects on a single set of axes, using
distinct colors per model. Observed data points, fitted lines, and optional
confidence bounds are drawn for every model. Models may have been fit to
different datasets.
overlay_rga( models, conf_bounds = TRUE, legend = TRUE, legend_pos = "bottomright", colors = NULL, log = FALSE, ... )overlay_rga( models, conf_bounds = TRUE, legend = TRUE, legend_pos = "bottomright", colors = NULL, log = FALSE, ... )
models |
A named or unnamed list of objects of class |
conf_bounds |
Logical; draw confidence bounds for each model
(default: |
legend |
Logical; draw a legend (default: |
legend_pos |
Legend position keyword (default: |
colors |
Optional character vector of colors, one per model. If
|
log |
Logical; use log-log axes (default: |
... |
Additional arguments passed to the initial |
Invisibly returns NULL.
Other Reliability Growth Analysis:
plot.rga(),
plot.rga_predict(),
predict_rga(),
print.rga(),
print.rga_predict(),
rga()
t1 <- c(100, 200, 300, 400, 500) f1 <- c(1, 2, 1, 3, 2) t2 <- c(150, 300, 450, 600, 750) f2 <- c(2, 1, 3, 2, 4) m1 <- rga(t1, f1) m2 <- rga(t2, f2) overlay_rga(list(System_A = m1, System_B = m2), main = "RGA Overlay", xlab = "Cumulative Time", ylab = "Cumulative Failures" )t1 <- c(100, 200, 300, 400, 500) f1 <- c(1, 2, 1, 3, 2) t2 <- c(150, 300, 450, 600, 750) f2 <- c(2, 1, 3, 2, 4) m1 <- rga(t1, f1) m2 <- rga(t2, f2) overlay_rga(list(System_A = m1, System_B = m2), main = "RGA Overlay", xlab = "Cumulative Time", ylab = "Cumulative Failures" )
Generates a Duane plot (log-log or linear scale) with fitted regression line and optional confidence bounds.
## S3 method for class 'duane' plot( x, log = TRUE, conf_bounds = TRUE, legend = TRUE, legend_pos = "topleft", conf.int = NULL, legend.pos = NULL, ... )## S3 method for class 'duane' plot( x, log = TRUE, conf_bounds = TRUE, legend = TRUE, legend_pos = "topleft", conf.int = NULL, legend.pos = NULL, ... )
x |
An object of class |
log |
Logical; whether to use logarithmic scales for axes (default: |
conf_bounds |
Logical; whether to plot confidence bounds (default: |
legend |
Logical; whether to include a legend (default: TRUE). |
legend_pos |
Position of the legend (default: "topleft"). |
conf.int |
Deprecated. Use |
legend.pos |
Deprecated. Use |
... |
Further arguments passed to |
Invisibly returns NULL.
Other Duane functions:
duane(),
plot.duane_predict(),
predict_duane(),
print.duane(),
print.duane_predict()
times <- c(100, 200, 300, 400, 500) failures <- c(1, 2, 1, 3, 2) fit <- duane(times, failures) plot(fit, main = "Duane Plot", xlab = "Cumulative Time", ylab = "Cumulative MTBF")times <- c(100, 200, 300, 400, 500) failures <- c(1, 2, 1, 3, 2) fit <- duane(times, failures) plot(fit, main = "Duane Plot", xlab = "Cumulative Time", ylab = "Cumulative MTBF")
Plots observed MTBF, fitted Duane curve, and forecast with optional confidence
bounds for a duane_predict object.
## S3 method for class 'duane_predict' plot(x, conf_bounds = TRUE, legend = TRUE, legend_pos = "topleft", ...)## S3 method for class 'duane_predict' plot(x, conf_bounds = TRUE, legend = TRUE, legend_pos = "topleft", ...)
x |
An object of class |
conf_bounds |
Logical; include confidence bounds (default: |
legend |
Logical; show the legend (default: |
legend_pos |
Position of the legend (default: |
... |
Additional arguments passed to |
Invisibly returns NULL.
Other Duane functions:
duane(),
plot.duane(),
predict_duane(),
print.duane(),
print.duane_predict()
times <- c(100, 200, 300, 400, 500) failures <- c(1, 2, 1, 3, 2) fit <- duane(times, failures) fc <- predict_duane(fit, times = c(1000, 2000)) plot(fc, main = "Duane Forecast", xlab = "Cumulative Time", ylab = "MTBF")times <- c(100, 200, 300, 400, 500) failures <- c(1, 2, 1, 3, 2) fit <- duane(times, failures) fc <- predict_duane(fit, times = c(1000, 2000)) plot(fc, main = "Duane Forecast", xlab = "Cumulative Time", ylab = "MTBF")
Produces a multi-panel plot of exposure analysis results. The default
layout shows cumulative exposure and cumulative events versus time
(top panel), the number of systems at risk over time (middle panel),
and the event rate over time (bottom panel). Alternatively, a single
which panel can be selected.
## S3 method for class 'exposure' plot( x, which = c("all", "exposure", "at_risk", "event_rate"), legend = TRUE, legend_pos = "topleft", ... )## S3 method for class 'exposure' plot( x, which = c("all", "exposure", "at_risk", "event_rate"), legend = TRUE, legend_pos = "topleft", ... )
x |
An object of class |
which |
Character string selecting which panel(s) to plot. One of
|
legend |
Logical; show the legend (default: TRUE). |
legend_pos |
Position of the legend (default: "topleft"). |
... |
Additional arguments passed to the underlying |
Invisibly returns NULL.
Other Repairable Systems Analysis:
exposure(),
mcf(),
nhpp(),
overlay_nhpp(),
plot.mcf(),
plot.nhpp(),
plot.nhpp_predict(),
predict_nhpp(),
print.exposure(),
print.mcf(),
print.nhpp(),
print.nhpp_predict()
id <- c(1, 1, 1, 2, 2, 2, 3, 3, 3, 3) time <- c(100, 350, 500, 80, 300, 600, 150, 250, 400, 700) result <- exposure(id, time) plot(result) plot(result, which = "exposure")id <- c(1, 1, 1, 2, 2, 2, 3, 3, 3, 3) time <- c(100, 350, 500, 80, 300, 600, 150, 250, 400, 700) result <- exposure(id, time) plot(result) plot(result, which = "exposure")
Plots the Mean Cumulative Function with optional confidence bounds.
## S3 method for class 'mcf' plot(x, conf_bounds = TRUE, legend = TRUE, legend_pos = "topleft", ...)## S3 method for class 'mcf' plot(x, conf_bounds = TRUE, legend = TRUE, legend_pos = "topleft", ...)
x |
An object of class |
conf_bounds |
Logical; include confidence bounds (default: TRUE). |
legend |
Logical; show the legend (default: TRUE). |
legend_pos |
Position of the legend (default: "topleft"). |
... |
Additional arguments passed to |
Invisibly returns NULL.
Other Repairable Systems Analysis:
exposure(),
mcf(),
nhpp(),
overlay_nhpp(),
plot.exposure(),
plot.nhpp(),
plot.nhpp_predict(),
predict_nhpp(),
print.exposure(),
print.mcf(),
print.nhpp(),
print.nhpp_predict()
id <- c(1, 1, 1, 2, 2, 3, 3, 3, 3) time <- c(100, 300, 500, 150, 400, 50, 200, 350, 600) result <- mcf(id, time) plot(result, main = "Mean Cumulative Function")id <- c(1, 1, 1, 2, 2, 3, 3, 3, 3) time <- c(100, 300, 500, 150, 400, 50, 200, 350, 600) result <- mcf(id, time) plot(result, main = "Mean Cumulative Function")
Plots observed cumulative events with the fitted NHPP model and optional confidence bounds.
## S3 method for class 'nhpp' plot(x, conf_bounds = TRUE, legend = TRUE, legend_pos = "topleft", ...)## S3 method for class 'nhpp' plot(x, conf_bounds = TRUE, legend = TRUE, legend_pos = "topleft", ...)
x |
An object of class |
conf_bounds |
Logical; include confidence bounds (default: TRUE). |
legend |
Logical; show the legend (default: TRUE). |
legend_pos |
Position of the legend (default: "topleft"). |
... |
Additional arguments passed to |
Invisibly returns NULL.
Other Repairable Systems Analysis:
exposure(),
mcf(),
nhpp(),
overlay_nhpp(),
plot.exposure(),
plot.mcf(),
plot.nhpp_predict(),
predict_nhpp(),
print.exposure(),
print.mcf(),
print.nhpp(),
print.nhpp_predict()
time <- c(200, 400, 600, 800, 1000) event <- c(3, 5, 4, 7, 6) result <- nhpp(time, event) plot(result, main = "Power Law NHPP", xlab = "Time", ylab = "Cumulative Events")time <- c(200, 400, 600, 800, 1000) event <- c(3, 5, 4, 7, 6) result <- nhpp(time, event) plot(result, main = "Power Law NHPP", xlab = "Time", ylab = "Cumulative Events")
Plots observed data, fitted model, and forecast with optional confidence bounds.
## S3 method for class 'nhpp_predict' plot(x, conf_bounds = TRUE, legend = TRUE, legend_pos = "topleft", ...)## S3 method for class 'nhpp_predict' plot(x, conf_bounds = TRUE, legend = TRUE, legend_pos = "topleft", ...)
x |
An object of class |
conf_bounds |
Logical; include confidence bounds (default: TRUE). |
legend |
Logical; show the legend (default: TRUE). |
legend_pos |
Position of the legend (default: "topleft"). |
... |
Additional arguments passed to |
Invisibly returns NULL.
Other Repairable Systems Analysis:
exposure(),
mcf(),
nhpp(),
overlay_nhpp(),
plot.exposure(),
plot.mcf(),
plot.nhpp(),
predict_nhpp(),
print.exposure(),
print.mcf(),
print.nhpp(),
print.nhpp_predict()
time <- c(200, 400, 600, 800, 1000) event <- c(3, 5, 4, 7, 6) fit <- nhpp(time, event) fc <- predict_nhpp(fit, time = c(1500, 2000)) plot(fc, main = "NHPP Forecast", xlab = "Time", ylab = "Cumulative Events")time <- c(200, 400, 600, 800, 1000) event <- c(3, 5, 4, 7, 6) fit <- nhpp(time, event) fc <- predict_nhpp(fit, time = c(1500, 2000)) plot(fc, main = "NHPP Forecast", xlab = "Time", ylab = "Cumulative Events")
This function generates plots for objects of class rga.
## S3 method for class 'rga' plot( x, conf_bounds = TRUE, legend = TRUE, log = FALSE, legend_pos = "bottomright", ... )## S3 method for class 'rga' plot( x, conf_bounds = TRUE, legend = TRUE, log = FALSE, legend_pos = "bottomright", ... )
x |
An object of class |
conf_bounds |
Logical; include confidence bounds (default: TRUE). |
legend |
Logical; show the legend (default: TRUE). |
log |
Logical; use a log-log scale (default: FALSE). |
legend_pos |
Position of the legend (default: "bottomright"). |
... |
Additional arguments passed to |
Invisibly returns NULL.
Other Reliability Growth Analysis:
overlay_rga(),
plot.rga_predict(),
predict_rga(),
print.rga(),
print.rga_predict(),
rga()
times <- c(100, 200, 300, 400, 500) failures <- c(1, 2, 1, 3, 2) result <- rga(times, failures) plot(result, main = "Reliability Growth Analysis", xlab = "Cumulative Time", ylab = "Cumulative Failures" )times <- c(100, 200, 300, 400, 500) failures <- c(1, 2, 1, 3, 2) result <- rga(times, failures) plot(result, main = "Reliability Growth Analysis", xlab = "Cumulative Time", ylab = "Cumulative Failures" )
Plots observed data, the fitted reliability growth curve, and the forecast
with optional confidence bounds for an rga_predict object.
## S3 method for class 'rga_predict' plot(x, conf_bounds = TRUE, legend = TRUE, legend_pos = "bottomright", ...)## S3 method for class 'rga_predict' plot(x, conf_bounds = TRUE, legend = TRUE, legend_pos = "bottomright", ...)
x |
An object of class |
conf_bounds |
Logical; include confidence bounds (default: |
legend |
Logical; show the legend (default: |
legend_pos |
Position of the legend (default: |
... |
Additional arguments passed to |
Invisibly returns NULL.
Other Reliability Growth Analysis:
overlay_rga(),
plot.rga(),
predict_rga(),
print.rga(),
print.rga_predict(),
rga()
times <- c(100, 200, 300, 400, 500) failures <- c(1, 2, 1, 3, 2) fit <- rga(times, failures) fc <- predict_rga(fit, times = c(1500, 2000)) plot(fc, main = "RGA Forecast", xlab = "Cumulative Time", ylab = "Cumulative Failures")times <- c(100, 200, 300, 400, 500) failures <- c(1, 2, 1, 3, 2) fit <- rga(times, failures) fc <- predict_rga(fit, times = c(1500, 2000)) plot(fc, main = "RGA Forecast", xlab = "Cumulative Time", ylab = "Cumulative Failures")
This function creates a P-P plot for a fitted Reliability Growth Analysis (RGA) model. Currently only supports the Crow-AMSAA model. A P-P plot compares the empirical cumulative distribution function (CDF) to the theoretical CDF specified by the model. If the model fits well, the points should fall approximately along a straight line.
ppplot.rga(x, main = "P-P Plot", ...)ppplot.rga(x, main = "P-P Plot", ...)
x |
An object of class |
main |
Title of the plot. |
... |
Additional arguments passed to |
A P-P plot comparing empirical and theoretical CDFs.
Other goodness-of-fit:
gof(),
print.gof(),
qqplot.rga()
times <- c(5, 10, 15, 20, 25) failures <- c(1, 2, 1, 3, 2) fit <- rga(times, failures) ppplot.rga(fit)times <- c(5, 10, 15, 20, 25) failures <- c(1, 2, 1, 3, 2) fit <- rga(times, failures) ppplot.rga(fit)
Takes a fitted duane object and a vector of cumulative times, returning
predicted MTBF with confidence bounds as a duane_predict S3 object.
predict_duane(object, times, conf_level = 0.95)predict_duane(object, times, conf_level = 0.95)
object |
An object of class |
times |
A numeric vector of cumulative times at which to forecast MTBF. All values must be finite and > 0. A warning is issued if any value is at or below the maximum observed cumulative time (hindcasting). |
conf_level |
The desired confidence level (default |
An object of class duane_predict containing:
times |
The forecast cumulative times. |
mtbf |
Predicted MTBF values. |
lower_bounds |
Lower confidence bounds on MTBF. |
upper_bounds |
Upper confidence bounds on MTBF. |
conf_level |
The confidence level used. |
duane_object |
The original |
Other Duane functions:
duane(),
plot.duane(),
plot.duane_predict(),
print.duane(),
print.duane_predict()
times <- c(100, 200, 300, 400, 500) failures <- c(1, 2, 1, 3, 2) fit <- duane(times, failures) fc <- predict_duane(fit, times = c(1000, 2000)) print(fc)times <- c(100, 200, 300, 400, 500) failures <- c(1, 2, 1, 3, 2) fit <- duane(times, failures) fc <- predict_duane(fit, times = c(1000, 2000)) print(fc)
Takes a fitted nhpp object and a vector of future cumulative times,
returning predicted cumulative events with confidence bounds.
predict_nhpp(object, time, conf_level = 0.95)predict_nhpp(object, time, conf_level = 0.95)
object |
An object of class |
time |
A numeric vector of cumulative times at which to forecast. All values must be finite and > 0. |
conf_level |
Confidence level (default 0.95). |
An object of class nhpp_predict containing:
time |
Forecast times. |
cum_events |
Predicted cumulative events. |
lower_bounds |
Lower confidence bounds. |
upper_bounds |
Upper confidence bounds. |
conf_level |
Confidence level used. |
model_type |
Model type. |
nhpp_object |
The original nhpp object. |
Other Repairable Systems Analysis:
exposure(),
mcf(),
nhpp(),
overlay_nhpp(),
plot.exposure(),
plot.mcf(),
plot.nhpp(),
plot.nhpp_predict(),
print.exposure(),
print.mcf(),
print.nhpp(),
print.nhpp_predict()
time <- c(200, 400, 600, 800, 1000) event <- c(3, 5, 4, 7, 6) fit <- nhpp(time, event) fc <- predict_nhpp(fit, time = c(1500, 2000)) print(fc) plot(fc, main = "NHPP Forecast", xlab = "Time", ylab = "Cumulative Events")time <- c(200, 400, 600, 800, 1000) event <- c(3, 5, 4, 7, 6) fit <- nhpp(time, event) fc <- predict_nhpp(fit, time = c(1500, 2000)) print(fc) plot(fc, main = "NHPP Forecast", xlab = "Time", ylab = "Cumulative Events")
Takes a fitted rga object and a vector of cumulative times, returning
predicted cumulative failures with confidence bounds as an rga_predict
S3 object.
predict_rga(object, times, conf_level = 0.95)predict_rga(object, times, conf_level = 0.95)
object |
An object of class |
times |
A numeric vector of cumulative times at which to forecast. All values must be finite and > 0. A warning is issued if any value is at or below the maximum observed cumulative time (hindcasting). |
conf_level |
The desired confidence level (default |
An object of class rga_predict containing:
times |
The forecast cumulative times. |
cum_failures |
Predicted cumulative failures. |
lower_bounds |
Lower confidence bounds. |
upper_bounds |
Upper confidence bounds. |
conf_level |
The confidence level used. |
model_type |
Either |
rga_object |
The original |
Other Reliability Growth Analysis:
overlay_rga(),
plot.rga(),
plot.rga_predict(),
print.rga(),
print.rga_predict(),
rga()
times <- c(100, 200, 300, 400, 500) failures <- c(1, 2, 1, 3, 2) fit <- rga(times, failures) fc <- predict_rga(fit, times = c(1500, 2000)) print(fc)times <- c(100, 200, 300, 400, 500) failures <- c(1, 2, 1, 3, 2) fit <- rga(times, failures) fc <- predict_rga(fit, times = c(1500, 2000)) print(fc)
This function prints a summary of the Duane analysis result.
## S3 method for class 'duane' print(x, ...)## S3 method for class 'duane' print(x, ...)
x |
An object of class "duane" returned by the duane_plot function. |
... |
Additional arguments (not used). |
Invisibly returns the input object.
Other Duane functions:
duane(),
plot.duane(),
plot.duane_predict(),
predict_duane(),
print.duane_predict()
times <- c(100, 200, 300, 400, 500) failures <- c(1, 2, 1, 3, 2) fit <- duane(times, failures) print(fit)times <- c(100, 200, 300, 400, 500) failures <- c(1, 2, 1, 3, 2) fit <- duane(times, failures) print(fit)
Prints a formatted table of forecast MTBF with confidence bounds.
## S3 method for class 'duane_predict' print(x, ...)## S3 method for class 'duane_predict' print(x, ...)
x |
An object of class |
... |
Additional arguments (not used). |
Invisibly returns the input object.
Other Duane functions:
duane(),
plot.duane(),
plot.duane_predict(),
predict_duane(),
print.duane()
times <- c(100, 200, 300, 400, 500) failures <- c(1, 2, 1, 3, 2) fit <- duane(times, failures) fc <- predict_duane(fit, times = c(1000, 2000)) print(fc)times <- c(100, 200, 300, 400, 500) failures <- c(1, 2, 1, 3, 2) fit <- duane(times, failures) fc <- predict_duane(fit, times = c(1000, 2000)) print(fc)
Prints a summary of the exposure analysis results.
## S3 method for class 'exposure' print(x, ...)## S3 method for class 'exposure' print(x, ...)
x |
An object of class |
... |
Additional arguments (not used). |
Invisibly returns the input object.
Other Repairable Systems Analysis:
exposure(),
mcf(),
nhpp(),
overlay_nhpp(),
plot.exposure(),
plot.mcf(),
plot.nhpp(),
plot.nhpp_predict(),
predict_nhpp(),
print.mcf(),
print.nhpp(),
print.nhpp_predict()
id <- c(1, 1, 2, 2) time <- c(100, 200, 150, 300) result <- exposure(id, time) print(result)id <- c(1, 1, 2, 2) time <- c(100, 200, 150, 300) result <- exposure(id, time) print(result)
Prints a summary of goodness-of-fit statistics.
## S3 method for class 'gof' print(x, ...)## S3 method for class 'gof' print(x, ...)
x |
An object of class |
... |
Additional arguments (not used). |
Invisibly returns the input object.
Other goodness-of-fit:
gof(),
ppplot.rga(),
qqplot.rga()
times <- c(5, 10, 15, 20, 25) failures <- c(1, 2, 1, 3, 2) fit <- rga(times, failures) g <- gof(fit) print(g)times <- c(5, 10, 15, 20, 25) failures <- c(1, 2, 1, 3, 2) fit <- rga(times, failures) g <- gof(fit) print(g)
Prints a summary of the Mean Cumulative Function results.
## S3 method for class 'mcf' print(x, ...)## S3 method for class 'mcf' print(x, ...)
x |
An object of class |
... |
Additional arguments (not used). |
Invisibly returns the input object.
Other Repairable Systems Analysis:
exposure(),
mcf(),
nhpp(),
overlay_nhpp(),
plot.exposure(),
plot.mcf(),
plot.nhpp(),
plot.nhpp_predict(),
predict_nhpp(),
print.exposure(),
print.nhpp(),
print.nhpp_predict()
id <- c(1, 1, 1, 2, 2, 3, 3, 3, 3) time <- c(100, 300, 500, 150, 400, 50, 200, 350, 600) result <- mcf(id, time) print(result)id <- c(1, 1, 1, 2, 2, 3, 3, 3, 3) time <- c(100, 300, 500, 150, 400, 50, 200, 350, 600) result <- mcf(id, time) print(result)
Prints a summary of the NHPP model results.
## S3 method for class 'nhpp' print(x, ...)## S3 method for class 'nhpp' print(x, ...)
x |
An object of class |
... |
Additional arguments (not used). |
Invisibly returns the input object.
Other Repairable Systems Analysis:
exposure(),
mcf(),
nhpp(),
overlay_nhpp(),
plot.exposure(),
plot.mcf(),
plot.nhpp(),
plot.nhpp_predict(),
predict_nhpp(),
print.exposure(),
print.mcf(),
print.nhpp_predict()
time <- c(200, 400, 600, 800, 1000) event <- c(3, 5, 4, 7, 6) result <- nhpp(time, event) print(result)time <- c(200, 400, 600, 800, 1000) event <- c(3, 5, 4, 7, 6) result <- nhpp(time, event) print(result)
Prints a formatted table of forecast cumulative events with confidence bounds.
## S3 method for class 'nhpp_predict' print(x, ...)## S3 method for class 'nhpp_predict' print(x, ...)
x |
An object of class |
... |
Additional arguments (not used). |
Invisibly returns the input object.
Other Repairable Systems Analysis:
exposure(),
mcf(),
nhpp(),
overlay_nhpp(),
plot.exposure(),
plot.mcf(),
plot.nhpp(),
plot.nhpp_predict(),
predict_nhpp(),
print.exposure(),
print.mcf(),
print.nhpp()
time <- c(200, 400, 600, 800, 1000) event <- c(3, 5, 4, 7, 6) fit <- nhpp(time, event) fc <- predict_nhpp(fit, time = c(1500, 2000)) print(fc)time <- c(200, 400, 600, 800, 1000) event <- c(3, 5, 4, 7, 6) fit <- nhpp(time, event) fc <- predict_nhpp(fit, time = c(1500, 2000)) print(fc)
This function provides a formatted print method for objects of class rdt.
## S3 method for class 'rdt' print(x, ...)## S3 method for class 'rdt' print(x, ...)
x |
An object of class |
... |
Additional arguments (not used). |
Invisibly returns the input object.
plan <- rdt(target = 0.9, mission_time = 1000, conf_level = 0.9, beta = 1, n = 10) print(plan)plan <- rdt(target = 0.9, mission_time = 1000, conf_level = 0.9, beta = 1, n = 10) print(plan)
This function prints a summary of the results from an object of class rga.
## S3 method for class 'rga' print(x, ...)## S3 method for class 'rga' print(x, ...)
x |
An object of class |
... |
Additional arguments (not used). |
Invisibly returns the input object.
Other Reliability Growth Analysis:
overlay_rga(),
plot.rga(),
plot.rga_predict(),
predict_rga(),
print.rga_predict(),
rga()
times <- c(100, 200, 300, 400, 500) failures <- c(1, 2, 1, 3, 2) result <- rga(times, failures) print(result)times <- c(100, 200, 300, 400, 500) failures <- c(1, 2, 1, 3, 2) result <- rga(times, failures) print(result)
Prints a formatted table of forecast cumulative failures with confidence
bounds for an rga_predict object.
## S3 method for class 'rga_predict' print(x, ...)## S3 method for class 'rga_predict' print(x, ...)
x |
An object of class |
... |
Additional arguments (not used). |
Invisibly returns the input object.
Other Reliability Growth Analysis:
overlay_rga(),
plot.rga(),
plot.rga_predict(),
predict_rga(),
print.rga(),
rga()
times <- c(100, 200, 300, 400, 500) failures <- c(1, 2, 1, 3, 2) fit <- rga(times, failures) fc <- predict_rga(fit, times = c(1500, 2000)) print(fc)times <- c(100, 200, 300, 400, 500) failures <- c(1, 2, 1, 3, 2) fit <- rga(times, failures) fc <- predict_rga(fit, times = c(1500, 2000)) print(fc)
This function creates a Q-Q plot for a fitted Reliability Growth Analysis (RGA) model Currently only supports the Crow-AMSAA model. A Q-Q plot compares the quantiles of the empirical data to the quantiles of the theoretical distribution specified by the model. If the model fits well, the points should fall approximately along a straight line.
qqplot.rga(x, main = "Q-Q Plot", ...)qqplot.rga(x, main = "Q-Q Plot", ...)
x |
An object of class |
main |
Title of the plot. |
... |
Additional arguments passed to |
A Q-Q plot comparing empirical and theoretical quantiles.
Other goodness-of-fit:
gof(),
ppplot.rga(),
print.gof()
times <- c(5, 10, 15, 20, 25) failures <- c(1, 2, 1, 3, 2) fit <- rga(times, failures) qqplot.rga(fit)times <- c(5, 10, 15, 20, 25) failures <- c(1, 2, 1, 3, 2) fit <- rga(times, failures) qqplot.rga(fit)
This function calculates the required test time or sample size for a Reliability Demonstration Test (RDT) based on specified reliability, mission time, confidence level, and Weibull shape parameter.
rdt( target, mission_time, conf_level, beta = 1, f = 0, n = NULL, test_time = NULL )rdt( target, mission_time, conf_level, beta = 1, f = 0, n = NULL, test_time = NULL )
target |
Required reliability at mission time (0 < target < 1). |
mission_time |
Mission duration (time units). Must be greater than 0. |
conf_level |
Desired confidence level (e.g., 0.9 for 90% confidence). The confidence level must be between 0 and 1 (exclusive). |
beta |
Weibull shape parameter (beta=1 corresponds to exponential distribution). Must be greater than 0. Default is 1. |
f |
Number of allowable failures during the test (non-negative integer). Default is 0
(zero-failure test plan). Increasing |
n |
Sample size (optional, supply if solving for test_time). Must be a positive integer. |
test_time |
Test time per unit (optional, supply if solving for n). Must be greater than 0. |
The function returns an object of class rdt that contains:
Distribution |
Type of distribution used (Exponential or Weibull). |
Beta |
Weibull shape parameter. |
Allowed_Failures |
Number of allowable failures during the test. |
Target_Reliability |
Specified target reliability. |
Mission_Time |
Specified mission time. |
Required_Test_Time |
Calculated required test time (if n is provided). |
Input_Sample_Size |
Provided sample size (if test_time is calculated). |
Required_Sample_Size |
Calculated required sample size (if test_time is provided). |
Input_Test_Time |
Provided test time (if n is calculated). |
#' # Example 1: Calculate required test time plan1 <- rdt(target = 0.9, mission_time = 1000, conf_level = 0.9, beta = 1, n = 10) print(plan1) # Example 2: Calculate required sample size plan2 <- rdt(target = 0.9, mission_time = 1000, conf_level = 0.9, beta = 1, test_time = 2000) print(plan2)#' # Example 1: Calculate required test time plan1 <- rdt(target = 0.9, mission_time = 1000, conf_level = 0.9, beta = 1, n = 10) print(plan1) # Example 2: Calculate required sample size plan2 <- rdt(target = 0.9, mission_time = 1000, conf_level = 0.9, beta = 1, test_time = 2000) print(plan2)
This function performs reliability growth analysis using the Crow-AMSAA model by
Crow (1975) (AMSAATR138) or piecewise
NHPP model by Guo et al. (2010) https://doi.org/10.1109/RAMS.2010.5448029. It fits
a log-log linear regression of cumulative failures versus cumulative time. The
function accepts either two numeric vectors (times, failures) or a data frame
containing both. The Piecewise NHPP model can automatically detect change points
or use user-specified breakpoints.
rga( times, failures, times_type = c("failure_times", "cumulative_failure_times"), model_type = "Crow-AMSAA", breaks = NULL, conf_level = 0.95, method = c("LS", "MLE") )rga( times, failures, times_type = c("failure_times", "cumulative_failure_times"), model_type = "Crow-AMSAA", breaks = NULL, conf_level = 0.95, method = c("LS", "MLE") )
times |
Either a numeric vector of failure-time inputs or a data frame
containing both time inputs and failure counts. If |
failures |
A numeric vector of the number of failures at each corresponding time
in times. Must be the same length as |
times_type |
Character scalar indicating how to interpret |
model_type |
The model type. Either |
breaks |
An optional vector of breakpoints for the |
conf_level |
The desired confidence level, which defaults to 95%. The confidence level is the probability that the confidence interval contains the true mean response. |
method |
Estimation method: |
The scaling relationship between the size of input data (numbers of observations)
and speed of algorithm execution is approximately linear (O(n)). The function is
efficient and can handle large data sets (e.g., thousands of observations) quickly.
The function uses the segmented package for piecewise regression, which employs
an iterative algorithm to estimate breakpoints. The number of iterations required
for convergence may vary depending on the data and initial values.
In practice, the function typically converges within a few iterations for most data sets.
However, in some cases, especially with complex data or poor initial values,
it may take more iterations.
The function returns an object of class rga that contains:
times |
The input time vector, stored exactly as supplied. |
cum_times |
The cumulative time vector used for fitting. |
times_type |
How |
failures |
The input number of failures. |
n_obs |
The number of observations (failures). |
cum_failures |
Cumulative failures. |
model |
The fitted model object (lm (linear model) or segmented). |
residuals |
Model residuals on the log-log scale. These represent deviations of the observed log cumulative failures from the fitted values and are useful for diagnostic checking. |
logLik |
The log-likelihood of the fitted model. The log-likelihood is a measure of model fit, with higher values indicating a better fit. |
AIC |
Akaike Information Criterion (AIC). AIC is a measure used for model selection, with lower values indicating a better fit. |
BIC |
Bayesian Information Criterion(BIC). BIC is another criterion for model selection |
breakpoints |
Breakpoints (log scale) if applicable. |
fitted_values |
Fitted cumulative failures on the original scale. |
lower_bounds |
Lower confidence bounds (original scale). |
upper_bounds |
Upper confidence bounds (original scale). |
betas |
Estimated beta(s). Betas are the slopes of the log-log plot. |
betas_se |
Standard error(s) of the estimated beta(s). |
growth_rate |
Estimated growth rate(s). Growth rates are calculated as 1 - beta. |
lambdas |
Estimated lambda(s). Lambdas are the intercepts of the log-log plot. |
Other Reliability Growth Analysis:
overlay_rga(),
plot.rga(),
plot.rga_predict(),
predict_rga(),
print.rga(),
print.rga_predict()
times <- c(100, 200, 300, 400, 500) failures <- c(1, 2, 1, 3, 2) result1 <- rga(times, failures) print(result1) df <- data.frame(times = times, failures = failures) result2 <- rga(df) print(result2) cum_times <- cumsum(times) result2b <- rga(cum_times, failures, times_type = "cumulative_failure_times") print(result2b) result3 <- rga(times, failures, model_type = "Piecewise NHPP") print(result3) result4 <- rga(times, failures, model_type = "Piecewise NHPP", breaks = c(450)) print(result4)times <- c(100, 200, 300, 400, 500) failures <- c(1, 2, 1, 3, 2) result1 <- rga(times, failures) print(result1) df <- data.frame(times = times, failures = failures) result2 <- rga(df) print(result2) cum_times <- cumsum(times) result2b <- rga(cum_times, failures, times_type = "cumulative_failure_times") print(result2b) result3 <- rga(times, failures, model_type = "Piecewise NHPP") print(result3) result4 <- rga(times, failures, model_type = "Piecewise NHPP", breaks = c(450)) print(result4)
Starts a Model Context Protocol (MCP) server that exposes the core ReliaGrowR analysis functions as tools for AI assistants such as Claude.
rga_mcp_server(...)rga_mcp_server(...)
... |
Additional arguments passed to |
Requires the mcptools and ellmer packages to be installed.
Called for its side effect of starting the MCP server.
rgaFit Crow-AMSAA reliability growth model
nhppFit NHPP model for repairable systems
duaneFit Duane log-log reliability growth model
mcfCompute Mean Cumulative Function
predict_rgaForecast from RGA model
predict_duaneForecast MTBF from Duane model
rdtPlan a Reliability Demonstration Test
gof_rgaGoodness-of-fit statistics for RGA model
claude mcp add -s user reliagrowR -- Rscript -e "ReliaGrowR::rga_mcp_server()"
{
"mcpServers": {
"reliagrowR": {
"command": "Rscript",
"args": ["-e", "ReliaGrowR::rga_mcp_server()"]
}
}
}
Simulates which units in a non-failed population fail next by using a
Weibull life model conditional on each unit's current runtime. When a
positive window is supplied, the function calibrates a Weibull scale
parameter (unless provided directly) so that the expected number of failures
within the window matches n. Units are then sampled with probability
proportional to their conditional Weibull failure probability over the
window, and failure times are drawn from the truncated conditional Weibull
distribution. The full fleet is returned: selected units are labelled
"Failure" and the remaining units are labelled "Suspension".
sim_failures(n, runtimes, replace = FALSE, window = NULL, beta = 1, eta = NULL)sim_failures(n, runtimes, replace = FALSE, window = NULL, beta = 1, eta = NULL)
n |
Positive integer. Number of failures to simulate. |
runtimes |
Numeric vector of positive values. The current operating runtime of each unit in the non-failed population. |
replace |
Logical scalar. If |
window |
|
beta |
Positive numeric scalar. Weibull shape parameter used to model
the age-dependent hazard. Defaults to |
eta |
|
When window = NULL, the function returns the current fleet state at the
supplied runtimes. In this case, failing units are selected using relative
Weibull hazard weights implied by beta.
A data frame with length(runtimes) rows sorted ascending by
runtime, containing:
index |
Integer index of the unit in |
runtime |
Simulated event time. |
type |
Character; |
The returned object also carries attributes weibull_beta and
weibull_eta describing the Weibull parameters used for the simulation.
Other data preparation:
weibull_to_rga()
set.seed(42) runtimes <- c(100, 500, 200, 800, 300) result <- sim_failures(2, runtimes, beta = 1.5) print(result) # With an observation window set.seed(42) result_w <- sim_failures(2, runtimes, window = 50, beta = 1.5) print(result_w)set.seed(42) runtimes <- c(100, 500, 200, 800, 300) result <- sim_failures(2, runtimes, beta = 1.5) print(result) # With an observation window set.seed(42) result_w <- sim_failures(2, runtimes, window = 50, beta = 1.5) print(result_w)
A dataset containing example reliability test data from the military report "Reliability Growth Prediction" (1986) by The Analytical Sciences Corporation. This dataset includes cumulative ETI, failure counts, cumulative MTBF, report numbers, flags, and causes for two different LRUs (G1 and G2).
testdatatestdata
@format ## testdata
A data frame with 25 rows and 6 variables:
The Line Replaceable Unit identifier (G1 or G2).
Cumulative Equivalent Test Hours (ETI).
Cumulative number of failures observed.
Cumulative Mean Time Between Failures (MTBF).
Report number associated with the failure.
A flag indicating special conditions or notes.
Cause of the failure (e.g., D for Design, M for Manufacturing, R for Random, NR for No Report).
@usage data(testdata)
data(testdata) head(testdata) summary(testdata) str(testdata)data(testdata) head(testdata) summary(testdata) str(testdata)
Converts Weibull data (failure, suspension, and interval-censored times) into a format suitable for reliability growth analysis (RGA). The function handles exact failure times, right-censored suspensions, and interval-censored data. It approximates interval-censored failures by placing them at the midpoint of the interval. The output is a data frame with cumulative time and failure counts. This format can be used with RGA models such as Crow-AMSAA.
weibull_to_rga( failures, suspensions = NULL, interval_starts = NULL, interval_ends = NULL )weibull_to_rga( failures, suspensions = NULL, interval_starts = NULL, interval_ends = NULL )
failures |
A numeric vector of exact failure times. Each failure time indicates when an item failed during the observation period. |
suspensions |
A numeric vector of suspension (right-censored) times. A suspension indicates that the item was removed from observation at that time without failure. This parameter is optional and can be NULL if there are no suspensions. |
interval_starts |
A numeric vector of interval start times (lower bound of censoring).
This parameter is optional and can be NULL if there are no interval-censored data.
If provided, it must be the same length as |
interval_ends |
A numeric vector of interval end times (upper bound of censoring).
This parameter is optional and can be NULL if there are no interval-censored data.
If provided, it must be the same length as |
The data frame contains two columns:
CumulativeTime |
Cumulative time at each failure event. |
Failures |
Number of failures at each cumulative time point. |
The function approximates interval-censored failures by placing them at the midpoint of the interval.
Other data preparation:
sim_failures()
failures <- c(100, 200, 200, 400) suspensions <- c(250, 350, 450) interval_starts <- c(150, 300) interval_ends <- c(180, 320) result <- weibull_to_rga(failures, suspensions, interval_starts, interval_ends) print(result)failures <- c(100, 200, 200, 400) suspensions <- c(250, 350, 450) interval_starts <- c(150, 300) interval_ends <- c(180, 320) result <- weibull_to_rga(failures, suspensions, interval_starts, interval_ends) print(result)