# Bayesian Analysis of Gluten Sensitivity

**This post was originally posted on Allen Downey’s Blog, and was kindly contributed to Open Data Science**

**Bio:** Allen Downey is a Professor of Computer Science at Olin College of Engineering in Massachusetts. He is the author of several books, including Think Python, Think Stats, and Think Bayes. He is a runner with a maximum 10K speed of 8.7 mph.

Last week a new study showed that many subjects diagnosed with non-celiac gluten sensitivity (NCGS) were not able to distinguish gluten flour from non-gluten flour in a blind challenge.

In this article, I review the the study and use a simple Bayesian model to show that the results support the hypothesis that none of the subjects are sensitive to gluten. But there are complications in the design of the study that might invalidate the model.

Here is a description of the study:

“We studied 35 non-CD subjects (31 females) that were on a gluten-free diet (GFD), in a double-blind challenge study. Participants were randomised to receive either gluten-containing ﬂour or gluten-free ﬂour for 10 days, followed by a 2-week washout period and were then crossed over. The main outcome measure was their ability to identify which ﬂour contained gluten.

“The gluten-containing ﬂour was correctly identiﬁed by 12 participants (34%)…”

Since 12 out of 35 participants were able to identify the gluten flour, the authors conclude “Double-blind gluten challenge induces symptom recurrence in just one-third of patients fulﬁlling the clinical diagnostic criteria for non-coeliac gluten sensitivity.”

This conclusion seems odd to me, because if none of the patients were sensitive to gluten, we would expect some of them to identify the gluten flour by chance. So the results are consistent with the hypothesis that none of the subjects are actually gluten sensitive.

We can use a Bayesian approach to interpret the results more precisely. But first, as always, we have to make some modeling decisions.

First, of the 35 subjects, 12 identified the gluten flour based on resumption of symptoms while they were eating it. Another 17 subjects wrongly identified the gluten-free flour based on their symptoms, and 6 subjects were unable to distinguish. So each subject gave one of three responses. To keep things simple I follow the authors of the study and lump together the second two groups; that is, I consider two groups: those who identified the gluten flour and those who did not.

Second, I assume (1) people who are actually gluten sensitive have a 95% chance of correctly identifying gluten flour under the challenge conditions, and (2) subjects who are not gluten sensitive have only a 40% chance of identifying the gluten flour by chance (and a 60% chance of either choosing the other flour or failing to distinguish).

Under this model, we can estimate the actual number of subjects who are gluten sensitive, gs. I chose a uniform prior for gs, from 0 to 35. To perform the Bayesian analysis, we have to compute the likelihood of the data under each hypothetical value of gs. Here is the likelihood function in Python

def Likelihood(self, data, hypo):

gs = hypo

yes, no = data

n = yes + no

ngs = n – gs

pmf1 = thinkbayes2.MakeBinomialPmf(gs, 0.95)

pmf2 = thinkbayes2.MakeBinomialPmf(ngs, 0.4)

pmf = pmf1 + pmf2

return pmf[yes]

The function works by computing the PMF of the number of gluten identifications conditioned on gs, and then selecting the actual number of identifications, yes, from the PMF. The details of the computation are in this IPython notebook.

And here is the posterior distribution:

The most likely value of gs is 0, so it is quite possible that none of the respondents are gluten sensitive. The 95% credible interval for gs is (0, 8), so a reasonable upper bound on the number of gluten-sensitive respondents is 8 out of 35, or 23%.

We can also use this analysis to compare two hypotheses:

A) Some of the respondents are gluten sensitive (equally likely from 0 to 35).

B) None of the respondents are gluten sensitive.

The Bayes factor in support of B turns out to be about 8.4, which is moderately strong. If you believed, before reading this study, that the probability of B was 50%, you should now believe it is about 90%.

However, there are complications in the design of the study that might invalidate this simple model. In particular, the gluten free flour in the study contained corn starch, which some people may be sensitive to. And several subjects reported symptoms under both challenge conditions; that is, when eating both gluten flour and gluten-free flour. So it is possible that misidentification of the gluten flour, as well as failure to distinguish, indicates sensitivity to both gluten and corn starch.

But if we limit ourselves to the question of whether people diagnosed with non-celiac gluten sensitivity are *specifically* sensitive to gluten, this study suggests that they are not.

**Thank yous:** I heard about this study in this blog post. And I want to thank the authors of the study and their publisher for making the entire paper available on the web, which made my analysis possible.

**Update 2 Sep 2015:** There is some additional discussion of this analysis on Reddit, including a very nice generalization from PhaethonPrime.