Learn R Programming

fbst (version 2.2)

bdm: bdm

Description

Calculates the Bayesian discrepancy measure for a precise null hypothesis.

Usage

bdm(posteriorDensityDraws, nullHypothesisValue=0)

Value

Returns the value \(\delta_H(x)\) of the BDM.

Arguments

posteriorDensityDraws

Vector of (MCMC) posterior parameter draws.

nullHypothesisValue

Parameter value of the precise null hypothesis. Defaults to zero.

Author

Riko Kelter

Details

The BDM is calculated as \(\delta_H(x):=2\cdot P(\theta \in I_H(x)|x)\) where \(I_H(x):=(m,\theta_0)\) if \(m<\theta_0\), \(I_H(x):=\{m\}\) if \(m=\theta_0\) and \(I_H(x):=(\theta_0,m)\) if \(m>\theta_0\), where \(m\) denotes the posterior median of the parameter \(\theta\), and the null hypothesis specifies \(H_0:\theta=\theta_0\).

References

For details, see: https://arxiv.org/abs/2105.13716

Examples

Run this code
set.seed(57)
grp1=rnorm(50,0,1.5)
grp2=rnorm(50,0.8,3.2)

p = as.vector(BayesFactor::ttestBF(x=grp1,y=grp2, 
  posterior = TRUE, iterations = 3000, 
  rscale = "medium")[,4])

bdm(p,0)

Run the code above in your browser using DataLab