Take the 2-minute tour ×
Cross Validated is a question and answer site for people interested in statistics, machine learning, data analysis, data mining, and data visualization. It's 100% free, no registration required.

A coin is tossed 900 times and heads appeared 490 times. Does the result support the hypothesis that the coin is unbiased?

share|improve this question
3  
Hi Sanu and welcome to the site. This is a very straightforward question and looks a little like homework - if it is, could you add the homework tag so people will know how to approach giving you advice? Also, it is probably worthwhile setting out what your thinking has been so far, what you have tried, and what you are having difficulty with. –  Peter Ellis Jan 23 '12 at 23:14
1  
Null hypothesis: coin is unbiased. Alternative, hard to know, possibly the symmetrical probability of a head is $\ne 1/2$. Level of significance: You decide. If null hypothesis holds, then number of heads has nearly normal distribution, standard deviation $\sqrt{(900)(1/2)(1/2)}=15$. Now $490$ is about $2.66$ standard deviation units from the mean ($450$) if null hypothesis holds. From tables of standard normal or otherwise, this has probability about $0.0078$. So at the $1$% significance level, we reject the null hypothesis. –  André Nicolas Jan 23 '12 at 23:29
    
You might want to have a look at Hypothese Testing –  Charles Morisset Jan 24 '12 at 0:10
7  
For future reference: Crossposting verbatim copies of your question to multiple SE sites is strongly discouraged. This happens commonly with new users that aren't familiar with this policy, so don't feel bad. Just, please, keep it in mind. Welcome to the site. –  cardinal Jan 24 '12 at 3:27
    
This question, which may be exactly what OP Sanu's homework problem states or may be Sanu's paraphrase of the question actually asked, says "Does the result support the hypothesis that the coin is unbiased?" All the answers take the null hypothesis to be $P(\text{Heads}) = 0.5$. My question is: do observations ever support the null hypothesis? Even if the coin came down heads $450$ times out of $900$, that is not support for the null hypothesis; only very weak evidence supporting rejecting the null. Evidence is always in favor of rejection of the null, never in support of the null. –  Dilip Sarwate Jan 25 '12 at 1:29

7 Answers 7

If the coin is unbiased then the probability of 'heads' is $\frac{1}{2}$. Therefore, the number of heads thrown in 900 tries, $X$, has a ${\rm Binomial}(900,\frac{1}{2})$ distribution under the null hypothesis of a fair coin. So, the $p$-value - the probability of seeing a result this extreme or more extreme given that the coin is far, is

$$ P( X \geq 490 ) $$

If you seek the 2-sided $p$-value, that would be

$$ 1 - P(410 < X < 490 ) $$

I'll leave it to you to describe why that is the case.

We know that the mass function for $ Y \sim {\rm Binomial}(n,p)$, is

$$ P(Y = y) = \binom{n}{y} p^y (1-p)^{n-y} $$

I'll leave it to you to calculate $p$-value you seek.

Note: The sample size here is sufficiently large that you could use the normal approximation to the binomial distribution. I've detailed above how to calculate the exact $p$-value.

share|improve this answer
    
Should the $p$-value be calculated for a two-sided test or a one-sided test? –  Dilip Sarwate Jan 23 '12 at 23:57
1  
I'd imagine two-sided, since the question only sought to determine whether or not the coin was unbiased. That is, it appears that $H_{a}: p \neq 1/2$. But, it's unclear whether what is written above is the verbatim question or a paraphrase. –  Macro Jan 23 '12 at 23:59
1  
So in this case, and possibly many others, the symmetry implies that the two-sided $p$-value is exactly twice the one-sided $p$-value. The one-sided $p$-value is smaller than $0.005$ while the two-sided $p$-value is larger. So the null should be rejected at the $0.5\%$ level (I know, not the more commonly used $5\%$ and $1\%$ levels) if we are using a one-sided test and not rejected if we are using a two-sided test. Is this correct? –  Dilip Sarwate Jan 24 '12 at 2:43
1  
Yes, if you were doing the test with level $\alpha=.005$, then you would reject the one-sided test and not the two-sided test. Whether or not one does a 1-sided or 2-sided test should be chosen a priori, based on the research question, though, so this problem shouldn't arise in practice. –  Macro Jan 24 '12 at 3:14
    
"Whether or not one does a 1-sided or 2-sided test should be chosen a priori" is valid, but what if the choice has not been made? Should OP Sanu be told that the experimental data support the hypothesis that the coin is unbiased at the $0.5\%$ level (null is not rejected by two-sided test) but also support the hypothesis that $P(\text{Heads}) > \frac{1}{2}$ at the $0.5\%$ level (null is rejected by one-sided test) ? –  Dilip Sarwate Jan 24 '12 at 13:21

Here the natural null-hypothesis $H_0$ is that the coin is unbiased, that is, that the probability $p$ of a head is equal to $1/2$. The most reasonable alternate hypothesis $H_1$ is that $p\ne 1/2$, though one could make a case for the one-sided alternate hypothesis $p>1/2$.

We need to choose the significance level of the test. That's up to you. Two traditional numbers are $5$% and $1$%.

Suppose that the null hypothesis holds. Then the number of heads has *binomial distribution with mean $(900)(1/2)=450$, and standard deviation $\sqrt{(900)(1/2)(1/2)}=15$.

The probability that in tossing a fair coin the number of heads differs from $450$ by $40$ or more (in either direction) is, by symmetry, $$2\sum_{k=490}^{900} \binom{900}{k}\left(\frac{1}{2}\right)^{900}.$$ This is not practical to compute by hand, but Wolfram Alpha gives an answer of roughly $0.008419$.

Thus, if the coin was unbiased, then a number of heads that differs from $450$ by $40$ or more would be pretty unlikely. It would have probability less than $1$%. so at the $1$% significance level, we reject the null hypothesis.

We can also use the normal approximation to the binomial to estimate the probability that the number of heads is $\ge 490$ or $\le 410$ under the null hypothesis $p=1/2$. Our normal has mean $450$ and variance $15$ is $\ge 490$ with probability the probability that a standard normal is $\ge 40/15$. From tables for the normal, this is about $0.0039$. Double to take the left tail into account. We get about $0.0078$, fairly close to the value given by Wolfram Alpha, and under $1$\%. So if we use $1$\% as our level of significance, again we reject the null hypothesis $H_0$.

Comments: $1$. In the normal approximation to the binomial, we get a better approximation to the probability that the binomial is $\ge 490$ by calculating the probability that the normal is $\ge 489.5$. If you want to look it up, this is the continuity correction. If we use the normal approximation with continuity correction, we find that the probability of $490$ or more or $410$ or fewer heads is about $0.008468$, quite close to the "exact" answer provided by Wolfram Alpha. Thus we can find a very accurate estimate by, as in the bad old days, using tables of the standard normal and doing the arithmetic "by hand."

$2$. Suppose that we use the somewhat less natural alternate hypothesis $p>1/2$. If $p=1/2$, the probability of $490$ or more is about $0.00421$. Thus again at the $1$% significance level, we would reject the null hypothesis, indeed we would reject it even if we were using significance level $0.005$.

Setting a significance level is always necessary, for it is possible for a fair coin to yield say $550$ or more heads in $900$ tosses, just ridiculously unlikely.

share|improve this answer
2  
This question was marked as homework. In such cases, it is discouraged to give a full, self-contained answered that leaves no work to the person asking. –  Macro Jan 24 '12 at 14:13
    
This was an answer from math.SE that merged along with the question and is authored by a very high rep user on math.SE. The question was not tagged as homework over there at the time. –  cardinal Jan 24 '12 at 17:58

Your question could be addressed in a few different ways.

The traditional test of hypothesis is designed to rule out possibilities, not necessarily prove them. In this case we can use $H_0: p=0.5$ as the null hypothesis and see if the data (the 490 out of 900 heads) can be used to reject this null hypothesis by computing a p-value. If the p-value is less than $\alpha$ then we reject the null, but a p-value $>\alpha$ does not mean that we can say the data supports the null, just that it is consistant with the assumption that the null is true, but in truth the null could be false, just the truth is a value of $p$ very close to $0.5$.

The "equivalence" approach would be to define unbiased not as $p=0.5$ but rather choose a small region around 0.5 to consider as unbiased $ 0.5-\epsilon < p < 0.5+\epsilon$. Then if the confidence interval on the true proportion lies fully within the equivalence interval of "unbiased" then the data would support the hypothesis of "unbiasedness".

Another approach would be to use a Bayesian approach where we start with a prior distribution on the true proportion $p$ including a point mass at 0.5 and the rest of the probabilit spread accross possible values. Then combine that with the data to get a posterior. If the posterioun probabilit of $p=0.5$ is high enough then that would support the claim of being unbiased.

share|improve this answer
    
Note that oftentimes the Bayesian approach will result in continuous posteriors, and therefore the posterior probability of $p = 0.5$ exactly is often 0. The more interesting question is then what is how significantly our posterior estimate differs from .5. –  Michael McGowan Jan 24 '12 at 4:17
2  
@MichaelMcGowan: if one starts with a prior point mass at $p=0.5$ there will be a posterior point mass as well. Whether or not this prior makes sense depends on the problem... –  Xi'an Jan 24 '12 at 13:51

The example from the Wikipedia page on Bayes Factor seems quite relevant to the question. If we have two models, M1 where the coin is exactly unbiased (q=0.5), and M2 where the probability of a head is unknown, so we use a flat prior distribution on 1. We then compute the bayes factor

$K = \frac{p(x=490|M_0)}{p(x=490|M_1)}$

where

$p(x=490|M1) = \mathrm{nchoosek}(900,490)\frac12^{900} = 7.5896\times10^{-4}$

and

$p(x=490|M2) = \int_0^1 \mathrm{nchoosek}(900,490)q^{490}(1-q)^{410}dq = \frac{1}{901}$

Gives a Bayes factor of $K \approx 1.4624$, which according to the usual scale of interpretation is "barely worth mentioning".

Note however (i) the Bayes factor has a built in occam penalty that favours simple models, and M1 is a lot simpler as it has no nuisance parameters, where as M2 does; (ii) a flat prior on $q$ is not physically reasonable, in practice a biased coin is going to be close to fair unless the coin is obviously assymetrical; (iii) it has been a long day and I could easily have made a mistake some(any)where in the analysis from assumptions to calculations.

Note that the coin is biased if it is a physical object as its assymetry means that it won't be exactly as likely to come down heads as tails.

share|improve this answer

And an R illustration:

Not bothering to approximate by the normal, we can look at a random variable distributed binomial with n=900 and p=0.5 under the null hypothesis (i.e. if the coin were unbiased then p=probability of heads(or tails) = 0.5).

If we would like to test the alternative that Ha: p<>0.5 at alpha 0.05 we can look at the tails of the distribution under the null as follows and see that 490 falls outside the interval {421, 479} and thus we reject Ho.

n<-900
p<-0.5
qbinom(c(0.025,0.975),size=n,prob=p)
# 421 479
share|improve this answer

To clarify the Bayesian approach:

You start by knowing nothing, except that P(Heads) is in [0,1]. So start with a maximum entropy prior -> uniform(0,1). This can be represented as a beta distribution -> beta(1,1).

Each time you flip the coin do a Bayesian up-date of the coin's P(Heads) by multiplying each point in the distribution by it's likelihood (multiply by x if you roll heads, multiply by (1-x) if you get tails), and re-normalize the total probability to 1. This is what the beta distribution does, so if the first roll is heads you'll have beta(2,1). In your case you have beta(490,510).

From there I would calculate the 95% probability interval, and if 0.5 isn't in that interval, I would start to get suspicious.

The first time I went through this exercise I was really surprised at how long it took to converge... I started because someone said "if you flip a coin 100 times, you know P(Heads) to +/- 1%" this turns out to be totally wrong, you need magnitudes more than 100 flips.

share|improve this answer

Null hypothesis,Ho:P=0.5 (P=Q=0.5)

H1:P>0.5

where P is the prob of occuring head.

we know z = (p-P)/sqrt(PQ/N)

where p =490/900 =0.54

Now z=(0.54-0.5)/sqrt((0.5*0.5)/900)

z=2

hence at 5% LOS (i.e,1.64<2) Ho is rejected

hence the coin is biased.....

share|improve this answer
1  
Welcome to our site! Did you read over the other answers before replying? You might enjoy the thoughtful analyses contained in several of them. They include the same calculations, so I am wondering what part of your answer or its form of presentation represents something newer or better than what has already been posted. –  whuber May 8 at 15:52

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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