A General Framework for Bayesian Estimation Using the 'Tierney'-'Kadane' Approximation

Provides a distribution-independent framework for Bayesian estimation of arbitrary univariate probability models using the 'Tierney'-'Kadane' approximation ('Tierney' & 'Kadane', 1986 ). Users specify the probability distribution, likelihood, prior distributions, and censoring mechanism, while the package automatically constructs the posterior distribution, computes posterior modes and Hessian matrices, approximates posterior expectations under several Bayesian loss functions, and returns Bayesian parameter estimates, posterior covariance matrices, credible intervals, diagnostic plots, and model comparison statistics. Supports complete, right-, left-, interval-, Type-I, Type-II, progressive Type-II, hybrid, and doubly censored data ('Lawless', 2003 ; 'Meeker' & 'Escobar', 1998 ; 'Balakrishnan' & 'Aggarwala', 2000 ; 'Kundu' & 'Pradhan', 2009 ), making it a flexible tool for Bayesian reliability, survival, and lifetime data analysis.


TKApprox

A General Framework for Bayesian Estimation Using the Tierney-Kadane Approximation

Overview

TKApprox provides a distribution-independent framework for Bayesian estimation of arbitrary univariate probability models using the Tierney-Kadane approximation. Users specify the probability distribution, likelihood, prior distributions, and censoring mechanism, while the package automatically constructs the posterior distribution, computes posterior modes and Hessians, approximates posterior expectations under several Bayesian loss functions, and returns Bayesian parameter estimates, posterior covariance matrices, credible intervals, diagnostic plots, and model comparison statistics.

Features

  • Distribution-agnostic: Works with any user-specified univariate probability distribution (continuous or discrete)
  • Multiple loss functions: Squared Error Loss (SEL), LINEX, General Entropy Loss (GEL), Precautionary Loss, Weighted SEL, and custom loss functions
  • Comprehensive censoring support: Complete, right-, left-, interval-, Type-I, Type-II, progressive Type-II, hybrid, and doubly censored data
  • Flexible priors: Gamma, Normal, Beta, Uniform, Exponential, Log-Normal, Weibull, Inverse Gamma, and user-defined priors
  • Multiple optimization backends: BFGS, L-BFGS-B, Nelder-Mead, nlminb, maxLik, and trust methods
  • Numerical differentiation: Uses numDeriv with optional analytic derivative support
  • Credible intervals: Approximate credible intervals via normal approximation using the posterior covariance matrix
  • Model comparison: AIC, BIC, CAIC, HQIC, DIC, and expected log-posterior
  • Prior sensitivity analysis: Systematic examination of prior hyperparameter impact
  • Rich visualization: Posterior approximations, likelihood surfaces, prior-posterior comparisons, convergence diagnostics, and more
  • S3 methods: summary(), print(), coef(), vcov(), logLik(), AIC(), BIC(), plot(), predict(), residuals()

Installation

# Install from CRAN (when available)
install.packages("TKApprox")

# Install development version from GitHub
devtools::install_github("yourusername/TKApprox")

Quick Start

Example: Exponential Distribution with Gamma Prior

library(TKApprox)

# Define the exponential distribution
pdf_exp <- function(x, param) dexp(x, rate = param)
cdf_exp <- function(x, param) pexp(x, rate = param)

# Specify gamma prior for the rate parameter
prior_spec <- list(
  rate = list(family = "gamma", hyperparameters = list(shape = 2, rate = 1))
)

# Generate some data
set.seed(123)
data <- rexp(20, rate = 1.5)

# Fit the model using squared error loss (posterior mean)
fit <- tk_fit(
  data = data,
  censoring_scheme = "complete",
  pdf = pdf_exp,
  cdf = cdf_exp,
  prior_spec = prior_spec,
  initial_values = c(rate = 1),
  loss_function = "sel"
)

# View results
summary(fit)

# Plot diagnostics
plot(fit)

# Compute model comparison statistics
print_model_comparison(fit)

Example with Right-Censored Data

# Define censoring indicators (1 = observed, 0 = right-censored)
status <- c(1, 1, 0, 1, 0, 1, 1, 0, 1, 1)

fit_censored <- tk_fit(
  data = data,
  censoring_scheme = "right-censored",
  pdf = pdf_exp,
  cdf = cdf_exp,
  prior_spec = prior_spec,
  initial_values = c(rate = 1),
  loss_function = "sel",
  status = status
)

summary(fit_censored)

Example with LINEX Loss

fit_linex <- tk_fit(
  data = data,
  censoring_scheme = "complete",
  pdf = pdf_exp,
  cdf = cdf_exp,
  prior_spec = prior_spec,
  initial_values = c(rate = 1),
  loss_function = "linex",
  loss_params = list(c = 0.5)
)

summary(fit_linex)

Prior Sensitivity Analysis

sensitivity <- tk_sensitivity(
  fit = fit,
  parameter_name = "rate",
  hyperparameter_name = "shape",
  hyperparameter_values = c(0.5, 1, 2, 5, 10)
)

print(sensitivity)
plot(sensitivity)

Censoring Schemes

The package supports the following censoring schemes:

  • Complete/Uncensored: Standard complete data
  • Right-censored: Some observations are right-censored
  • Left-censored: Some observations are left-censored
  • Interval-censored: Observations fall within intervals
  • Type-I censoring: Fixed censoring time
  • Type-II censoring: Experiment ends after r failures
  • Progressive Type-II censoring: Items removed progressively at failure times
  • Hybrid censoring: Combination of Type-I and Type-II
  • Doubly censored: Both left- and right-censoring present

Loss Functions

The following Bayesian loss functions are supported:

  • Squared Error Loss (SEL): Posterior mean
  • LINEX Loss: Asymmetric linear-exponential loss
  • General Entropy Loss (GEL): Generalized entropy loss
  • Precautionary Loss: Conservative estimation
  • Weighted Squared Error Loss: Inverse-variance weighting
  • Custom: User-defined loss functions

Prior Distributions

Supported prior families:

  • Gamma
  • Normal
  • Beta
  • Uniform
  • Exponential
  • Log-Normal
  • Weibull
  • Inverse Gamma
  • User-defined (via custom functions)

Package Philosophy

TKApprox follows the same design philosophy as UniIS, UniCensorEM, and UniLindleyApprox:

  • The user defines the statistical model
  • The package supplies the estimation engine
  • The workflow is identical regardless of distribution, parameter count, or censoring scheme

Contributing

Contributions are welcome! Please read our contributing guidelines before submitting pull requests.

License

GPL (>= 3)

Citation

To cite this package, use:

citation("TKApprox")

Author

Your Name

Acknowledgments

This package extends the design philosophy established in UniIS, UniCensorEM, and UniLindleyApprox packages.

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.

install.packages("TKApprox")

0.1.0 by Shikhar Tyagi, 2 months ago


Browse source code at https://github.com/cran/TKApprox


Authors: Shikhar Tyagi [aut, cre] (ORCID: , Arvind Pandey [aut] , Bhupendra Singh [aut] , Vrijesh Tripathi [aut]


Documentation:   PDF Manual  


GPL (>= 3) license


Imports checkmate, numDeriv, maxLik, rlang, stats, graphics, grDevices, utils, MASS

Suggests testthat, knitr, rmarkdown, pkgdown, ggplot2, gridExtra


See at CRAN