Suppose we're looking at a two-candidate mayoral race in Providence. Candidate A is declared winner with 55 percent of the vote (p(hat) = 0.55). However, candidate B is suspicious of these results. Having his group of close friends take a random sample of 17 voters from Providence, he finds that 7 voted for candidate A while 10 voted for him.

On the basis of this study performed at the alpha = 0.05 level of significance, should candidate B demand a recount?

Formulate the null and alternative hypothesis and perform the test in order to respond to this question.

For hypothesis testing, I only know how to solve these problems if we have 4 parameters: Xn the sample mean, u the population mean, sd the standard deviation and n the sample size. But here I don't have the sample mean nor the standard deviation. What is the formula used to find the normal distribution t given a 95% confidence interval when doing hypothesis testing when n is not large? Since we don't have the sample mean nor the standard deviation, what is the process of hypothesis testing here?

H0: u = 0.55

H1: u < 0.55 since p = 7/14 = 0.41

z = p(hat) - p / sqrt(p(1-p)/n) = 0.55 - 0.41 / sqrt(0.41(1-0.41)/17) = 1.17

p(z < 1.17) = 0.879 p(z > 1.17) = 1 - 0.879 = 0.123

Since 0.123 > 0.05, we don't reject the null hypothesis and candidate B shouldn't demand a recount.

Is this correct?


What you're referring to — needing to know the sample mean and standard deviation in order to perform hypothesis testing — is only appropriate for a quantitative random variable, i.e. one that has numerical values (e.g., average height of a group of people). But this is an entirely different context of a categorical random variable. There's no sense of talking about sample means here because our sample doesn't consist of numbers. Our sample consists of people's responses to the voting question: some people responded "A" and some people responded "B". What we're interested in here is estimating the proportion of people who gave a certain response. And you have all the data that you need to perform hypothesis testing in this example for the population proportion in a sample.

Quick online search gives a lot of links on the subject. For example, the following seem to be nicely written (but of course, there are hundreds more resources out there):

  • This one or this one explain the difference between categorical and quantitative random variables;

  • And here you can find a step-by-step explanation with an example of hypothesis testing for population proportions.


The question might be more suitable for stats.stackexchange.com, but I'll write an answer anyway.

Note that the core question of hypothesis testing is: what is the probability of finding this, or an even more extreme, result when the Null hypothesis is true.

First Question: what is the Null hypothesis?

Answer (spoiler alert): that 55% of the population in the state is in favour of candidate A.

Second question: you are talking about probability so where is the randomness? What process in this story can be modeled as 'drawing from some probability distribution'? This is the crucial question you should always be asking yourself.

(Think about it for a bit...)



Ok the answer is: selecting these 17 random people. This is the only place where something random happens.

So what we see here is: we randomly select 17 people and each time you randomly pick someone you have, independently of what you saw before, 55% chance of this person having voted for candidate A. (Assuming that the Null hypothesis is true)

Third question: what was it that we wanted to calculated again? Answer: the probability of finding at least 10 B-voters among the 17 randomly selected voters

So the question you want to answer is equivalent to:

You have a crooked coin that lands heads 55% of the time. You throw it 17 times, what is the probability of it landing on tails at least 10 times.


You have an urn with 55 red balls and 45 blue balls. 17 times you blindly pick a ball, look at its color and throw it back. What is the probability of finding at least 10 blue balls.

These are the type of question one usually encounters in school way before learning about normal distributions or hypothesis testing at all. Thus I am confident that you can solve it.

(Side note: I side-stepped the question of confidence intervals, jumping directly to the $p$-value. We can talk about confidence intervals if you like, but it is slightly more complicated. Also the 7/17 is the sample mean. Imaging giving every voter a value of 1 if they voted for A and 0 if they voted for B. We want to test the hypothesis that the population mean is 0.55 given the sample mean of $0.41$ and the fact that these are independent Bernouili trials)


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.