| Title: | Bayesian Point Estimation Using Lindley's Approximation Under Censoring Schemes |
|---|---|
| Description: | Performs Bayesian point estimation using Lindley's Approximation (1980) <doi:10.1111/j.2517-6161.1980.tb01102.x> for arbitrary univariate probability distributions under numerous censoring and truncation schemes. Users supply the probability density function (PDF), cumulative distribution function (CDF), survival function, log-prior density, initial parameter vector, support bounds, and observed data; the package automatically computes Bayesian point estimates under various loss functions using Lindley's approximation. Supported schemes include complete data, right censoring, left censoring, interval censoring, random censoring, block random censoring, Type-I censoring, Type-II censoring, progressive Type-II censoring, progressive first failure censoring, joint Type-I censoring, joint Type-II censoring, balanced joint progressive Type-II censoring, hybrid censoring, hybrid Type-I censoring, hybrid Type-II censoring, Type-I hybrid censoring, Type-II progressively hybrid censoring, doubly Type-II censoring, middle censoring, right truncation, and left truncation. The package computes posterior expectations of arbitrary smooth functions, supports multiple loss functions (squared error loss function (SELF), weighted squared error loss function (WSELF), modified quadratic squared error loss function (MQSELF), precautionary loss function (PLF), entropy loss function (ELF), linear-exponential (LINEX), generalized entropy loss function (GELF), Kullback-Leibler loss function (K-Loss), and user-defined), provides model selection criteria (Akaike information criterion (AIC), Bayesian information criterion (BIC), corrected Akaike information criterion (AICc), Hannan-Quinn information criterion (HQIC), consistent Akaike information criterion (CAIC), Kullback information criterion (KIC)), goodness-of-fit statistics (Kolmogorov-Smirnov, Anderson-Darling, Cramer-von Mises, Watson, Chi-square), residual analysis (Cox-Snell, Martingale, Deviance, Pearson, Generalized, Randomized quantile), comprehensive visualization tools, prediction utilities, and simulation functions for benchmarking estimators. Methods are described in Lindley (1980) <doi:10.1111/j.2517-6161.1980.tb01102.x>, Tierney and Kadane (1986) <doi:10.2307/2234555>, Tierney, Kass, and Kadane (1989) <doi:10.2307/2335663>, Nagar, Kumar, and Krishna (2026) <doi:10.59467/IJASS.2026.22.1>, Goel, Kumar, and Krishna (2026, "Estimation in power Lindley distributions using balanced joint progressively Type-II censored data"), Wu and Kus (2009) <doi:10.1016/j.csda.2009.03.010>, Goel and Krishna (2026) <doi:10.1007/s13198-026-03208-w>, Balakrishnan and Aggarwala (2000, ISBN:978-1-4612-1334-5), Mondal and Kundu (2020) <doi:10.1080/03610926.2018.1554128>, Ding and Gui (2023) <doi:10.3390/math11092003>, Prajapati, Mitra, and Kundu (2019) <doi:10.1007/s13571-018-0167-0>, Yadav, Jaiswal, and Yadav (2026) <doi:10.1007/s11135-026-02647-8>, Iyer, Jammalamadaka, and Kundu (2008) <doi:10.1016/j.jspi.2007.03.062>, Banerjee and Kundu (2008) <doi:10.1109/TR.2008.916890>, and Kundu and Joarder (2006) <doi:10.1016/j.csda.2005.05.002>. |
| Authors: | Shikhar Tyagi [aut, cre] (ORCID: <https://orcid.org/0000-0003-1606-0844>), Arvind Pandey [aut], Bhupendra Singh [aut], Vrijesh Tripathi [aut] |
| Maintainer: | Shikhar Tyagi <[email protected]> |
| License: | GPL-3 |
| Version: | 0.1.0 |
| Built: | 2026-10-06 10:18:01 UTC |
| Source: | https://github.com/cran/UniLindleyApprox |
The UniLindleyApprox package provides a generalized framework for
Bayesian parameter estimation using Lindley's Approximation (1980) for
arbitrary univariate probability distributions under complete, censored,
and truncated data.
The main function is lindley_fit which performs Bayesian
estimation using Lindley's approximation.
The package supports 23 censoring and truncation schemes including:
Complete (uncensored) data
Right censoring
Left censoring
Interval censoring
Random censoring
Type-I censoring
Type-II censoring
Progressive Type-II censoring
Progressive first failure censoring
Joint Type-I censoring
Joint Type-II censoring
Balanced joint progressive Type-II censoring
Hybrid censoring
Hybrid Type-I censoring
Hybrid Type-II censoring
Type-I hybrid censoring
Type-II progressively hybrid censoring
Doubly Type-II censoring
Middle censoring
Right truncation
Left truncation
The package computes Bayes estimates under various loss functions:
Squared Error Loss Function
Weighted Squared Error Loss Function
Modified Quadratic Squared Error Loss Function
Precautionary Loss Function
Entropy Loss Function
Linear Exponential Loss Function
General Entropy Loss Function
K-Loss Function
Supported prior distributions include:
Model selection criteria include AIC, AICc, BIC, HQIC, CAIC, and KIC.
Goodness-of-fit statistics include KS, AD, CvM, Watson, and Chi-square tests.
Residual types include Cox-Snell, Martingale, Deviance, Pearson, Generalized, and Randomized quantile residuals.
Visualization functions include posterior surface plots, likelihood profiles, QQ plots, PP plots, and residual plots.
Simulation utilities are available for all censoring schemes for benchmarking.
Maintainer: Shikhar Tyagi [email protected] (ORCID)
Authors:
Arvind Pandey [email protected]
Bhupendra Singh [email protected]
Vrijesh Tripathi [email protected]
Lindley, D. V. (1980). Approximate Bayesian methods. Trabajos de Estadistica y de Investigacion Operativa, 31(1), 223-245.
Tierney, L., & Kadane, J. B. (1986). Accurate approximations for posterior moments and marginal densities. Journal of the American Statistical Association, 81(393), 82-86.
Tierney, L., Kass, R. E., & Kadane, J. B. (1989). Fully exponential Laplace approximations to expectations and variances of nonpositive functions. Journal of the American Statistical Association, 84(407), 710-716.
AIC Method for lindleyfit Objects
## S3 method for class 'lindleyfit' AIC(object, ...)## S3 method for class 'lindleyfit' AIC(object, ...)
object |
A lindleyfit object. |
... |
Additional arguments (unused). |
AIC value.
Computes the corrected AIC for fitted models.
AICc(object, ...)AICc(object, ...)
object |
Model fit object. |
... |
Additional arguments. |
AICc value.
AICc Method for lindleyfit Objects
## S3 method for class 'lindleyfit' AICc(object, ...)## S3 method for class 'lindleyfit' AICc(object, ...)
object |
A lindleyfit object. |
... |
Additional arguments (unused). |
AICc value.
Creates a comprehensive set of diagnostic plots using ggplot2 if available.
autoplot.lindleyfit(object, which = 1:4, ...)autoplot.lindleyfit(object, which = 1:4, ...)
object |
A lindleyfit object. |
which |
Which plots to display. |
... |
Additional arguments. |
A ggplot object or list of ggplot objects.
Computes the Bayes estimate that minimizes the expected loss.
bayes_estimate(fit, loss = "SELF", ...)bayes_estimate(fit, loss = "SELF", ...)
fit |
A lindleyfit object. |
loss |
Loss function name or custom function. |
... |
Additional parameters for loss function. |
Bayes estimate under specified loss function.
BIC Method for lindleyfit Objects
## S3 method for class 'lindleyfit' BIC(object, ...)## S3 method for class 'lindleyfit' BIC(object, ...)
object |
A lindleyfit object. |
... |
Additional arguments (unused). |
BIC value.
Computes the CAIC for fitted models.
CAIC(object, ...)CAIC(object, ...)
object |
Model fit object. |
... |
Additional arguments. |
CAIC value.
Consistent AIC.
## S3 method for class 'lindleyfit' CAIC(object, ...)## S3 method for class 'lindleyfit' CAIC(object, ...)
object |
A lindleyfit object. |
... |
Additional arguments (unused). |
CAIC value.
Extracts the Bayes estimate.
## S3 method for class 'lindleyfit' coef(object, ...)## S3 method for class 'lindleyfit' coef(object, ...)
object |
A lindleyfit object. |
... |
Additional arguments (unused). |
Parameter estimates.
Compares predictions from multiple fitted models.
compare_predictions(..., newdata, type = "density")compare_predictions(..., newdata, type = "density")
... |
List of lindleyfit objects. |
newdata |
New data points for prediction. |
type |
Type of prediction. |
Data frame with predictions from each model.
Extracts computational and convergence diagnostics from a fitted model.
diagnostics(object, ...)diagnostics(object, ...)
object |
Model fit object. |
... |
Additional arguments. |
Diagnostic list.
Computes diagnostic information for the fitted model.
## S3 method for class 'lindleyfit' diagnostics(object, ...)## S3 method for class 'lindleyfit' diagnostics(object, ...)
object |
A lindleyfit object. |
... |
Additional arguments (unused). |
A list of diagnostic information.
Computes fitted values (density, CDF, survival) at data points.
## S3 method for class 'lindleyfit' fitted(object, type = "density", ...)## S3 method for class 'lindleyfit' fitted(object, type = "density", ...)
object |
A lindleyfit object. |
type |
Type of fitted values: "density", "cdf", "survival", or "hazard". |
... |
Additional arguments (unused). |
Fitted values.
Computes the Anderson-Darling goodness-of-fit statistic.
gof_ad(fit, ...)gof_ad(fit, ...)
fit |
A lindleyfit object. |
... |
Additional arguments (unused). |
AD statistic value.
Computes the chi-square goodness-of-fit statistic for binned data.
gof_chisq(fit, bins = NULL, ...)gof_chisq(fit, bins = NULL, ...)
fit |
A lindleyfit object. |
bins |
Number of bins or custom bin boundaries. |
... |
Additional arguments. |
Chi-square statistic and p-value.
Computes the Cramér-von Mises goodness-of-fit statistic.
gof_cvm(fit, ...)gof_cvm(fit, ...)
fit |
A lindleyfit object. |
... |
Additional arguments (unused). |
CvM statistic value.
Computes the Kolmogorov-Smirnov goodness-of-fit statistic.
gof_ks(fit, ...)gof_ks(fit, ...)
fit |
A lindleyfit object. |
... |
Additional arguments (unused). |
KS statistic value.
Computes various goodness-of-fit statistics for the fitted model.
gof_stats(fit, ...)gof_stats(fit, ...)
fit |
A lindleyfit object. |
... |
Additional arguments. |
A list of goodness-of-fit statistics.
Computes the Watson goodness-of-fit statistic (a variant of Cramér-von Mises).
gof_watson(fit, ...)gof_watson(fit, ...)
fit |
A lindleyfit object. |
... |
Additional arguments (unused). |
Watson statistic value.
Computes the HQIC for fitted models.
HQIC(object, ...)HQIC(object, ...)
object |
Model fit object. |
... |
Additional arguments. |
HQIC value.
Hannan-Quinn Information Criterion.
## S3 method for class 'lindleyfit' HQIC(object, ...)## S3 method for class 'lindleyfit' HQIC(object, ...)
object |
A lindleyfit object. |
... |
Additional arguments (unused). |
HQIC value.
Creates a log-prior for independent priors on each parameter.
independent_prior(prior_list, ...)independent_prior(prior_list, ...)
prior_list |
List of prior functions, one for each parameter. |
... |
Additional arguments passed to each prior. |
Combined log-prior function.
Computes the KIC for fitted models.
KIC(object, ...)KIC(object, ...)
object |
Model fit object. |
... |
Additional arguments. |
KIC value.
Kullback Information Criterion.
## S3 method for class 'lindleyfit' KIC(object, ...)## S3 method for class 'lindleyfit' KIC(object, ...)
object |
A lindleyfit object. |
... |
Additional arguments (unused). |
KIC value.
Main function for performing Bayesian parameter estimation using Lindley's approximation for arbitrary univariate distributions under various censoring schemes.
lindley_fit( data, pdf, cdf, survival, log_prior, theta0, scheme = "complete", loss = "SELF", control = lindley.control(), scheme_params = NULL, ... )lindley_fit( data, pdf, cdf, survival, log_prior, theta0, scheme = "complete", loss = "SELF", control = lindley.control(), scheme_params = NULL, ... )
data |
Observed data. Format depends on censoring scheme. |
pdf |
Probability density function. Must accept (x, theta) where theta is a parameter vector. |
cdf |
Cumulative distribution function. Must accept (x, theta). |
survival |
Survival function (1 - CDF). Must accept (x, theta). |
log_prior |
Log-prior density function. Must accept theta and return log-density. |
theta0 |
Initial parameter vector. |
scheme |
Censoring scheme. See details for supported schemes. |
loss |
Loss function for Bayes estimate. Default: "SELF". |
control |
Control parameters from |
scheme_params |
Additional parameters specific to censoring scheme. |
... |
Additional arguments passed to prior and loss functions. |
An object of class lindleyfit containing:
Posterior mode (MAP estimate)
Bayes estimate under specified loss function
Posterior mean approximation
Hessian matrix at posterior mode
Gradient vector at posterior mode
Third-order derivative tensor
Log-likelihood at MAP
Log-posterior at MAP
Optimization convergence status
Number of optimization iterations
Input data
Censoring scheme used
Loss function used
Control parameters
Computation time
Complete (uncensored) data
Right censoring
Left censoring
Interval censoring
Random censoring
Type-I censoring
Type-II censoring
Progressive Type-II censoring
Progressive first failure censoring
Joint Type-I censoring
Joint Type-II censoring
Balanced joint progressive Type-II censoring
Hybrid censoring
Hybrid Type-I censoring
Hybrid Type-II censoring
Type-I hybrid censoring
Type-II progressively hybrid censoring
Doubly Type-II censoring
Middle censoring
Right truncation
Left truncation
Squared Error Loss Function
Weighted Squared Error Loss Function
Modified Quadratic Squared Error Loss Function
Precautionary Loss Function
Entropy Loss Function
Linear Exponential Loss Function
General Entropy Loss Function
K-Loss Function
# Exponential distribution with complete data set.seed(123) x <- rexp(50, rate = 2) # Define probability functions dexp_custom <- function(x, theta) dexp(x, rate = theta[1]) pexp_custom <- function(x, theta) pexp(x, rate = theta[1]) sexp_custom <- function(x, theta) 1 - pexp(x, rate = theta[1]) # Define log-prior (Gamma prior for rate) logprior <- function(theta) { dgamma(theta[1], shape = 2, rate = 1, log = TRUE) } # Fit model fit <- lindley_fit( data = x, pdf = dexp_custom, cdf = pexp_custom, survival = sexp_custom, log_prior = logprior, theta0 = c(1), scheme = "complete", loss = "SELF" ) # Print results print(fit)# Exponential distribution with complete data set.seed(123) x <- rexp(50, rate = 2) # Define probability functions dexp_custom <- function(x, theta) dexp(x, rate = theta[1]) pexp_custom <- function(x, theta) pexp(x, rate = theta[1]) sexp_custom <- function(x, theta) 1 - pexp(x, rate = theta[1]) # Define log-prior (Gamma prior for rate) logprior <- function(theta) { dgamma(theta[1], shape = 2, rate = 1, log = TRUE) } # Fit model fit <- lindley_fit( data = x, pdf = dexp_custom, cdf = pexp_custom, survival = sexp_custom, log_prior = logprior, theta0 = c(1), scheme = "complete", loss = "SELF" ) # Print results print(fit)
Creates a list of control parameters for the Lindley approximation algorithm.
lindley.control( method = "BFGS", maxit = 1000, reltol = 1e-08, abstol = 1e-10, hessian = TRUE, third_deriv = TRUE, deriv_method = "numDeriv", eps = 1e-06, parallel = FALSE, ncores = 2, verbose = TRUE, trace = 0, check_prior = TRUE, check_support = TRUE, check_hessian = TRUE, cache_derivatives = TRUE, use_analytical = TRUE )lindley.control( method = "BFGS", maxit = 1000, reltol = 1e-08, abstol = 1e-10, hessian = TRUE, third_deriv = TRUE, deriv_method = "numDeriv", eps = 1e-06, parallel = FALSE, ncores = 2, verbose = TRUE, trace = 0, check_prior = TRUE, check_support = TRUE, check_hessian = TRUE, cache_derivatives = TRUE, use_analytical = TRUE )
method |
Optimization method. Options: "BFGS", "L-BFGS-B", "Nelder-Mead", "CG", "SANN", "Brent", "Newton-Raphson". Default: "BFGS". |
maxit |
Maximum number of iterations for optimization. Default: 1000. |
reltol |
Relative convergence tolerance. Default: 1e-8. |
abstol |
Absolute convergence tolerance. Default: 1e-10. |
hessian |
Logical; whether to compute the Hessian matrix. Default: TRUE. |
third_deriv |
Logical; whether to compute third-order derivatives. Default: TRUE. |
deriv_method |
Method for numerical differentiation. Options: "numDeriv", "finite". Default: "numDeriv". |
eps |
Step size for finite differences. Default: 1e-6. |
parallel |
Logical; whether to use parallel computation. Default: FALSE. |
ncores |
Number of cores for parallel computation. Default: 2. |
verbose |
Logical; whether to print progress messages. Default: TRUE. |
trace |
Integer; level of tracing information. Default: 0. |
check_prior |
Logical; whether to validate prior density. Default: TRUE. |
check_support |
Logical; whether to validate parameter support. Default: TRUE. |
check_hessian |
Logical; whether to check Hessian positive definiteness. Default: TRUE. |
cache_derivatives |
Logical; whether to cache derivative computations. Default: TRUE. |
use_analytical |
Logical; whether to use analytical derivatives if provided. Default: TRUE. |
A list of control parameters for use in lindley_fit.
ctrl <- lindley.control(method = "BFGS", maxit = 500, verbose = FALSE)ctrl <- lindley.control(method = "BFGS", maxit = 500, verbose = FALSE)
Create Multivariate Normal Prior
log_prior_mvn(theta, mean, sigma, ...)log_prior_mvn(theta, mean, sigma, ...)
theta |
Parameter vector. |
mean |
Mean vector. |
sigma |
Covariance matrix. |
... |
Additional parameters (unused). |
Log-prior density.
Provides log-prior density functions for common prior distributions.
Jeffreys prior is proportional to sqrt(det(I(theta))), where I(theta) is the Fisher information matrix. For common distributions, this simplifies to known forms.
log_prior_gamma(theta, shape = 1, rate = 1, ...) log_prior_beta(theta, shape1 = 1, shape2 = 1, ...) log_prior_normal(theta, mean = 0, sd = 1, ...) log_prior_uniform(theta, min = 0, max = 1, ...) log_prior_lognormal(theta, meanlog = 0, sdlog = 1, ...) log_prior_invgamma(theta, shape = 1, scale = 1, ...) log_prior_weibull(theta, shape = 1, scale = 1, ...) log_prior_exponential(theta, rate = 1, ...) log_prior_jeffreys(theta, distribution = "exponential", ...)log_prior_gamma(theta, shape = 1, rate = 1, ...) log_prior_beta(theta, shape1 = 1, shape2 = 1, ...) log_prior_normal(theta, mean = 0, sd = 1, ...) log_prior_uniform(theta, min = 0, max = 1, ...) log_prior_lognormal(theta, meanlog = 0, sdlog = 1, ...) log_prior_invgamma(theta, shape = 1, scale = 1, ...) log_prior_weibull(theta, shape = 1, scale = 1, ...) log_prior_exponential(theta, rate = 1, ...) log_prior_jeffreys(theta, distribution = "exponential", ...)
theta |
Parameter value. |
shape |
Shape parameter (default: 1). |
rate |
Rate parameter (default: 1). |
... |
Additional parameters. |
shape1 |
First shape parameter (default: 1). |
shape2 |
Second shape parameter (default: 1). |
mean |
Mean parameter (default: 0). |
sd |
Standard deviation parameter (default: 1). |
min |
Lower bound (default: 0). |
max |
Upper bound (default: 1). |
meanlog |
Mean of log-scale (default: 0). |
sdlog |
SD of log-scale (default: 1). |
scale |
Scale parameter (default: 1). |
distribution |
Distribution name for Jeffreys prior. |
Log-prior density value.
Log-prior density.
Log-prior density.
Log-prior density.
Log-prior density.
Log-prior density.
Log-prior density.
Log-prior density.
Log-prior density.
Log-prior density.
Log-Likelihood Method for lindleyfit Objects
## S3 method for class 'lindleyfit' logLik(object, ...)## S3 method for class 'lindleyfit' logLik(object, ...)
object |
A lindleyfit object. |
... |
Additional arguments (unused). |
Log-likelihood value.
Implements various loss functions for computing Bayes estimates.
loss_self(theta, estimate, ...) loss_wself(theta, estimate, w = 1, ...) loss_mqself(theta, estimate, k = 1, ...) loss_plf(theta, estimate, a = 1, ...) loss_elf(theta, estimate, ...) loss_linex(theta, estimate, a = 1, ...) loss_gelf(theta, estimate, q = 2, ...) loss_kloss(theta, estimate, ...)loss_self(theta, estimate, ...) loss_wself(theta, estimate, w = 1, ...) loss_mqself(theta, estimate, k = 1, ...) loss_plf(theta, estimate, a = 1, ...) loss_elf(theta, estimate, ...) loss_linex(theta, estimate, a = 1, ...) loss_gelf(theta, estimate, q = 2, ...) loss_kloss(theta, estimate, ...)
theta |
True parameter value. |
estimate |
Estimated value. |
... |
Additional parameters (unused). |
w |
Weight parameter (default: 1). |
k |
Shape parameter (default: 1). |
a |
Shape parameter (default: 1). |
q |
Shape parameter (default: 2). |
Loss value.
Loss value: (theta - estimate)^2
Loss value: w * (theta - estimate)^2
Loss value: (theta - estimate)^2 / (k + theta^2)
Loss value: (estimate/theta)^a - a * log(estimate/theta) - 1
Loss value: estimate/theta - log(estimate/theta) - 1
Loss value: exp(a * (estimate - theta)) - a * (estimate - theta) - 1
Loss value: (estimate/theta)^q / q - (estimate/theta) + 1/q
Loss value: (theta - estimate)^2 / (theta * estimate)
Computes mean absolute error between observed and fitted quantities.
mae(fit, type = "density", ...)mae(fit, type = "density", ...)
fit |
A lindleyfit object. |
type |
Type of comparison: "density", "cdf", "survival". |
... |
Additional arguments. |
MAE value.
Computes mean squared error between observed and fitted quantities.
mse(fit, type = "density", ...)mse(fit, type = "density", ...)
fit |
A lindleyfit object. |
type |
Type of comparison: "density", "cdf", "survival". |
... |
Additional arguments. |
MSE value.
Plots the fitted distribution over the data histogram.
plot_fitted(fit, type = "density", n = 100, ...)plot_fitted(fit, type = "density", n = 100, ...)
fit |
A lindleyfit object. |
type |
Type of plot: "density", "cdf", "survival". |
n |
Number of points for fitted curve. |
... |
Additional graphical parameters. |
Invisibly returns the fitted values.
Creates a contour or surface plot of the likelihood function.
plot_likelihood_surface( fit, theta1_range = NULL, theta2_range = NULL, n = 50, type = "contour", ... )plot_likelihood_surface( fit, theta1_range = NULL, theta2_range = NULL, n = 50, type = "contour", ... )
fit |
A lindleyfit object. |
theta1_range |
Range for first parameter. |
theta2_range |
Range for second parameter (for 2D plots). |
n |
Grid resolution. |
type |
Plot type: "contour" or "surface". |
... |
Additional graphical parameters. |
Invisibly returns the grid of likelihood values.
Creates a contour or surface plot of the posterior distribution.
plot_posterior_surface( fit, theta1_range = NULL, theta2_range = NULL, n = 50, type = "contour", ... )plot_posterior_surface( fit, theta1_range = NULL, theta2_range = NULL, n = 50, type = "contour", ... )
fit |
A lindleyfit object. |
theta1_range |
Range for first parameter. |
theta2_range |
Range for second parameter (for 2D plots). |
n |
Grid resolution. |
type |
Plot type: "contour" or "surface". |
... |
Additional graphical parameters. |
Invisibly returns the grid of posterior values.
Compares prior and posterior distributions.
plot_prior_posterior(fit, param_range = NULL, n = 100, ...)plot_prior_posterior(fit, param_range = NULL, n = 100, ...)
fit |
A lindleyfit object. |
param_range |
Range for parameter. |
n |
Number of points. |
... |
Additional graphical parameters. |
Invisibly returns the comparison data.
Creates a profile log-likelihood plot for each parameter.
plot_profile(fit, param_range = NULL, n = 50, ...)plot_profile(fit, param_range = NULL, n = 50, ...)
fit |
A lindleyfit object. |
param_range |
Range for each parameter (list or NULL for automatic). |
n |
Number of points per profile. |
... |
Additional graphical parameters. |
Invisibly returns the profile data.
Creates various residual plots.
plot_residuals(fit, type = "cox_snell", which = 1:3, ...)plot_residuals(fit, type = "cox_snell", which = 1:3, ...)
fit |
A lindleyfit object. |
type |
Type of residuals: "cox_snell", "martingale", "deviance", "pearson". |
which |
Which plots: 1=index plot, 2=QQ plot, 3=histogram. |
... |
Additional graphical parameters. |
Invisibly returns the residual values.
Creates diagnostic plots for the fitted model.
## S3 method for class 'lindleyfit' plot(x, which = 1:4, ask = TRUE, ...)## S3 method for class 'lindleyfit' plot(x, which = 1:4, ask = TRUE, ...)
x |
A lindleyfit object. |
which |
Which plots to display: 1=density overlay, 2=QQ plot, 3=PP plot, 4=residuals. |
ask |
Logical; whether to pause between plots. |
... |
Additional graphical parameters. |
Invisibly returns the object.
Functions for creating diagnostic and exploratory plots.
General function to compute E[g(theta)|data] using Lindley's approximation.
posterior_expectation(fit, g_fun, ...)posterior_expectation(fit, g_fun, ...)
fit |
A lindleyfit object. |
g_fun |
Function of parameters. |
... |
Additional arguments. |
Posterior expectation approximation.
Compute Posterior Mean Approximation
posterior_mean(fit, ...)posterior_mean(fit, ...)
fit |
A lindleyfit object. |
... |
Additional arguments. |
Posterior mean approximation.
Approximates posterior median using Lindley's approximation. Note: This is an approximation and may not be accurate for all distributions.
posterior_median(fit, ...)posterior_median(fit, ...)
fit |
A lindleyfit object. |
... |
Additional arguments. |
Posterior median approximation.
Predicts cumulative hazard values at specified time points.
predict_cumhaz(fit, times, ...)predict_cumhaz(fit, times, ...)
fit |
A lindleyfit object. |
times |
Vector of time points. |
... |
Additional arguments. |
Vector of cumulative hazard values.
Predicts the probability of failure by a specified time.
predict_failure_prob(fit, t, ...)predict_failure_prob(fit, t, ...)
fit |
A lindleyfit object. |
t |
Time point. |
... |
Additional arguments. |
Failure probability.
Predicts hazard function values at specified time points.
predict_hazard(fit, times, ...)predict_hazard(fit, times, ...)
fit |
A lindleyfit object. |
times |
Vector of time points. |
... |
Additional arguments. |
Vector of hazard values.
Computes prediction intervals based on distribution quantiles. Note: This is a prediction interval for future observations, not a confidence interval for parameters (which is outside the scope of Lindley's approximation).
predict_interval(fit, level = 0.95, ...)predict_interval(fit, level = 0.95, ...)
fit |
A lindleyfit object. |
level |
Confidence level (default: 0.95). |
... |
Additional arguments. |
Vector with lower and upper bounds.
Predicts the median time to failure from the fitted distribution.
predict_median(fit, ...)predict_median(fit, ...)
fit |
A lindleyfit object. |
... |
Additional arguments. |
Predicted median time to failure.
Predicts the mean time to failure from the fitted distribution.
predict_mttf(fit, ...)predict_mttf(fit, ...)
fit |
A lindleyfit object. |
... |
Additional arguments. |
Predicted mean time to failure.
Makes predictions for new data points.
predict_new(fit, newdata, type = "density", ...)predict_new(fit, newdata, type = "density", ...)
fit |
A lindleyfit object. |
newdata |
New data points. |
type |
Type of prediction: "density", "cdf", "survival", "hazard". |
... |
Additional arguments. |
Predicted values.
Predicts quantiles of the fitted distribution.
predict_quantiles(fit, probs = c(0.25, 0.5, 0.75), ...)predict_quantiles(fit, probs = c(0.25, 0.5, 0.75), ...)
fit |
A lindleyfit object. |
probs |
Vector of probabilities. |
... |
Additional arguments. |
Vector of predicted quantiles.
Predicts the remaining lifetime distribution for a surviving unit.
predict_remaining_lifetime(fit, current_age, ...)predict_remaining_lifetime(fit, current_age, ...)
fit |
A lindleyfit object. |
current_age |
Current age of the unit. |
... |
Additional arguments. |
List with mean and median remaining lifetime.
Predicts survival probabilities at specified time points.
predict_survival(fit, times, ...)predict_survival(fit, times, ...)
fit |
A lindleyfit object. |
times |
Vector of time points. |
... |
Additional arguments. |
Vector of survival probabilities.
Predicts the probability of surviving to a specified time.
predict_survival_prob(fit, t, ...)predict_survival_prob(fit, t, ...)
fit |
A lindleyfit object. |
t |
Time point. |
... |
Additional arguments. |
Survival probability.
Makes predictions for new data.
## S3 method for class 'lindleyfit' predict(object, newdata = NULL, type = "density", ...)## S3 method for class 'lindleyfit' predict(object, newdata = NULL, type = "density", ...)
object |
A lindleyfit object. |
newdata |
New data points. |
type |
Type of prediction: "density", "cdf", "survival", "hazard", "quantile". |
... |
Additional arguments. |
Predicted values.
Functions for making predictions from fitted models.
Provides a summary of prediction performance.
prediction_summary(fit, test_data, type = "density")prediction_summary(fit, test_data, type = "density")
fit |
A lindleyfit object. |
test_data |
Test data for evaluation. |
type |
Type of prediction to evaluate. |
List with prediction performance metrics.
Print Method for lindleyfit Objects
## S3 method for class 'lindleyfit' print(x, ...)## S3 method for class 'lindleyfit' print(x, ...)
x |
A lindleyfit object. |
... |
Additional arguments (unused). |
Invisibly returns the object.
Computes residuals for the fitted model.
## S3 method for class 'lindleyfit' residuals(object, type = "cox_snell", ...)## S3 method for class 'lindleyfit' residuals(object, type = "cox_snell", ...)
object |
A lindleyfit object. |
type |
Type of residuals: "cox_snell", "martingale", "deviance", "pearson", "generalized", "randomized". |
... |
Additional arguments. |
Residual values.
Computes root mean squared error between observed and fitted quantities.
rmse(fit, type = "density", ...)rmse(fit, type = "density", ...)
fit |
A lindleyfit object. |
type |
Type of comparison: "density", "cdf", "survival". |
... |
Additional arguments. |
RMSE value.
Generates complete (uncensored) random samples from a specified distribution.
simulate_complete(n, pdf, cdf, theta, ...)simulate_complete(n, pdf, cdf, theta, ...)
n |
Sample size. |
pdf |
Probability density function. |
cdf |
Cumulative distribution function. |
theta |
True parameter values. |
... |
Additional arguments. |
Vector of simulated observations.
Generates hybrid censored random samples.
simulate_hybrid(n, pdf, cdf, survival, theta, censoring_time, r, ...)simulate_hybrid(n, pdf, cdf, survival, theta, censoring_time, r, ...)
n |
Sample size. |
pdf |
Probability density function. |
cdf |
Cumulative distribution function. |
survival |
Survival function. |
theta |
True parameter values. |
censoring_time |
Censoring time. |
r |
Number of failures. |
... |
Additional arguments. |
List with observed data and censoring information.
Generates interval censored random samples.
simulate_interval(n, pdf, cdf, survival, theta, interval_width, ...)simulate_interval(n, pdf, cdf, survival, theta, interval_width, ...)
n |
Sample size. |
pdf |
Probability density function. |
cdf |
Cumulative distribution function. |
survival |
Survival function. |
theta |
True parameter values. |
interval_width |
Width of inspection intervals. |
... |
Additional arguments. |
Matrix with lower and upper bounds.
Generates left censored random samples.
simulate_left(n, pdf, cdf, survival, theta, censoring_time, ...)simulate_left(n, pdf, cdf, survival, theta, censoring_time, ...)
n |
Sample size. |
pdf |
Probability density function. |
cdf |
Cumulative distribution function. |
survival |
Survival function. |
theta |
True parameter values. |
censoring_time |
Censoring time. |
... |
Additional arguments. |
List with observed and censored components.
Generates left truncated random samples.
simulate_left_truncation(n, pdf, cdf, survival, theta, truncation_point, ...)simulate_left_truncation(n, pdf, cdf, survival, theta, truncation_point, ...)
n |
Sample size. |
pdf |
Probability density function. |
cdf |
Cumulative distribution function. |
survival |
Survival function. |
theta |
True parameter values. |
truncation_point |
Truncation point. |
... |
Additional arguments. |
List with observed data and truncation information.
Generates middle censored random samples.
simulate_middle(n, pdf, cdf, survival, theta, left_bound, right_bound, ...)simulate_middle(n, pdf, cdf, survival, theta, left_bound, right_bound, ...)
n |
Sample size. |
pdf |
Probability density function. |
cdf |
Cumulative distribution function. |
survival |
Survival function. |
theta |
True parameter values. |
left_bound |
Left censoring bound. |
right_bound |
Right censoring bound. |
... |
Additional arguments. |
List with observed data and censoring information.
Generates progressive Type-II censored random samples.
simulate_progressive(n, pdf, cdf, survival, theta, m, removal_scheme, ...)simulate_progressive(n, pdf, cdf, survival, theta, m, removal_scheme, ...)
n |
Sample size. |
pdf |
Probability density function. |
cdf |
Cumulative distribution function. |
survival |
Survival function. |
theta |
True parameter values. |
m |
Number of failures to observe. |
removal_scheme |
Removal scheme vector (length m). |
... |
Additional arguments. |
List with observed data and censoring information.
Generates random censored random samples.
simulate_random( n, pdf, cdf, survival, theta, censoring_dist = "exp", censoring_params = list(rate = 0.5), ... )simulate_random( n, pdf, cdf, survival, theta, censoring_dist = "exp", censoring_params = list(rate = 0.5), ... )
n |
Sample size. |
pdf |
Probability density function. |
cdf |
Cumulative distribution function. |
survival |
Survival function. |
theta |
True parameter values. |
censoring_dist |
Distribution for censoring times. |
censoring_params |
Parameters for censoring distribution. |
... |
Additional arguments. |
List with observed data and censoring information.
Generates right censored random samples.
simulate_right(n, pdf, cdf, survival, theta, censoring_time, ...)simulate_right(n, pdf, cdf, survival, theta, censoring_time, ...)
n |
Sample size. |
pdf |
Probability density function. |
cdf |
Cumulative distribution function. |
survival |
Survival function. |
theta |
True parameter values. |
censoring_time |
Censoring time. |
... |
Additional arguments. |
List with observed and censored components.
Generates right truncated random samples.
simulate_right_truncation(n, pdf, cdf, survival, theta, truncation_point, ...)simulate_right_truncation(n, pdf, cdf, survival, theta, truncation_point, ...)
n |
Sample size. |
pdf |
Probability density function. |
cdf |
Cumulative distribution function. |
survival |
Survival function. |
theta |
True parameter values. |
truncation_point |
Truncation point. |
... |
Additional arguments. |
List with observed data and truncation information.
Generates Type-I censored random samples.
simulate_type1(n, pdf, cdf, survival, theta, censoring_time, ...)simulate_type1(n, pdf, cdf, survival, theta, censoring_time, ...)
n |
Sample size. |
pdf |
Probability density function. |
cdf |
Cumulative distribution function. |
survival |
Survival function. |
theta |
True parameter values. |
censoring_time |
Censoring time. |
... |
Additional arguments. |
List with observed data and censoring information.
Generates Type-II censored random samples.
simulate_type2(n, pdf, cdf, survival, theta, r, ...)simulate_type2(n, pdf, cdf, survival, theta, r, ...)
n |
Sample size. |
pdf |
Probability density function. |
cdf |
Cumulative distribution function. |
survival |
Survival function. |
theta |
True parameter values. |
r |
Number of failures to observe. |
... |
Additional arguments. |
List with observed order statistics and censoring information.
Functions to generate simulated data under various censoring schemes for benchmarking Bayesian estimators.
Performs a simulation study to evaluate Bayesian estimators under repeated sampling.
simulation_study( nsim, n, pdf, cdf, survival, log_prior, theta_true, theta0, scheme = "complete", scheme_params = NULL, loss = "SELF", control = lindley.control(verbose = FALSE), parallel = FALSE, ncores = 2, ... )simulation_study( nsim, n, pdf, cdf, survival, log_prior, theta_true, theta0, scheme = "complete", scheme_params = NULL, loss = "SELF", control = lindley.control(verbose = FALSE), parallel = FALSE, ncores = 2, ... )
nsim |
Number of simulations. |
n |
Sample size per simulation. |
pdf |
Probability density function. |
cdf |
Cumulative distribution function. |
survival |
Survival function. |
log_prior |
Log-prior density function. |
theta_true |
True parameter values. |
theta0 |
Initial parameter values. |
scheme |
Censoring scheme. |
scheme_params |
Additional parameters for censoring scheme. |
loss |
Loss function. |
control |
Control parameters. |
parallel |
Logical; whether to use parallel computation. |
ncores |
Number of cores for parallel computation. |
... |
Additional arguments. |
Data frame with simulation results.
Summary Method for lindleyfit Objects
## S3 method for class 'lindleyfit' summary(object, ...)## S3 method for class 'lindleyfit' summary(object, ...)
object |
A lindleyfit object. |
... |
Additional arguments (unused). |
A list with summary statistics.
Various helper functions used throughout the package.