BivLaplaceRL is an R package that implements statistical methods from two research papers on bivariate Laplace transforms in reliability theory, together with a set of univariate residual life tools:
The package provides four bivariate distributions commonly used in reliability modelling.
set.seed(42)
dat <- rgumbel_biv(200, k1 = 1, k2 = 1.5, theta = 0.3)
head(dat)
#> X1 X2
#> [1,] 0.1983368 0.520919155
#> [2,] 0.6608953 0.076339189
#> [3,] 0.2834910 0.156729738
#> [4,] 0.0381919 0.294297662
#> [5,] 0.4731766 0.305411898
#> [6,] 1.4636271 0.000850079
sgumbel_biv(1, 1, k1 = 1, k2 = 1.5, theta = 0.3)
#> [1] 0.06081006\[L^*_{X_{t_1|t_2}}(s_1) = \frac{1}{k_1 + s_1 + \theta t_2}, \quad L^*_{X_{t_2|t_1}}(s_2) = \frac{1}{k_2 + s_2 + \theta t_1}.\]
sim_blt_residual(n_obs = 200, n_sim = 50, s1 = 1, s2 = 1,
t1 = 0.3, t2 = 0.3, k1 = 1, k2 = 1, theta = 0.5)
#> component true_value mean_est bias variance mse
#> L1_star L1_star 0.4651163 0.4682817 0.003165417 0.0009658125 0.0009758324
#> L2_star L2_star 0.4651163 0.3951277 -0.069988580 0.0004963515 0.0053947528sX <- function(x1, x2) sgumbel_biv(x1, x2, k1 = 1, k2 = 1, theta = 0.2)
sY <- function(x1, x2) sgumbel_biv(x1, x2, k1 = 2, k2 = 2, theta = 0.2)
res <- blt_order_residual(sX, sY, s1 = 1, s2 = 1,
t1_grid = c(0.5, 1), t2_grid = c(0.5, 1))
cat("X <=_BLt-rl Y:", res$order_holds, "\n")
#> X <=_BLt-rl Y: TRUE
res2 <- biv_whr_order(sX, sY, t1_grid = c(0.5, 1), t2_grid = c(0.5, 1))
cat("X <=_whr Y:", res2$order_holds, "\n")
#> X <=_whr Y: FALSEThe package now provides a complete set of univariate residual life tools that complement the bivariate framework.
For a non-negative continuous random variable \(X\) with density \(f\) and survival function \(\bar{F}\):
\[L_X(s,t) = E[e^{-sX} \mid X > t] = \frac{1}{\bar{F}(t)}\int_t^\infty e^{-sx} f(x)\,dx.\]
# Exp(1): constant hazard rate = 1
hazard_rate(f, Fb, t = c(0.5, 1, 2))
#> [1] 1 1 1
# Exp(1): constant MRL = 1 (memoryless)
mean_residual(Fb, t = c(0, 0.5, 1, 2))
#> [1] 1 1 1 1
# Gamma(2,1): increasing hazard, decreasing MRL
fG <- function(x) dgamma(x, shape = 2, rate = 1)
FbG <- function(x) pgamma(x, shape = 2, rate = 1, lower.tail = FALSE)
hazard_rate(fG, FbG, t = c(0.5, 1, 2))
#> [1] 0.3333333 0.5000000 0.6666667
mean_residual(FbG, t = c(0, 0.5, 1))
#> [1] 2.000000 1.666667 1.500000f1 <- function(x) dexp(x, 1)
Fb1 <- function(x) pexp(x, 1, lower.tail = FALSE)
f2 <- function(x) dexp(x, 2)
Fb2 <- function(x) pexp(x, 2, lower.tail = FALSE)
# LT-rl order: Exp(1) <=_Lt-rl Exp(2)?
lt_rl_order(f1, Fb1, f2, Fb2,
s_grid = c(0.5, 1, 2), t_grid = c(0, 0.5, 1))$order_holds
#> [1] TRUE
# Hazard rate order: Exp(1) <=_hr Exp(2)?
hr_order(f1, Fb1, f2, Fb2, t_grid = c(0.5, 1, 2))$order_holds
#> [1] TRUE
# MRL order: Exp(2) <=_mrl Exp(1)?
mrl_order(Fb2, Fb1, t_grid = c(0, 0.5, 1, 2))$order_holds
#> [1] TRUEJayalekshmi S., Rajesh G., Nair N.U. (2022). Bivariate Laplace transform of residual lives and their properties. Communications in Statistics—Theory and Methods. https://doi.org/10.1080/03610926.2022.2085874
Jayalekshmi S., Rajesh G., Nair N.U. (2022). Bivariate Laplace transform order and ordering of reversed residual lives. International Journal of Reliability, Quality and Safety Engineering. https://doi.org/10.1142/S0218539322500061
Belzunce F., Ortega E., Ruiz J.M. (1999). The Laplace order and ordering of residual lives. Statistics & Probability Letters, 42(2), 145–156. https://doi.org/10.1016/S0167-7152(98)00202-8