The hardware and bandwidth for this mirror is donated by dogado GmbH, the Webhosting and Full Service-Cloud Provider. Check out our Wordpress Tutorial.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]dogado.de.
This vignette demonstrates the application of
UniLindleyApprox to 14 benchmark probability distributions
across survival analysis, reliability theory, and computational
statistics literature:
library(UniLindleyApprox)
# Weibull PDF, CDF, Survival (theta = c(shape, scale))
dweibull_custom <- function(x, theta) dweibull(x, shape = theta[1], scale = theta[2])
pweibull_custom <- function(x, theta) pweibull(x, shape = theta[1], scale = theta[2])
sweibull_custom <- function(x, theta) 1 - pweibull(x, shape = theta[1], scale = theta[2])
# Independent Gamma log-prior for shape and scale
logprior_weibull <- function(theta) {
if (theta[1] <= 0 || theta[2] <= 0) return(-Inf)
dgamma(theta[1], shape = 2, rate = 1, log = TRUE) +
dgamma(theta[2], shape = 2, rate = 1, log = TRUE)
}
# Simulated progressive Type-II data
obs <- c(0.5, 1.2, 1.8, 2.5, 3.1)
R <- c(2, 0, 1, 0, 2)
data_prog <- list(observed = obs, removal_scheme = R, n_total = 10)
fit_weibull <- lindley_fit(
data = data_prog,
pdf = dweibull_custom,
cdf = pweibull_custom,
survival = sweibull_custom,
log_prior = logprior_weibull,
theta0 = c(1.5, 2.0),
scheme = "progressive_type2",
loss = "SELF",
control = lindley.control(verbose = FALSE)
)
summary(fit_weibull)
#> Summary of Bayesian Estimation Using Lindley's Approximation
#> ============================================================
#>
#> Model Information:
#> Censoring Scheme: progressive_type2
#> Loss Function: SELF
#> Number of Parameters: 2
#>
#> Parameter Estimates:
#> Parameter MAP Bayes_Estimate Posterior_Mean
#> theta1 1.745905 1.789724 1.789724
#> theta2 2.723526 3.014287 3.014287
#>
#> Model Fit:
#> Log-Likelihood: -10.3624
#> Log-Posterior: -13.2726
#> AIC: 24.7248
#> BIC: 22.922
#>
#> Optimization:
#> Convergence: Successful
#> Iterations: 15
#> Elapsed Time: 0.02 seconds
#>
#> Information Matrix:
#> [,1] [,2]
#> [1,] 2.811730 -0.075062
#> [2,] -0.075062 2.827562The 1-parameter Lindley distribution has PDF \(f(x) = \frac{\theta^2}{1 + \theta} (1 + x) e^{-\theta x}\) for \(x > 0, \theta > 0\).
dlindley_custom <- function(x, theta) {
th <- theta[1]
if (th <= 0 || any(x <= 0)) return(rep(0, length(x)))
(th^2 / (1 + th)) * (1 + x) * exp(-th * x)
}
plindley_custom <- function(x, theta) {
th <- theta[1]
1 - (1 + (th * x) / (1 + th)) * exp(-th * x)
}
slindley_custom <- function(x, theta) 1 - plindley_custom(x, theta)
set.seed(123)
x_lindley <- rexp(40, rate = 1.5)
fit_lindley <- lindley_fit(
data = x_lindley,
pdf = dlindley_custom,
cdf = plindley_custom,
survival = slindley_custom,
log_prior = function(th) dgamma(th[1], 2, 1, log = TRUE),
theta0 = c(1.0),
scheme = "complete",
loss = "LINEX",
control = lindley.control(verbose = FALSE)
)
print(fit_lindley)
#> Bayesian Estimation Using Lindley's Approximation
#> ================================================
#>
#> Censoring Scheme: complete
#> Loss Function: LINEX
#>
#> Posterior Mode (MAP):
#> [1] 2.032641
#>
#> Bayes Estimate (LINEX):
#> [1] 2.03515
#>
#> Posterior Mean:
#> [1] 2.067922
#>
#> Log-Likelihood: -21.8484
#> Log-Posterior: -23.1717
#> Convergence: Successful
#> Iterations: 14
#> Elapsed Time: 0.02 secondsThese binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.
Health stats visible at Monitor.