0:02

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.

Â 12:53

So, take for example, here, the probability of having disease given a

Â positive test result, we use Bayes' rule and you see the Bayes' formula on the

Â right. And the probability of not having disease

Â given the positive test result. And then, we see Bayes' rule on the right

Â for that setting. If you take these two equations and divide

Â them, you get the following very, very nifty formula.

Â The probability of diseases given a positive test result, divided by the

Â probability of not having disease, given a positive test result is equal to the

Â diagnostic likelihood ratio times the probability of disease divided by the

Â probability of disease compliment. So, just to simplify this formula a little

Â bit, we need to talk about odds. So, odds has a formal mathematical

Â definition. If you say the odds of something is two to

Â one, that's ratio of two, right, two divided by one, that has an implied

Â probability of two-thirds that the event occurs and then one-third that the event

Â does not occur. So, the way you go from probabilities to

Â odds, is you take the probability and divide it by one minus the probability.

Â So, in this case, take two-thirds and divide it by one-third, you get two, you

Â get the odds. To go from odds back to a probability, you

Â take the odds and then divide by one plus the odds.

Â In this case, we had two, take two divide it by two plus one or three, you get the

Â probability, two-thirds and, and then one minus the probability is one-third.

Â So, if someone were to say, the odds were three to one, then that means the

Â probability is one-fourth, and the probability of the event not occurring is

Â one-fourth If the odds are four to one, that means the probability that the event

Â occurs is four-fifths, and the event that it doesn't occur is one-fifth, okay?

Â So, hopefully you get the picture. Work out some examples on pen and paper.

Â Just to let you know if you., if you go to horse racing in the US, it's always the

Â case that they give you the odds against something happening instead of the odds

Â for it. So, they're defining odds in terms of the

Â odds against rather then the odds for. So, at any rate that's just a small thing

Â if you happen to go gambling this weekend. Okay, so, and this formula has a very

Â specific form then. The post-test odds of disease, probability

Â of D given positive test result divided by the probability of D complement given a

Â positive test results, the post-test odds of D is equal to the diagnostic likelihood

Â ratio times P(D) divided by P(D) compliment which is the pretest odds of

Â disease. So, we have some incline of whether or not

Â a person has the disease just based on prior knowledge before we administer the

Â test. We obtain the test, and that yields data.

Â Well, the DLR plus, because it's a positive test, is the factor by which we

Â multiply our pretest odds to obtain our post-test odds.

Â So, in the discussion I was talking about earlier, whether the person is an

Â intravenous drug user and has sex with an HIV positive partner is irrelevant to the

Â DLR, right? The DLR says, for example, that your odds

Â of disease has increased by x amount by virtue of having a positive test,

Â regardless of your prevalence, right? Whereas, the positive and negative

Â predictive value inherently factor in the prevalence, okay?

Â So, that's the reason why you get drastically different numbers for these

Â things. Because they are interpreted in different

Â ways. So, I also want to talk a little bit about

Â this idea of Bayesian philosophy and, and regardless of whether you are Bayesian

Â statistician, Bayesian philosophy is quite appealing.

Â And this formula that the post-test odd is equal to the likelihood ratio which is

Â the. Probability model and the data combined

Â times the pretest odds, it's a very appealing sort of mirror to how we think

Â the scientific process should work. You start out with an, a priority kind of

Â waiting of a set of hypotheses. In this case, it's sort of a hypothesis

Â and its compliment, and you collect data. And that data informs your belief.

Â And then now, you have a post-test odds of disease.

Â And then, suppose you were to actually run another test, well, the likely starting

Â point for your new prior would be the post test odds, or the posterior after your

Â first test. And it turns out it all works out just

Â fine that if you take two tests, and they're both positive, your diagnostic

Â likelihood ratios just multiply. But in terms of Bayesian think, it's the

Â idea that you have a prior. You update it with data, you get a

Â posterior. Now, that posterior is your prior.

Â It also codifies a lot of, of scientific discussion if your prior is absolutely

Â fixed at a specific point, then the date is irrelevant.

Â Nothing is going to move you off of it. There's lot of politics is that way of

Â course. So I think you think about political

Â discussions in terms of Bayes' rule it's really not very surprising at all.

Â So, at any rate, let's just go through our HIV example in more detail.

Â So, suppose someone has a positive HIV test, the DLR plus is 0.997 divided by one

Â minus 0.985 which works out to be about 66.

Â So, that means that regardless of your prior behavior in the population you are

Â coming from, the virtue of this test is that now you have 66 times the pretest

Â odds of having the disease. Or, you could say, or equivalently, the

Â hypothesis of disease is 66 times more likely supported by the data, than the

Â hypothesis of no disease. And then, let's just go through another

Â example. Suppose that the subject has a negative

Â testresult. Then, the DLR minus is one minus

Â 0.997divided by 0.985, which works out to be about 0.003.

Â So, the DLR minus is telling you about your odds of disease, and the result of a

Â negative test result. So, your factor that you're multiplying by

Â is 0.003. So now, your post-test odds is 0.3 percent

Â of your pretest odds, given the negative test.

Â I wanted to conclude with a discussion on kind of a, a very deep point associated

Â with these calculations. These calculations are done and there

Â tends to be very little discussion of how much sense they actually make.

Â So, if you are, in fact, a Bayesian, then none of this has any problem whatsoever.

Â Assigning a probability to the Event that an individual has a disease offers no

Â complications in Bayesian thinking. A probability to a Bayesian is not as much

Â of an objective thing. It's a quantification of belief.

Â So, you have your prior belief, you have the component that is independent of your

Â prior, in, in the diagnostic likelihood ratio, and then you have your posterior

Â belief. In that, if you're consistent with respect

Â to Bayes' rule, then your posterior belief has been multiplied appropriately by the

Â diagnostic likelihood ratio, vis-a-vis the data.

Â And then you wind up with a very consistent picture.

Â If you're frequent is, then it's, it's a little bit harder to think about these

Â things because the standard frequent is sort of boiler play line is that the

Â person either has the disease or they don't.

Â There is no probability associated with it and if you are not being a Bayesian in

Â that probability, its not a mathematical qualification of a belief, then it takes

Â on a different character. You can still interpret the calculations

Â though, I would contend may be some hardcore Bayesian would still find issue

Â with how I am proposing to interpret it as a frequentest, but still, I would say you

Â are not talking about the probability that this specific subject has the disease in

Â the frequentest sense because they either have the disease or they don't.

Â There's no probability left. But what you're talking about, is this

Â idea of potential fictitious repetitions of this experiment.

Â And using the probability as a contextual entity to evaluate this person's

Â probability of disease as contextual entity to evaluate this person's

Â probability of disease as context, it's probability of lots of people exactly like

Â this person took this test, what would be the long run percentage of positive test

Â results that we got? That sort of thinking is what I'm

Â proposing was the way you could shoe horn these calculations into frequentest

Â thought. And I think it's probably fine.

Â Either way, turn through the mathematics in the same exact manner but the

Â interpretation is quite dicey, and I think it's probably fair to say that most

Â statistics texts kind of gloss over some of these finer details because, you know,

Â admittedly they're quite difficult to think about.

Â The other thing I wanted to briefly touch on is the nature of actually collecting

Â data to inform these calculations and I touched on this a little bit before but

Â it's very difficult to know. Conclusively, whether or not someone has a

Â disease when you are developing a test usually.

Â And it's very difficult to develop things like actual real prevalence estimates that

Â are relevant to the person that you are talking about with respect to the disease.

Â It's also very difficult to have whatever samples you're using to develop

Â sensitivity and specificity be indicative of the population of samples that the test

Â will be applied to in actual clinical practice.

Â So, in the process of saying this, even, even though these calculations are very

Â simple and they actually highlight Bayes' rule quite nicely, actually, that, that's

Â the primary point of the lecture, is that they highlight Bayes' rule, and we've

Â turned through some Bayes' rules calculations.

Â But I don't want to give you the sense that, that this is all there is to the

Â world of diagnostic testing and validation, which is a very, very deep

Â subject, and, and quite a fun subject, I might add, but involves quite a bit more

Â than Bayes' rule. So, thanks for attending the lecture.

Â We'll see you next time.

Â