Chatzimichail T., Aristides T. Hatjimihail. Bayesian Diagnosis: A Bayesian-Based Computational Tool for Parametric and Nonparametric Medical Diagnosis. Drama, Greece: Hellenic Complex Systems Laboratory, 2023. Available at: https://www.hcsl.com/Tools/BayesianDiagnosis/​
ARTICLE: https://www.hcsl.com/Documents/hcsltr25.pdf​
INTERFACE: https://www.hcsl.com/Documents/BayesianDiagnosisInterface.pdf

A Bayesian Inference Based Computational Tool for Parametric and Nonparametric Medical Diagnosis

This work is collaborative effort from Theodora Chatzimichail and Aristides T. Hatjimihail
Article Abstract: Medical diagnosis is the basis for treatment and management decisions in healthcare. Conventional methods for medical diagnosis commonly use established clinical criteria and fixed numerical thresholds. The limitations of such an approach may result in a failure to capture the intricate relations between diagnostic tests and the varying prevalence of diseases. To explore this further, we have developed a freely available specialized computational tool that employs Bayesian inference to calculate the posterior probability of disease diagnosis. This novel software comprises of three distinct modules, each designed to allow users to define and compare parametric and nonparametric distributions effectively. The tool is equipped to analyze datasets generated from two separate diagnostic tests, each performed on both diseased and nondiseased populations. We demonstrate the utility of this software by analyzing fasting plasma glucose and glycated hemoglobin A1c data from the National Health and Nutrition Examination Survey. Our results are validated using the oral glucose tolerance test as a reference standard, and we explore both parametric and nonparametric distribution models for the Bayesian diagnosis of diabetes mellitus.

Interface of the program Bayesian Diagnosis

About the program controls

The numerical settings are defined by the user with menus or sliders. Sliders can be finely manipulated by holding down the alt key or opt key while dragging the mouse. They be even more finely manipulated by also holding the shift and/or ctrl keys.
Dragging with the mouse rotates the three-dimensional plots, while dragging with the mouse while pressing the ctrl, alt, or opt keys zooms in or out.

Range of input parameters

v : 0.010 – 0.500
μ : 0.01 – 10000.00
𝜎 : 0.01 – 3000.00
ρ : –1.000 – 1.000
h : 0.01 – 2.00 (standard deviation units)
x : 0.01 – 10000.00
y : 0.01 – 10000.00

Input and output

This program consists of three primary modules with eighteen submodules. It allows the calculation, plotting and comparison of Bayesian posterior probability of disease for two diagnostic tests, assuming two sets of alternative parametric and nonparametric distributions of the measurements of the tests in diseased and nondiseased populations.

Input

For each module the user defines:
1. The prior probability of disease (prevalence)
2. Two sets of four univariate and two bivariate distributions:
◼
  • 2.1. Two sets of parametric distributions for the parametric module.
  • ◼
  • 2.2. Two sets of kernel density estimators (KDE) for the KDE module
  • ◼
  • 2.3. One set of parametric distributions and one set of KDE for the parametric vs KDE module
  • 3. A pair of values
    (x,y)
    of the two measurands.
    Each set contains the following distributions:
    1. The univariate distribution of the first measurand in the diseased population
    2. The univariate distribution of the first measurand in the nondiseased population
    3. The univariate distribution of the second measurand in the diseased population
    4. The univariate distribution of the second measurand in the nondiseased population
    5. The bivariate distribution of the first and second measurand in the diseased population
    6. The bivariate distribution of the first and second measurand in the nondiseased population
    Each univariate parametric distribution is defined by:
    1. The type of the distribution:
    ◼
  • 1.1. Normal
  • ◼
  • 1.2. Lognormal
  • ◼
  • 1.3. Gamma
  • 2. The mean of the measurand in the population
    3. The standard deviation of the measurand in the population
    Each bivariate parametric distribution is defined by:
    1. The two marginal univariate distributions of each measurand in the population
    2. The correlation coefficient of the two measurands in the population
    For each univariate KDE the user defines its bandwidth (
    h
    ).
    Each bivariate KDE is defined by:
    1. The two marginal univariate KDE of each measurand in the population
    2. The correlation coefficient of the two measurands in the population

    Output

    Each module generates:

    Plots

    The following plots are generated:
    Posterior probability of disease:
    1. The posterior probability of disease for each measurand and their combination, for the two sets of distributions
    2. The difference between the posterior probability of disease for each measurand of and their combination, of the two sets of distributions
    Probability density function:
    1. The probability density function (PDF) of each measurand and their combination, for the two sets of distributions
    2. The PDF of each measurand and their combination, for the two sets of distributions, with the respective histograms of the provided datasets
    3. Q-Q plots: Q-Q plots of each measurand in diseased and nondiseased vs the respective dataset.
    4. P-P plots: P-P plots of each measurand in diseased and nondiseased vs the respective dataset.

    Tables

    Each module generates the following tables:
    Statistics​
    A table with the statistics for each set of distributions and the datasets:
    1. Mean
    2. Median
    3. Standard Deviation
    4. Skewness
    5. Kurtosis
    6. Log-likelihood
    7. Correlation coefficient
    Probability of disease
    A table with the probability of disease for each set of distributions, and their difference:
    1. The prior probability of disease (prevalence)
    2. The probability of disease for the first measurand
    3. The probability of disease for the second measurand
    4. The probability of disease for both measurands, combined

    Notation

    Parameters

    v : prevalence of disease
    μ: mean
    σ : standard deviation
    ρ: correlation coefficient
    h : nonparametric kernel density bandwidth

    Functions

    P(disease): posterior probability of disease

    Abbreviations

    PDF: probability density function
    KDE: kernel density estimator
    OGTT: oral glucose tolerance test
    FPG: fasting plasma glucose
    HbA1c: glycated hemoglobin A1c
    NHANES: National Health and Nutrition Examination Survey
    More details can be found here: https://www.hcsl.com/Documents/BayesianDiagnosisInterface.pdf

    Code and program

    Datasets

    The datasets of the program have been obtained from the database of the National Health and Nutrition Examination Survey (NHANES), Centers for Disease Control and Prevention, USA. They are the following:
    ◼
  • d1: First measurand (fasting plasma glucose, mg/dl) in diseased (diabetics 40-60 years old)
  • ◼
  • nd1: First measurand (fasting plasma glucose, mg/dl) in nondiseased (nondiabetics 40-60 years old)
  • ◼
  • d2: Second measurand (glycated hemoglobin A1c, %) in diseased (diabetics 40-60 years old)
  • ◼
  • nd2: Second measurand (glycated hemoglobin A1c, %) in nondiseased (nondiabetics 40-60 years old)
  • d1=
    ;​​(*d2:2ndmeasurandindiseased.Currentdataset:GlycatedHemoglobinA1c(%)innondiabetics40-60yearsold*)​​d2=
    ;​​(*nd1:1stmeasurandinnondiseased.Currentdataset:FastingPlasmaGlucose(mg/dl)innondiabetics40-60yearsold*)​​nd1=
    ;​​(*nd2:2ndmeasurandinnondiseased.Currentdataset:GlycatedHemoglobinA1c(%)innondiabetics40-60yearsold*)​​nd2=
    ;

    Parameters and functions definitions

    The program
    

    CITE THIS NOTEBOOK

    A Bayesian Inference Based Computational Tool for Parametric and Nonparametric Medical Diagnosis​
    by Theodora Chatzimichail and Aristides T. Hatjimihail​
    Wolfram Community, STAFF PICKS, September 20, 2023
    ​https://community.wolfram.com/groups/-/m/t/3016886