Okay, welcome back troops. This is Mathematical Biostatistics Boot

Camp Lecture five. And we're going to start talking about

Bayes' Rule. Bayes' rule is one of the most famous

results in Statistics. It comes from a, I believe Presbyterian

minister, named Thomas Bayes, who wrote down the rule, I believe it was published

posthumously, much later and it's a astoundingly simple rule that has

incredible power to it. And the idea is basically how can you

relate conditional probabilities of the form A given B to probabilities of the

form B given A? So, you reverse the arguments.

It's very important, right? It's saying how can I talk about A given

that B has occurred when I only know things about the distribution of B given

that A has occurred. It's a very important thing and, of

course, you can't do that without a little bit extra information.

And we'll talk about it specifically where that extra information comes from.

I, I wanted to give the, the, the mathematical, the probability density and

mass function version of it first, and then we'll talk about the kind of

classical treatment with, with events. But let's let f(x) given y be a

conditional density or mass function for X, given that Y has occurred and has taken

to value y. And f(y) being the marginal density for y.

Then if y is continuous then Bayes' rule basically says that f(y) given X is f(x)

given Y times f(y) divided by f(x) given t times f (t) dt.

And notice that what we needed to know to do this calculation of f(y) given X, is

f(x) given Y, and then this extra argument f(y) by itself.

And so the idea of Bayes' rule is sort of flipping the arguments.

And then if y is discreted, f(y) given X is f(x) given Y times f(y) divided by the

sum over t of f(x) given t times f(t). Bayes' rule again, relates f(y) given X to

f(x) given Y and then, the marginal density f(y).

And if we apply this to events, it takes a kind of familiar form that you may have

run into before. So, a special case of this relationship

basically works out to be, probability of B given A, is the probability of A given B

times the probability of B divided by probability of A given B times the

probability of B plus the probability of A given B compliment times the B compliment.

And you could do this exactly from our previous formula, let x be the discreet

random variable that's the indicator whether' A has occurred y be an indicator

that the event B has occurred then plug in to the discreet version of Bayes' rule,

that would be a simple proof if you are willing to stipulate the previous page,

you can also prove it very easily just by working with the rules of probability in

sets. So, this numerator is probability A

intersect B, this denominator is probability A intersect B plus from the

probability of A intersect B complement. So, the numerator works out to be

probability of A intersect B and the denominator works out to be probability of

A, so that's exactly the conditional probability B given A.

So, it's quite easy to prove, but I just want it by discussing this indicative that

there's no real distinction between the way we're discussing it in terms of

continuous densities or discrete joint mass functions and this kind of

traditional method of treatment using probabilities and events.

So, that's a very brief treatment of how you can use Bayes' rule with densities and

with mass functions. We'll go through several examples next

time, but one of the most common and biggest examples that we're going to talk

about is associated with diagnostic testing, and that's what we'll do next.

Okay, welcome back troops. This is Lecture Five., Mathematical

Biostatistics Boot Camp. And now, we're going to be talking about

diagnostic tests. So, particular application of Bayes' rule,

it's used in so-called diagnostic testing. And we'll talk a little bit about the kind

of traditional treatment of this, but we'll also delve a little bit into the,

the intricacies of these calculations. They're a little bit more complex than

people usually give them credit for. But the simple treatment is as follows.

So, let's let plus and minus be the events that the diagnostic test is either

positive or negative, respectively. So, plus being positive, of course, and

minus being negative. And then, let's let D and D complement be

the event that a subject of the test does or does not have the disease,

respectively. We can make a definition that sensitivity

of the test is the probability that the test is positive given that the subject

actually has the disease probability of plus given D, that's the sensitivity.

The specificity is the probability that the test is negative given as the subject

is not have a disease, that is the probability of a minus given D complement.

So, let's give a couple more definitions. So, the positive predictive values is

often what a subject would want to know. That is the probability that a person has

the disease given a positive test result. And the negative predictive value is

another thing that people would very much so like to know, in the result of a

negative test, is the probability that they do not have the disease given that

the test is actually negative. And then, we might declare the prevalence

of the disease to be just the marginal probability of disease.

Okay, last set of definitions. The diagnostic likelihood ratio of a

positive test and let's call it DLR plus, is the probability of the test being

positive given that the person has the disease, divided by the probability the

test is positive given that the person does not have the disease, which is

exactly sensitivity divided by one minus specificity.

The diagnostic likelihood ratio of a negative tests labelled DLR minus, you can

read the formula there, the probability of negative test given the disease divided by

the probability of negative test, given disease complement which is one minus the

sensitivity divided by the specificity. Okay, we will go through, in detail, why

all these things are useful through a specific example.

And then, we will come back and, and talk a little about, maybe why these

calculations are little bit more subtle than people often discuss.

Okay, so, study comparing the efficacy of HIV test reports, on experiment which

concluded that the, the antibody test have a sensitivity of about 99.7 and a

specificity of about 98.5. And I got these numbers from a website but

am fudging them a little bit because it's kind of more important to just perform the

calculations than to talk about specific tests and to evaluate them.

So, imagine these numbers are accurate with respect to a specific test.

And by the way, y base rule is kind of convenient in these sorts of settings.

It's in principle, a little bit easier to get these numbers, sensitivity and

specificity by virtue of the fact that you would just take blood samples for a set of

people that you know are HIV positive and see what's the proportion of them that was

the test comes up positive. And take a group of people that you know

to be HIV negative and see the proportion that have a negative test result.

And you could get these numbers or get estimates of these numbers and, of course,

that's a very simplistic treatment of how you actually would get a sensitivity and

specificity, is there's lot's of issues, like how do you actually know if you're

working in an area where the tests are difficult.

How do you actually know whether a person has the disease or not, is in question, or

if you wait so long to where they're, the disease is very clinically relevant, then

are you evaluating the test in a stage of the disease where it's not interesting for

when you would be applying the disease? There's a lot of issues in development of

test and evaluation of test and constructing the validity that we are

going to completely gloss over in this discussion.

So, for our discussion, let's just assume these numbers are right, that they work

well. And then also, let's assume that there's a

0.1 percent prevalence of HIV in the population.

And a subject receives a positive test result.

Well, what is the probability that this subject has HIV?

Well, mathematically, what we want is probability of disease given a positive

test result, given the sensitivity, the probability of a positive test result,

given disease, which 0.997. This specificity probability of a negative

test result, given disease compliment, 0.985 and the prevalence probability of D,

0.001. So, using Bayes' formula, we can just

plugin, we get 0.997 times 0.001 divided by 0.997 times 0.001 plus 0.015 times

0.999. This works out to be about six%.

So, it works out that a positive test result only suggest to six percent

probability that the subject has the disease.

Or in other words, the positive predictive value is six % for this test.

Now you might wonder that seems awfully low.

Why is this the case that, you know, if I take a collection of blood samples that

are known to be positive and then I apply the test, it's 99 percent that are

accurately labeled as positive, how is this so low?

And if I take a bunch of blood samples that I know to be negative, and I apply

the test, I get a very high percentage of negative test how is this so low?

Well, it's basically, the low positive predictive value is due to the low

prevalence of disease in the somewhat modest specificity.

It's not so bad. And in this case, this is what Bayes' rule

actually does for us. You start out with prior information,

basically, you know, a very low probability of thinking that this person

has the disease, then you update it with the information of the positive test

result. And that gets codified by updating it with

sensitivity and the specificity associated with the test.

And that informs the positive predictive value.

And you get something that's much higher than the prior probability of disease, the

prevalence. But still isn't terribly high because you

started with such a low prior. And that's how Bayes' rule works.

So, for example, you know, here, the prevalence we're talking about is some,

say, national prevalence in the U S. But imagine, if you knew that the subject

was an intravenous drug user and routinely had intercourse with an H I V infected

partner. Well, your prior that this person has HIV,

would be much, much higher than the low prevalence that we cited here.

I don't know what the prevalence is among a population like this, but suffice to say

that it's much higher. And then, your positive predictive value

would be similarly higher, which is kind of interesting discussion.

Imagine, if you were clinician of some sort and you were working with a patient

and you saw their positive test result and you'd say, yeah, you know, its a positive

test result, but maybe we should run another test or do some other things to

evaluate your condition. You know, that the positive predictive

value associated with this test is only six%.

Well then, in the same interview, well, it came out that the person was an

intravenous drug user and routinely had intercourse with an HIV infected partner.

Well, then the clinician would say, oh, well the test is very conclusive, we need

to start you on anti-retrovirals or something like that.

So, from the patients perspective, that might seem a little odd, that this

external information is what kind of changed the conclusion, the test value

didn't change, just in the discussion with the clinician, only the, their prevalence

changed. And only the prevalence in the calculation

changed. So, from the patient's perspective, this

might seem a little weird. But again the mathematics are exactly

accurate. So, there's a question as to what is the

component of the calculation that does not change regardless of the prevalence?

And that's ultimately what the diagnostic likelihood ratios are giving you.