Docsity

Hypothesis Testing - Essay - Mathematics, Essays (high school) of Mathematics

Toggle sidebar
bg1
Paninski, Intro. Math. Stats., December 6, 2005 80
Part IV
Hypothesis testing
Do not put your faith in what statistics say until you have carefully considered
what they do not say.
William W. Watt
A caricature of one recipe might read: Apply a significance test to each
result, believe the result implicitly if the conventional level of significance is
reached, believe the null hypothesis otherwise. Such a complete flight from
reality and its uncertainties is fortunately rare, but periodically considering
its extremism may help us keep our balance.
F. Mosteller & J. W. Tukey, 1977, p 25.
...no one believes an hypothesis except its originator but everyone believes
an experiment except the experimenter.
W. I. B. Beveridge, 1950, p 65.
pf3
pf4
pf5
pf8
pf9
pfa

Partial preview of the text

Download Hypothesis Testing - Essay - Mathematics and more Essays (high school) Mathematics in PDF only on Docsity!

Part IV

Hypothesis testing

Do not put your faith in what statistics say until you have carefully considered what they do not say. William W. Watt

A caricature of one recipe might read: Apply a significance test to each result, believe the result implicitly if the conventional level of significance is reached, believe the null hypothesis otherwise. Such a complete flight from reality and its uncertainties is fortunately rare, but periodically considering its extremism may help us keep our balance. F. Mosteller & J. W. Tukey, 1977, p 25.

...no one believes an hypothesis except its originator but everyone believes an experiment except the experimenter. W. I. B. Beveridge, 1950, p 65.

Simple hypotheses^29

The simplest version of the hypothesis testing problem is as follows: we have two possible models, p 0 (D) and p 1 (D), and based on the observed data have to make a choice between them. (This is called, appropriately enough, a “simple” hypothesis test; later we’ll consider testing between more than just two hypotheses at a time.) The example to keep in mind: we draw samples x (^) i i.i.d. from a Gaussian distribution. We know the Gaussian’s variance is 1 and we know that the mean is either −1 or 1. I.e., we may take

p 0 (D) =

∏^ N

i=

2 π

e−(x^ i^ +1)^

(^2) / 2

and

p 1 (D) =

∏^ N

i=

2 π

e−(x^ i^ −1)^ (^2) / 2 .

How do we distinguish between these two hypotheses (models of the world)? Well, given that we’ve just spent a month or so talking about likelihood- based methods, one obvious approach would be to use maximum likelihood. That is, choose the hypothesis under which the likelihood of the observed data is largest. In other words, we look at the likelihood ratio

p 0 (D) p 1 (D)

= exp

∑^ N

i=

(x (^) i − 1)^2 − (x (^) i + 1)^2

= exp

∑^ N

i=

x (^) i

if this ratio is larger than 1, then p 0 (D) > p 1 (D) and we decide that the true mean was −1, or otherwise choose 1. This is a straightforward and intuitive thing to do, and we’ll see in just a moment that in many cases this approach is in fact optimal. But first let’s look a little more closely at our decision rule here. If we simplify the above likelihood ratio, we see that our decision really comes down to: if

i x^ i^ >^ 0, choose 1, and otherwise choose^ −1.^ (Of course in theory

i x^ i^ could equal zero, in which case we could just flip a coin; but this exact-tie case happens with probability zero here, so we’ll ignore it for now.) If we recall,

x (^) i was a minimal sufficient statistic for the Gaussian (^29) HMC 8.1.

Thus we see that if the cost of errors is symmetric C(− 1 , 1) = C(1, −1), and each hypothesis as equally probable a priori, p(−1) = p(1), then our decision rule is exactly the ML rule described above. So our intuitive ML approach is actually a special case of the decision-theoretic optimal rule. More generally, the optimum rule says that if our prior belief is that −1 is more likely than 1, then it makes sense to “lean” towards −1 in the sense that we will choose −1 even if the likelihood ratio is slightly weighted towards 1. Exercise 107: Repeat the last two homework problems (the exponential and Gaussian ML hypothesis tests) in this more general decision-theoretic context. What is the decision-theoretically optimal test if the costs of a mis- take are C(1, 2) = a and C(2, 1) = b, as a function of the prior distribution? (Assume again that C(i, i) = 0.)

Null and alternate hypotheses

Figure 13: Neyman and Pearson.

In the above discussion we treated both hypotheses equally. In some situations, though, it makes more sense to distinguish between the two hy- potheses. For example, if we are testing the fairness of a coin, it might be reasonable to think of the hypothesis that the coin is fair as the “null” hy- pothesis p 0 (D), and the hypothesis that the coin is biased (towards heads, say) as the “alternate” hypothesis, p 1 (D). Some specialized terminology has developed in this case:

  • the “critical region” A of a test is the region of data space such that if the data D falls in A, we “reject” the null hypothesis; that is, we choose the alternate hypothesis instead.
  • the probability α =

D∈A p^0 (D) of incorrectly rejecting the null is called the “size,” or “significance level”; this kind of error is called a “type I” error.

  • a “type II” error is when we incorrectly accept the null hypothesis.
  • the probability

D∈A p^1 (D) of correctly rejecting the null is called the “power.”

Exercise 108: What is the most powerful test between two exponential distributions with mean 1 and 2, at some fixed size α? What is the power of this test as a function of the number of samples N? Exercise 109: What is the most powerful test between two uniform distributions, U ([0, 1]) and U ([0, 2]), at some fixed size α? What is the power of this test as a function of the number of samples N? A side note: it is possible to use many of the same tricks we developed earlier to describe the asymptotic power as N becomes large. We won’t go into the details, but if we look at the log-likelihood ratio

∑^ N

i=

log

p 0 (x (^) i ) p 1 (x (^) i )

it’s clear that we may apply the LLN, CLT, etc. to elucidate the asymptotic behavior here; again we find that the Kullback-Leibler divergence plays a key role in determining the asymptotic behavior of the error (the main difference here is that the hypothesis testing error goes to zero exponentially in N , while we saw in the last section that the estimation error, at least in the mean- square setting, goes to zero like 1/N ). We leave the details to the interested reader.

Compound alternate hypotheses^30

More generally, we’re interested in compound hypothesis tests: were the data generated by a model θ ∈ H 0 or θ ∈ H (^) A , where H 0 and H (^) A are two disjoint sets of models, the null and alternate sets respectively. We’ll start with the simplest case: the null hypothesis is simple (that is, H 0 consists of just one model, p 0 (D)), but the alternate is compound. In this case it’s reasonable to ask if there is a test with a given size which maximizes the power over every single alternate hypothesis p 1 (D) ∈ H (^) A. (Remember, the size of a test only depends on p 0 , so the size will be the same for all p (^1) here.) Such a test is called a “uniformly most powerful test,” or UMP test for short. From the Neyman-Pearson theory, we already know that a UMP test has to be based on likelihood ratio tests. This makes it clear that UMP tests often simply don’t exist: Exercise 110: Prove that no UMP test exists when we are drawing data from a Gaussian of variance 1, if the null hypothesis is μ = 0 and the alternate hypothesis is μ %= 0. (Hint: break the alternate hypothesis into two sets, μ > 0 and μ < 0, and look at the likelihood ratio tests for each of these individual alternate hypotheses. If these tests are not the same, then argue that no UMP test can exist.) Is there a simple way to guarantee that a UMP test exists? Well, by the same logic we used above, it’s enough to establish that the LR test is independent of θ ∈ H (^) A. Here’s an example: look at our old friend the exponential family in canonical form. Let’s write down the loglikelihood ratio given i.i.d. observations:

log

p 0 (D) p (^) θ∈HA (D)

= log

exp[θ (^0)

i k(x^ i^ ) +^

i s(x^ i^ ) +^ N g(θ^0 )] exp[θ

i k(x^ i^ ) +^

i s(x^ i^ ) +^ N g(θ)] = [θ 0 − θ]

i

k(x (^) i ) + N [g(θ 0 ) − g(θ)].

It’s not too hard to see that a test of the form T (D) =

k(x (^) i ) > c, for some constant c, leads to a UMP test of the hypothesis that θ 0 > θ here. Exercise 111: Complete this argument. How do we choose the test when no UMP test exists? Well, this puts us back in the situation we’ve encountered before, when e.g. no uniformly

(^30) HMC 8.2.

Compound null and alternate hypotheses

In this last section we talk about the general case: both null and alternate hypotheses are compound. To find a test of size α here, we would look for some critical region A such that ∫

A

p (^) θ = α ∀ θ ∈ H 0.

Sometimes this isn’t even possible, and we have to relax our standards and look for tests such that (^) ∫

A

p (^) θ ≤ α ∀ θ ∈ H 0.

Sometimes it is possible to find a test whose size is the same for all θ ∈ H 0 , though: for example, if we can find a test statistic T whose distribution is the same for all θ ∈ H 0 , then clearly a test constructed on this statistic will have size independent of θ ∈ H 0 as well. Here’s an example: Gaussian data of unknown variance; we want to test the null μ = 0 versus the alternate μ > 0. Thus H 0 is the set of all Gaussians with mean 0, and H (^) A is the set of all Gaussians with mean greater than zero. Before we used the sample mean as our test statistic, but this won’t work here because its distribution clearly depends on the variance (and therefore the size of any test based on the sample mean will depend on the underlying unknown true variance). But we know that the sample mean and sample variance are sufficient for this family; why don’t we look at the standardized sample mean,

T (D) =

x¯ ¯σ

with

x¯ =

N

∑^ N

i=

x (^) i

and

σ¯ 2 =

N

∑^ N

i=

(x (^) i − x¯)^2.

It’s not hard to show that the distribution of ¯x/¯σ is independent of the variance under the null μ = 0 (Exercise 112: prove this); this statistic (or rather, the normalized statistic

N − 1¯x/¯σ) is called a “t-statistic,” and its

distribution was originally derived by a statistician working for the Guinness brewery who disguised his identity when publishing his work (to avoid getting in trouble for revealing trade secrets) under the pseudonym “Student.” Thus the t-statistic is also called “Student’s t,” and the commonsense process of dividing by the sample standard deviation is known as “studentizing.” Exercise 113: Derive the distribution of Student’s t.

Figure 14: Gosset (aka “Student”).

Another example: Gaussian again, but with unknown mean and we’d like to test σ 2 = 1 versus σ 2 > 1. Clearly the sample variance is independent of the mean, so we can use this as our test statistic; the null distribution of N σ¯ 2 is a chi-square with N − 1 degrees of freedom, and thus we can use a test of the form ¯σ 2 > c, for some c chosen such that the size of the test is α. Exercise 114: Prove that N σ¯ 2 is a chi-square with N − 1 degrees of freedom. (Hint: start by proving that the sample variance ¯σ 2 and the sample mean ¯x are independent if x (^) i are i.i.d. Gaussian.) Outside of the Gaussian family it is a little harder (though not impossible) to find test statistics which are independent of θ ∈ H 0 ; nonetheless, again, we may use our large-sample theory to take advantage of this nice property of the Gaussian distribution. More generally we can always turn back to our Bayesian methods: a Bayesian would choose a hypothesis according to its posterior probability