A likelihood model for series systems with Weibull component lifetimes. Accounts for right-censoring and candidate sets indicative of masked failure causes.
This library was developed to support the research presented in the following paper:
For detailed explanation and the scientific background behind the methodologies implemented in this library, please refer to the paper.
You can install the development version of wei.series.md.c1.c2.c3
from GitHub with:
# install.packages("devtools")
#devtools::install_github("queelius/wei.series.md.c1.c2.c3")
library(algebraic.dist)
#> Registered S3 method overwritten by 'algebraic.dist':
#> method from
#> print.dist stats
library(algebraic.mle)
library(wei.series.md.c1.c2.c3)
# fit the model
fit <- mle_numerical(mle_lbfgsb_wei_series_md_c1_c2_c3(
df = guo_weibull_series_md$data,
theta0 = c(1,1,1,1,1,1),
control = list(
maxit = 1000L,
parscale = c(1, 1000, 1, 1000, 1, 1000))))
cbind(confint(fit),
"fit" = params(fit),
"guo mle" = guo_weibull_series_md$mle)
#> 2.5% 97.5% fit guo mle
#> param1 0.5736164 1.941626 1.257621 1.2576
#> param2 352.9027030 1635.838014 994.370358 994.3661
#> param3 0.5633925 1.763536 1.163464 1.1635
#> param4 310.1187793 1507.798853 908.958816 908.9458
#> param5 0.6054160 1.656147 1.130782 1.1308
#> param6 322.5652746 1357.623486 840.094380 840.1141
# log-likelihood
c("guo log-like" = guo_weibull_series_md$loglike, "fit log-like" = loglik_val(fit))
#> guo log-like fit log-like
#> -228.6851 -228.6851
We see that they are approximately the same MLE fits.
shapes <- params(fit)[seq(1, length(params(fit)), 2)]
scales <- params(fit)[seq(2, length(params(fit)), 2)]
data.frame(
"Component Cause" = wei_series_cause(1L:3L, shapes = shapes, scales = scales),
"Component MTTF" = wei_mttf(shape = shapes, scale = scales))
#> Component.Cause Component.MTTF
#> 1 0.2862058 924.8697
#> 2 0.3376112 862.1766
#> 3 0.3761829 803.5490
cat("System MTTF: ", wei_series_mttf(shapes = shapes, scales = scales))
#> System MTTF: 339.3773
(tq <- qwei_series(p = .825, shapes = shapes, scales = scales))
#> [1] 575.704
surv_wei_series(t = tq, shapes = shapes, scales = scales)
#> [1] 0.175
rwei_series(10L, shapes =shapes, scales = scales)
#> [1] 95.53603 100.25772 282.05837 126.16159 425.90422 49.83648 130.02596
#> [8] 742.51530 64.97421 147.28431
pwei_series(seq(1, 5, 1), shapes = shapes, scales = scales)
#> [1] 0.001024090 0.002293359 0.003675757 0.005136821 0.006658907
This package implements a likelihood model for Weibull series systems from masked data, including functions for the log-likelihood, score, and hessian of the log-likelihood. Analytical solutions are provided for the log-likelihood and score functions, while the hessian is computed numerically. The package is designed to handle two types of data: masked component cause of failure data with exact failure time and right-censored system lifetime data.
The masked component data should approximately satisfy certain conditions. The conditions are as follows:
When we condition on the component cause of failure being any particular cause in the canidate set and and the time of failure, the probability of the given candidate set does not vary as we vary the component cause of failure.
The masking probabilities are independent of the series system lifetime parameter vector.
As a loglikelihood model, we provide the following functions:
loglik_wei_series_md_c1_c2_c3
for the log-likelihoodscore_wei_series_md_c1_c2_c3
for the score functionhessian_wei_series_md_c1_c2_c3
for the hessian of the log-likelihoodFor convenience, we also provide some wrappers around the optim
function to solve for the maximum likelihood estimates (MLE) of the shape and scale parameters using the Nelder-Mead and simulated annealing algorithms:
mle_nelder_wei_series_md_c1_c2_c3
for the Nelder-Mead algorithmmle_sann_wei_series_md_c1_c2_c3
for the simulated annealing algorithmSince we base some of our results and analysis on Guo, Szidarovszky, and Niu (2013), we provide the data set from their paper, along with the maximum likelihood estimates of the shape and scale parameters for the Weibull series system. We also provide a function to solve for the MLE using the Nelder-Mead algorithm:
guo_weibull_series_md
for a model that generates data similar to Guo, Szidarovszky, and Niu (2013)guo_weibull_series_table_2
for the data from Table 2 in Guo, Szidarovszky, and Niu (2013)We also provide a host of supporting functions and data tables, e.g., we provide Weibull series system distribution function that honors the established conventions in R:
dwei_series
for the probability density functionpwei_series
for the cumulative distribution functionqwei_series
for the quantile functionrwei_series
for random number generationWe also provide functions to compute the mean time to failure and the component cause of failure for the Weibull series distribution, along with the hazard and survival functions:
wei_series_mttf
for the mean time to failurewei_series_cause
for the component cause of failurehazard_wei_series
for the hazard functionsurv_wei_series
for the survival function (this is normally done by passing lower.tail = FALSE to pwei_series
but we provide a function)Finally, we also provide some functions for working with the components of the Weibull series system, e.g., we provide a function to compute the hazard function for the Weibull component lifetimes:
hazard_wei
for the hazard function of the Weibull component lifetimeswei_mttf
for the mean time to failure of the Weibull component lifetimes