Here’s a simple illustration of the conflict between a p-value and a Bayesian measure of evidence.
Suppose you take a sample y1,…, yn from a normal population with mean mu and known standard deviation sigma. You wish to test
H: mu = mu0 A: mu not equal to mu0
The usual test is based on the statistic Z = sqrt(n)*(ybar – mu0)/sigma. One computes the p-value
p-value = 2 x P(Z >= z0)
and rejects H if the p-value is small. Suppose mu0 = 0, sigma = 1, and one takes a sample of size n = 4 and observe ybar = 0.98. Then one computes
Z = sqrt(4)*0.98 = 1.96
and the p-value is
p-value = 2 * P(Z > = 1.96) = 0.05.
Consider the following Bayes test of H against A. A Bayesian model is a specification of the sampling density and the prior density. One model M0 says that the mean mu = mu0. To complete the second model M1, we place a normal prior with mean mu0 and standard deviation tau on mu. The Bayes factor in support of the M0 over the model M1 is given by the ratio of predictive densities
BF = m(y | M0)/m(y|M1)
and the posterior probability of M0 is given by
P(M0| y) = p0 BF/(p0 BF + p1),
where p0 is the prior probability of M0.
The function mnormt.twosided in the LearnBayes package does this calculation. To use this function, we specify (1) the value m0 to be tested, (2) the prior probability of H, (3) the value of tau (the spread of the prior under A), and (4) the data vector that is (ybar, n, sigma).
Here we specify the inputs:
mu0=0; prob=.5; tau=0.5
ybar = 0.98; n = 4; sigma=1
Then we can use mnormt.twosided — the outputs are the Bayes factor and the posterior probability of H:
We see that the posterior probability of H0 is 0.35 which is substantially higher than the p-value of 0.05.
In this calculation, we assumed that tau = 0.5 — this reflect our belief about the spread of mu about mu0 under the alternative hypothesis. What if we chose a different value for tau?
We investigate the sensitivity of this posterior probability calculation with respect to tau.
We write a function that computes the posterior probability for a given value of tau.
data=c(.98,4,1); mu0=0; prob0=.5
Then we use the curve function to plot this function for values of tau between 0.01 to 4.
In the figure below, it looks like the probability of H exceeds 0.32 for all tau.