Bayesian Thinking

Bayesian testing of a point null hypothesis


Here is today’s example illustrating a Bayesian test of a point null hypothesis.  In Agresti and Franklin’s intro stats book, there is an example wondering if Americans work, on average, 40 hours per week.   If represents the mean hours worked per week for all Americans, we are interested in testing against the alternative .

In the example in Agresti and Franklin’s text, a sample of 868 workers were selected and one observes that the workers worked an average of 39.11 hours and one assumes the population standard deviation is equal to .  The test statistic is

and one computes a p-value of 0.061.  There seems to be moderately significant evidence that the mean working hours for all workers is different from 40.

Here’s an outline of a Bayesian test (I give more details in class):

1.  We assign probabilities to the hypotheses and .  Here we assume each hypothesis is equally likely.

2.  Under the hypothesis , the prior for is a point mass at the hypotheized value of 40.

3.  Under the alternative hypothesis, we’ll place a N(40, ) prior on .  This reflects the belief that, under the alternative, values of near 40 are more likely that values far from 40.

Under these assumptions, we give (in class) the posterior probability of the hypothesis . This probability is programmed in the function mnormt.twosided in the LearnBayes package.  The inputs to this function are (1) the value to be tested, (2) the prior probability of , (3) a vector of values of and (4) a data vector consisting of .  The outputs are the Bayes factor in support of and the posterior probability of .

Since it is not clear how to specify the prior standard deviation — we compute the posterior probability for a range of values of .  I write a short function to output the posterior probability as a function of and then I use the curve function to plot this probability for values of from 0.01 to 2.

What we see is that the posterior probability of exceeds 0.35 for all values of .  This suggests that the p-value overstates the evidence against the null hypothesis.

> data=c(39.11, 868, 14)
> prob.H=function(tau)
+   mnormt.twosided(40,.5,tau,data)$post

> curve(prob.H(x),from=.01,to=2,xlab=”TAU”,ylab=”P(H)”)