Our simplest application of Bayes’ rules looks like this example:
The first thing to note is that this formulation is not amenable for use with uncertain numbers such as intervals for the probability values because of repeated variables. However, Bayes’ rule can easily be rearranged to omit the repetitions comme ça:
This allows us to straightforwardly use intervals and p-boxes for the various inputs. For instance, contrast the original formulation with the rearranged one with intervals:
Does this application of Bayes’ rule assume independence between the inputs? If so, then can it be restructured by appeal to the Fréchet (1935) inequalities (see above) to generalize it for cases where it is not reasonable to assume independence? For example, if there is some reason to think that specificity and sensitivity are not stochastically or epistemically independent, what weaker conclusion can be drawn? And if somehow there is no issue of dependence between the inputs, what’s the pedagogical explanation of why there isn’t?
The question of independence perhaps becomes more acute if we model the sensitivity, specificity and prevalence with probability distributions. We might do this if we had sampling uncertainty about these probabilities. If the test characteristics were based on the same data set or something, I presume that there could be some dependence between sensitivity and specificity. The R script below shows how different dependencies could affect the resulting posterior distribution.
source('ESTpbox.r')
pbox.steps = 100
many = 1000
p = 0.1 # prevalence
S = beta(3,4) # sensitivity (precise p-box)
T = beta(5,2) # specificity (precise p-box)
u = runif(many)
s = qbeta(u,3,4) # sensitivity (Monte Carlo)
t = qbeta(u, 5,2) # specificity (Monte Carlo)
# check that MC samples match distributions constructed as p-boxes
plot(S)
lines(T, col='blue')
edf(s)
edf(t)
# Bayes' rule implemented with p-boxes, assuming independence
ibr = function(p,s,t) return(1/(1+(1/p-1) %|*|% (1-t) %|/|% s))
# Bayes' rule implemented with PBA using Fréchet operations
fbr = function(p,s,t) return(1/(1+(1/p-1) %x% (1-t) %div% s))
# Bayes' rule implemented with Monte Carlo simulation
br = function(p,s,t) return(1/(1+(1/p-1)*(1-t)/s))
b = fbr(p,S,T)
# sensitivity and specificity are perfectly dependent
s = qbeta(u,3,4)
t = qbeta(u, 5,2)
plot(u,u)
p = 0.1
b1 = br(p,s,t)
# oppositely dependent
s = qbeta(u,3,4)
t = qbeta(1-u, 5,2)
plot(u,1-u)
p = 0.1
b2 = br(p,s,t)
# independence
s = qbeta(u,3,4)
t = qbeta(runif(many), 5,2)
plot(u,runif(many))
p = 0.1
b3 = br(p,s,t)
# “St. Andrews cross” dependence
v = u
v[1:(many/2)] = 1-v[1:(many/2)]
plot(u,v)
s = qbeta(u,3,4)
t = qbeta(v,5,2)
p = 0.1
b4 = br(p,s,t)
# ”parallel segments” dependence
u = u/2
w = u[1:(many/2)]
v = 1/2-w
w = u[((many/2)+1):many]
v = c(v, 1-w)
u[((many/2)+1):many] = w + 1/2
plot(u,v)
s = qbeta(u,3,4)
t = qbeta(v,5,2)
p = 0.1
b5 = br(p,s,t)
# reverse of previous dependence
s = qbeta(u,3,4)
t = qbeta(1-v,5,2)
plot(u,1-v)
p = 0.1
b6 = br(p,s,t)
plot(NULL,xlim=c(0,1),ylim=c(0,1))
show(b)
edf(b1)
edf(b2)
edf(b3)
edf(b4)
edf(b5)
edf(b6)
The final displayed figure shows a p-box (in red and black) for the posterior, and various distributions (in green) corresponding to different dependence patterns between the sensitivity and specificity distributions. Does this make sense? Am I merely confused about this? Can there be dependence between specificity and sensitivity? And, if there can be, would it not also affect the form of Bayes’ rule and not merely the arithmetic operations used to evaluate it?
Pedagogical discussions don’t usually talk about the dependence between sensitivity and specificity. If you say that sensitivity (say, s) and specificity (c) ARE stochastically independent, this claim itself suggests to me that there must be some situations in which they might not be stochastically independent. And, if this is so, then we have a complication to deal with in those funky situations where they happen to fail to be independent. What it MEANS to say events A and B are independent is that we can compute the probability of the joint event A&B as P(A & B) = P(A) * P(B).
If, on the other hand, you were to say that the issue of dependence between s and c is IRRELEVANT because, for instance, they are events in probability spaces that do not overlap, then we would be free of having to deal any further with the issue.
Now that I say it this way, it occurs to me that it must be true that their dependence is irrelevant for just this very reason. These conditional probabilities reflect subsets of two probability spaces that are complementary to one another, and thus nonoverlapping. Forming the product s * c = P(+|sick) * P(-|not sick) does not reflect any event involving the test outcome and my health. Thus I would say that these events whose probabilities are s and c are NEITHER "independent" nor "not independent", just because it makes no sense to talk about their joint event. Their joint event would be "testing positive when I have the disease" while at the same time "testing negative (in that same, single test!) when not having the disease".
Such a construction reminds me of the old joke by the cartoonist Roz Chast who depicts a Venn diagram with overlapping circles. One circle is labeled "people who understand Venn diagrams" and the other circle is labeled "people who do not understand Venn diagrams". Naturally, the overlap of the two circles is labeled "people who understand Venn diagrams and do not understand Venn diagrams".
If we follow http://en.wikipedia.org/wiki/Independence_%28probability_theory%29 and define independence like this:
Two events A and B are independent if and only if Pr(A ∩ B) = Pr(A)Pr(B),
then I guess we’d have to say the events characterized by s and c are not independent because their intersection is the empty set whose probability is zero, which is typically not the product of s and c. Unless it’s improper even to talk about the intersection of these events because they’re not from the same space or something. I guess we need to be really careful to define the spaces and exactly what the elements of those spaces are. Are the elements people?
Having said all this, remarkably it’s still not at all clear that the simulations and graphs depicted on the preceding pages are gibberish. Those distributions reflect our uncertainty about the probabilities, and maybe that uncertainty could have cross dependence. I guess we are at least clearer that the form of Bayes’ rule would not change if there be any dependence between our estimates of s and c.