Package: TKApprox 0.1.0

TKApprox: 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 <doi:10.1080/01621459.1986.10478240>). 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 <ISBN:978-0-471-37215-8>; 'Meeker' & 'Escobar', 1998 <ISBN:978-0-471-14328-4>; 'Balakrishnan' & 'Aggarwala', 2000 <ISBN:978-0-8176-4129-0>; 'Kundu' & 'Pradhan', 2009 <doi:10.1198/TECH.2009.0019>), making it a flexible tool for Bayesian reliability, survival, and lifetime data analysis.

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

TKApprox_0.1.0.tar.gz
TKApprox_0.1.0.zip(r-4.7-any)TKApprox_0.1.0.zip(r-4.6-any)TKApprox_0.1.0.zip(r-4.5-any)
TKApprox_0.1.0.tgz(r-4.6-any)TKApprox_0.1.0.tgz(r-4.5-any)
TKApprox_0.1.0.tar.gz(r-4.7-any)TKApprox_0.1.0.tar.gz(r-4.6-any)
TKApprox_0.1.0.tgz(r-4.6-emscripten)
manual.pdf |manual.html
DESCRIPTION |NEWS
card.svg |card.png
TKApprox/json (API)

# Install 'TKApprox' in R:
install.packages('TKApprox', repos = c('https://shikhartyagi.r-universe.dev', 'https://cloud.r-project.org'))

On CRAN:

Conda:

This package does not link to any Github/Gitlab/R-forge repository. No issue tracker or development information is available.

3.60 score 52 exports 12 dependencies

Last updated from:238c54ce6f. Checks:9 OK. Indexed: yes.

TargetResultTimeFilesSyslog
linux-develOK140
source / vignettesOK246
linux-releaseOK145
macos-releaseOK93
macos-oldrelOK103
windows-develOK90
windows-releaseOK77
windows-oldrelOK64
wasm-releaseOK191

Exports:CAICDICeval_logposteriorexpected_logposteriorHQICloglik_completeloglik_dispatcherloglik_doubly_censoredloglik_hybrid_censoredloglik_interval_censoredloglik_left_censoredloglik_progressive_type2_censoredloglik_right_censoredloglik_type1_censoredloglik_type2_censoredlogprior_betalogprior_dispatcherlogprior_exponentiallogprior_gammalogprior_independentlogprior_invgammalogprior_lognormallogprior_normallogprior_uniformlogprior_weibullmodel_comparison_tableneglogLikplot_convergenceplot_credible_intervalsplot_likelihood_surfaceplot_posterior_approximationplot_prior_posteriorplot_residualsplot_sensitivity_estimatesplot_sensitivity_logposteriorplot_sensitivity_riskprint_model_comparisontk_expectationtk_expectationstk_fittk_hessiantk_losstk_loss_customtk_loss_geltk_loss_linextk_loss_precautionarytk_loss_seltk_loss_weighted_seltk_modetk_plottk_posteriortk_sensitivity

Dependencies:backportscheckmatedigestgenericslatticeMASSmaxLikmiscToolsnumDerivrlangsandwichzoo

Censoring Schemes
Introduction | Complete (Uncensored) Data | Right-Censored Data | Left-Censored Data | Interval-Censored Data | Type-I Censoring | Type-II Censoring | Progressive Type-II Censoring | Hybrid Censoring | Doubly Censored Data | Comparing Censoring Schemes | Tips for Working with Censored Data | Next Steps

Last update: 2026-08-07
Started: 2026-08-07

Defining Custom Distributions
Introduction | Required Functions | Continuous Distributions | Example 1: Log-Normal Distribution | Example 2: Pareto Distribution | Example 3: Burr Type XII Distribution | Discrete Distributions | Example 4: Poisson Distribution | Example 5: Negative Binomial Distribution | Using Custom Log-Likelihood Functions | Tips for Defining Distributions | Next Steps

Last update: 2026-08-07
Started: 2026-08-07

Introduction to TKApprox
Introduction | Basic Workflow | A Simple Example: Exponential Distribution | Step 1: Define the Distribution | Step 2: Specify Prior | Step 3: Generate Data | Step 4: Fit the Model | Step 5: Examine Results | Visualization | Different Loss Functions | Squared Error Loss (Posterior Mean) | LINEX Loss | General Entropy Loss | Censored Data | Prior Sensitivity Analysis | Multi-Parameter Models | Next Steps

Last update: 2026-08-07
Started: 2026-08-07

Loss Functions
Introduction | Squared Error Loss (SEL) | LINEX Loss | LINEX Sensitivity Analysis | General Entropy Loss (GEL) | Precautionary Loss | Weighted Squared Error Loss | Custom Loss Functions | Comparing All Loss Functions | Choosing a Loss Function | Multi-Parameter Models | Next Steps

Last update: 2026-08-07
Started: 2026-08-07

Prior Specification
Introduction | Standard Prior Families | Gamma Prior | Normal Prior | Beta Prior | Uniform Prior | Exponential Prior | Log-Normal Prior | Weibull Prior | Inverse Gamma Prior | Independent Priors for Multiple Parameters | Custom Prior Functions | Non-Informative (Flat) Priors | Prior Sensitivity Analysis | Systematic Prior Sensitivity | Choosing Prior Hyperparameters | Conjugate Priors | Weakly Informative Priors | Informative Priors | Tips for Prior Specification | Next Steps

Last update: 2026-08-07
Started: 2026-08-07

Real Data Example
Introduction | Dataset: Air Conditioning System Failure Times | Exploratory Data Analysis | Weibull Distribution Model | Define the Distribution | Specify Priors | Fit the Model with Complete Data | Examine Results | Model Comparison Statistics | Visualization | Analysis with Different Loss Functions | LINEX Loss | General Entropy Loss | Comparison of Loss Functions | Analysis with Censored Data | Create Right-Censored Data | Fit with Right Censoring | Compare Complete vs Censored | Reliability Function Estimation | Hazard Function Estimation | Prior Sensitivity Analysis | Prediction | Model Diagnostics | Comparison with Maximum Likelihood Estimation | Summary and Interpretation | Key Findings | Practical Implications | References | Next Steps

Last update: 2026-08-07
Started: 2026-08-07

Simulation Studies
Introduction | Basic Simulation Framework | Example 1: Exponential Distribution with Complete Data | Setup | Simulation Function | Run Simulations | Compute Performance Metrics | Display Results | Visualize Results | Example 2: Censoring Schemes Comparison | Simulation Function for Right Censoring | Compute Metrics | Visualize | Example 3: Prior Sensitivity Simulation | Example 4: Coverage Probability | Run Simulation | Example 5: Multi-Parameter Model Simulation | Parallel Simulation | Tips for Simulation Studies | Interpreting Simulation Results | Bias | Variance | MSE | Coverage Probability | Next Steps

Last update: 2026-08-07
Started: 2026-08-07

Tierney-Kadane Approximation: Theory and Derivation
Introduction | Problem Statement | Laplace Approximation Background | Tierney-Kadane Derivation | Step 1: Posterior Mode | Step 2: Modified Function for Expectation | Step 3: TK Approximation Formula | Properties of the TK Approximation | Accuracy | Requirements | Advantages | Limitations | Implementation in TKApprox | Function Structure | Example: Computing Posterior Mean | Connection to Loss Functions | Squared Error Loss (Posterior Mean) | LINEX Loss | General Entropy Loss | Precautionary Loss | Weighted Squared Error Loss | Numerical Considerations | Optimization | Numerical Differentiation | Numerical Stability | Comparison with Other Methods | vs. MCMC | vs. Variational Inference | vs. Importance Sampling | References | Next Steps

Last update: 2026-08-07
Started: 2026-08-07

Readme and manuals

Help Manual

Help pageTopics
AIC Method for tkfit ObjectsAIC.tkfit
BIC Method for tkfit ObjectsBIC.tkfit
Compute CAIC (Consistent AIC)CAIC CAIC.tkfit
Coefficients Method for tkfit Objectscoef.tkfit
Compute DIC (Deviance Information Criterion) ApproximationDIC DIC.tkfit
Evaluate the Log-Posterior at Given Parameterseval_logposterior
Compute Expected Log-Posteriorexpected_logposterior expected_logposterior.tkfit
Compute HQIC (Hannan-Quinn Information Criterion)HQIC HQIC.tkfit
Likelihood Construction for Censored Datalikelihood
Complete (Uncensored) Data Log-Likelihoodloglik_complete
Generic Likelihood Dispatcherloglik_dispatcher
Doubly Censored Data Log-Likelihoodloglik_doubly_censored
Hybrid Censored Data Log-Likelihoodloglik_hybrid_censored
Interval-Censored Data Log-Likelihoodloglik_interval_censored
Left-Censored Data Log-Likelihoodloglik_left_censored
Progressive Type-II Censored Data Log-Likelihoodloglik_progressive_type2_censored
Right-Censored Data Log-Likelihoodloglik_right_censored
Type-I Censored Data Log-Likelihoodloglik_type1_censored
Type-II Censored Data Log-Likelihoodloglik_type2_censored
Log-Likelihood Method for tkfit ObjectslogLik.tkfit
Generic Prior Function Dispatcherlogprior_dispatcher
Independent Priors for Multiple Parameterslogprior_independent
Model Comparison Statistics for tkfit Objectsmodel_comparison
Comprehensive Model Comparison Tablemodel_comparison_table
Compute Negative Log-LikelihoodneglogLik neglogLik.tkfit
Convergence Diagnostic Plotplot_convergence
Credible Intervals Plotplot_credible_intervals
Likelihood Surface Plotplot_likelihood_surface
Posterior Approximation Plotplot_posterior_approximation
Prior vs Posterior Comparison Plotplot_prior_posterior
Residuals Plotplot_residuals
Plot Sensitivity of Estimatesplot_sensitivity_estimates
Plot Sensitivity of Log-Posteriorplot_sensitivity_logposterior
Plot Sensitivity of Riskplot_sensitivity_risk
Plot Method for tkfit Objectsplot.tkfit
Plot Method for tksensitivity Objectsplot.tksensitivity
Predict Method for tkfit Objectspredict.tkfit
Print Model Comparison Tableprint_model_comparison
Print Method for tkexpectation Objectsprint.tkexpectation
Print Method for tkfit Objectsprint.tkfit
Print Method for tkhessian Objectsprint.tkhessian
Print Method for tkmode Objectsprint.tkmode
Print Method for tksensitivity Objectsprint.tksensitivity
Prior Distribution Functionslogprior_beta logprior_exponential logprior_gamma logprior_invgamma logprior_lognormal logprior_normal logprior_uniform logprior_weibull priors
Residuals Method for tkfit Objectsresiduals.tkfit
Summary Method for tkfit Objectssummary.tkfit
Tierney-Kadane Approximation of Posterior Expectationstk_expectation
Compute Multiple Expectations Efficientlytk_expectations
Main Function for Bayesian Estimation via Tierney-Kadane Approximationtk_fit
Compute the Hessian and Posterior Covariance Matrixtk_hessian
Bayes Estimators Under Various Loss Functionstk_loss
Custom Loss Function Estimatortk_loss_custom
General Entropy Loss (GEL) Estimatortk_loss_gel
LINEX Loss Estimatortk_loss_linex
Precautionary Loss Estimatortk_loss_precautionary
Squared Error Loss (SEL) Estimatortk_loss_sel
Weighted Squared Error Loss Estimatortk_loss_weighted_sel
Find the Posterior Mode via Optimizationtk_mode
Visualization Functions for tkfit Objectstk_plot
Construct the Log-Posterior Functiontk_posterior
Prior Sensitivity Analysistk_sensitivity
Variance-Covariance Method for tkfit Objectsvcov.tkfit