Hypothesis Testing for Binomial Distribution

We now give some examples of how to use the binomial distribution to perform one-sided and two-sided hypothesis testing.

One-sided Test

Example 1: Suppose you have a die and suspect that it is biased towards the number three, and so run an experiment in which you throw the die 10 times and count that the number three comes up 4 times. Determine whether the die is biased.

Define x = the number of times the number three occurs in 10 trials. This random variable has a binomial distribution B(10,π) where π is the population parameter corresponding to the probability of success on any trial. We use the following null and alternative hypotheses:

H0: π ≤ 1/6; i.e. the die is not biased towards the number three
H1: π > 1/6

Using a significance level of α = .05, we have

P(x ≥ 4) = 1–BINOM.DIST(3, 10, 1/6, TRUE) =  0.069728 > 0.05 = α.

and so we cannot reject the null hypothesis that the die is not biased towards the number 3 with 95% confidence.

Example 2: We suspect that a coin is biased towards heads. When we toss the coin 9 times, how many heads need to come up before we are 95% confident that the coin is biased towards heads?

If we are sure that the coin is not biased toward tails, we can use a one-tailed test with the following null and alternative hypotheses:

H0π ≤ .5
H1π > .5

For a 95% confidence level, α = .05, and so

BINOM.INV(n, p, 1–α) = BINOM.INV(9, .5, .95) = 7

which means that if 8 or more heads come up then we are 95% confident that the coin is biased towards heads, and so can reject the null hypothesis.

We confirm this conclusion by noting that P(x ≥ 8) = 1–BINOM.DIST(7, 9, .5, TRUE) =  0.01953 < 0.05 = α, while P(x ≥ 7) = 1–BINOM.DIST(6, 9, .5, TRUE) = .08984 > .05.

Example 3: Historically a factory has been able to produce a very specialized nano-technology component with 35% reliability, i.e. 35% of the components passed its quality assurance requirements. The management of the factory has now changed their manufacturing process and hopes this has improved reliability. To test this, they took a sample of 24 components produced using the new process and found that 13 components passed the quality assurance test. Does this show a significant improvement over the old process?

We use a one-tailed test with null and alternative hypotheses:

H0: p ≤ .35
H1: p > .35

p-value = 1–BINOM.DIST(12, 24, .35, TRUE) = .04225 < .05 = α

and so conclude with 95% confidence that the new process shows a significant improvement.

Two-sided Test

Example 4: Many believe that drivers of flashy-colored cars (red, yellow, pink, orange, or purple) get pulled over more often for a driving violation. It is possible, however, that drivers of these cars are pulled over no more often or even less often. To get a deeper insight into this issue, a researcher conducted a study of the 50 cars that were pulled over in one month and she found that 7 cars had a flashy color. It is also known that about 20% of the cars sold in this area have a flashy color. Determine whether flashy-colored cars are pulled over differently from any other colored car.

This time we conduct a two-tailed test with the following null and alternative hypotheses where p = the percentage of cars pulled over that were flashy (in the entire population).

H0: p = .20

H1: p ≠ .20

Once again, we use the binomial distribution, but since it is a two-tailed test, we need to consider the case where we have an extremely low number of “successes” as well as a high number of “successes”. If we use a significance level of α = .05, then we have tails of size .025. The critical value on the left is BINOM.INV(50,.2,.025) = 5, and the critical value on the right is BINOM.INV(50,.2,.975)-1 = 15. Since 7 is between these values, we cannot reject the null hypothesis and so there is no evidence that the police are pulling over drivers of flashy cars more or less often than drivers of other cars.

We can also use the one-tailed test but with α/2 as the significant level; i.e. BINOM.DIST(7,50,.2,TRUE) = .160 > .025 = α/2. Alternatively, we can calculate the p-value as for the one-tailed test and then double the result: p-value = 2*BINOM.DIST(7,50,.2,TRUE) = .381 > .05 = α, which yields the same conclusion that the null hypothesis shouldn’t be rejected.

Observations and restrictions

If of the 50 cases, 4 had been for flashy cars, then we would have rejected the null hypothesis since 4 is less than the left-side critical value. Note that BINOM.DIST(4,50,.2,TRUE) = .0185 < .025 = α/2. Similarly, we would have rejected the null hypothesis if 16 had been for flashy cars: 1-BINOM.DIST(4,50,.2,TRUE) = .0144 < .025 = α/2.

Note that there is a lack of symmetry here since .0185 ≠ .0144. There is, however, symmetry when p = .5.

If 5 had been for flashy cars, then we wouldn’t have rejected the null hypothesis since BINOM.DIST(5,50,.2,TRUE) = .048 > .025 = α/2. Similarly, we would not have rejected the null hypothesis if 15 had been for flashy cars: 1-BINOM.DIST(15,50,.2,TRUE) = .031 > .025 = α/2.

Examples Workbook

Click here to download the Excel workbook with the examples described on this webpage.

Reference

Howell, D. C. (2010) Statistical methods for psychology (7th ed.). Wadsworth, Cengage Learning.
https://labs.la.utexas.edu/gilden/files/2016/05/Statistics-Text.pdf

89 thoughts on “Hypothesis Testing for Binomial Distribution”

  1. Hi Charles, I am just here to express my gratitude for your article after having multiple problems with my assignment and I have just sorted it out thanks to you.

    Cheers,
    Urna

    Reply
  2. Charles,
    Took a bit to figure out how binom.test evaluates p-value.

    Excel notation below produces same p-value provided by binom.test(x, n, p) in R.

    A4 is an array, so need to hit ctrl+shift+enter.

    A1: p
    A2: n
    A3: p
    A4:=SUM(IF(BINOM.DIST((ROW(INDIRECT(CONCATENATE(“1:”,A3+1)))-1),$A$3,$A$1,FALSE)<=BINOM.DIST($A$2,$A$3,$A$1,FALSE),BINOM.DIST((ROW(INDIRECT(CONCATENATE("1:",A3+1)))-1),$A$3,$A$1,FALSE),0))

    Thanks,
    Mike

    Reply
  3. Great post Charles. Can I please ask a quick question? If I am looking at falls in a dementia home and they were 55% on average before an intervention but reduced to 30% after an intervention, can I use the binomial test whether the 35% is a significant improvement on 55% (although the falls being measured are of the same people?)

    Reply
  4. Dear Charles,
    I teach statistics in master’s degree course at our university (VSB-Technical University of Ostrava, Czechia). Some of my students use R Studio for calculations, others use Excel with Real Statistics. Your tools are very useful and I am very glad we can use them.
    In most of the examples we solve, R and Real Stats give the same results. Unfortunately the one-sample proportion test is one of the exceptions. There is no difference when a z-test is used. Both One-sample Proportion Test Tool and R’s function prop.test(x, n, p0) give the same results, where x is # of Successes, n is Sample size and p0 is Hyp Proportion.
    But the difference in results appears when binomial test is used and alternative hypothesis is “greater then” (p > p0). The R’s function binom.test(x, n, p0) gives the same p-value as Excel’s 1 – BINOM.DIST(x-1, n, p0, TRUE). But in One-Sample Proportion Test tool the formula 1-BINOM.DIST(x, n, p0, TRUE) is used.
    When A1 is the output range cell, then the complete formula for p-value (cell B10) is:
    =B6*IF(B12<B5, BINOM.DIST(B4, B3, B5, TRUE), 1-BINOM.DIST(B4, B3, B5, TRUE))
    To obtain a correct result in One-Sample Proportion Test tool the value x-1 must be used as # of Successes. Why? I am afraid it would be a source of misunderstandings and mistakes not only among my students.
    I think the better solution would be the modified formula:
    =B6*IF(B12<B5, BINOM.DIST(B4, B3, B5, TRUE), 1-BINOM.DIST(B4-1, B3, B5, TRUE))
    If this change were made in the next version of Real Stats, then the results in both programs (R and Real Stats) for the same input parameters would be equal. Please consider it.
    Thank you very much
    Vaclav

    Reply
    • Vaclav,
      From your comment, I understand that 1 – BINOM.DIST(x-1, n, p0, TRUE) instead of 1 – BINOM.DIST(x, n, p0, TRUE) should be used in both the one-tailed and two-tailed tests. Please confirm.
      Charles

      Reply
  5. Hi

    I have a question. A process is supposed to be done in a particular way 100% of the time. I have historical data on the process and can thus measure whether or not it was done correctly on a case by case basis. But, it is expensive to perform that measurement. My question is how many times do I have to perform the test, with randomly selected cases, in order to be confident that the process is running correctly. I assume that the first time that that I get a negative result I can stop and conclude that the process is not being done correctly.

    Thanks . . .

    Phil Troy

    Reply
    • Hi Phil,
      Can you explain what sort of process you are referring to and how you determine whether or not it was done correctly? Presumably you are using some statistic, which when negative indicates that it is not running correctly.
      Charles

      Reply
  6. Hey, these examples are gret, but could you take a look at this question:
    “A plastic bottle company suspects that 10% of all bottles coming from its production line are defective. A random sample of 20 bottles finds that 6 of these sampled bottles are defective.
    Which test based on the binomial distribution would you use to answer this question? Why?”

    I’m a bit confused as to which test we would use… I assumed we use Lower-tailed test

    Reply
  7. Hi Charles!
    Great post!

    Please help me with this question:
    Assume we randomly tested 10 individuals living in the rural area, and found that only 3 of them were positive for Zika virus infection. Use a binomial test to address this question: Is there sufficient evidence to determine whether the percent of individuals infected with Zika virus in the rural area differs from 86% or not?

    This is a two-tailed test. Can you please tell me how to do it?

    Reply
  8. Hello,

    I have a question about Example 3:

    what is the Excel formula to calculate the p-value for the following situation:
    from the 24 components, only 6 pass the test, instead of 13?

    We assume that H1 > 35% but we actually have fewer than 35%. In this case we are not able to reject H0, but what is the p-value?

    Thanks!!

    Reply
    • The same argument can be used as for Example 3, namely, calculate =1-BINOM.DIST(5, 24, 0.35, TRUE) to obtain a p-value = .896 >> .05. This shows that it is highly unlikely that the process is an improvment.
      Charles

      Reply
  9. Great post. Is it right to say that it is easier to get a sig. effect if the comparison is occuring at the tails of the distribution (i.e p = 0.9 or = p = 0.1) compared to the middle (p=0.5) – granted sample size is held constant?

    Reply
    • Hi Bob,
      I am not sure what you mean by where the comparison is occurring. By definition a significant result can only occur at the tails, but I am not sure that this is what you are asking.
      Charles

      Reply
  10. My test of expected pass rate as follows:
    1. N = 65
    2. Two outcome (failed, pass)
    3. Probability of failure 1.5779%
    4, If the actual failure is 3, can I say that I can still accept the expected failure rate of 1.577% based on confidence level of 95%

    Reply
  11. I’m having problems implementing a two-tailed test in Excel. What function do I use to estimate the number of heads or tails required to reject the null of a fair coin (95% level)? I’ve tried BINOM.INV(Tosses,0.5,0.025) compared against min(heads,tails), but if I feed this back into BINOM.DIST I get p values above 0.05.

    Reply
    • Hello Bruce,
      This is problem is similar to Example 2 on this webpage. The problem is likely to be that the last argument in your formula is 0.025 instead of a value such as .975.
      Charles

      Reply
  12. This is an assignment but I am completely lost. Any help

    CASE STUDY
    The number of credit card holders of a bank in two dierent cities (city – X and city – Y) settling their excess withdrawal amounts in time without attracting interestfollows binomial distribution. The manager (collections) of the bank feels that theproportion of the number of such credit card holders in the city – X is not dierentfrom the proportion of the number of such credit card holders in the city – Y. to testhis intuition a sample of !”” credit card holders is taken from the city – X and it isfound that #$” of them are settling their excess withdrawal amount in – timewithout attracting interest. %imilarly a sample of #&” credit card holders is takenfrom the city – Y and it is found that ‘” of them are settling their excess withdrawalamount in – time without attracting interest check the intuition of the salesmanager at a signicance leel of “.”‘.

    Reply
  13. Dear Charles,

    I’m puzzled with a statistic issue.
    I would like to compare two diagnosis test applied on the same samples and same number of samples with the following results
    Test 2 + –
    test 1
    + 64 10
    – 3 36

    I wanted to use the McNemar test but apparently it is recommended to use a binomial test (or sign test?) in that case because of the low amount of patient (b+c = 13 (<25)).
    Could you tell me if this is correct and if yes, should I do a two-tailed test?
    Also, how do I run a binomial test when the answer is yes or no and not a percentage?
    Thank you in advance for your help,

    Best

    Reply
  14. For the first and third examples, you use one less than the number of successes mentioned. For example, in the first example, a “3” was rolled 4 times, but in the excel function, you used 3 as the number of successes. Similarly, in the third example, there were 13 successes and you used 12 successes in the =1-BINOM.DIST function. What is your reasoning for doing this?

    Reply
    • Caroline,
      In the first example, you want to find out the probability that three comes up 4 of more times (i.e. 4, 5, 6, 7, 8, 9 or 10 times). The BINOM.DIST(x,n,p,TRUE) function computes the probability that an event occurs at most x times (i.e. 0, 1, 2, …, x times). The probability that three comes up 4 or more times is equal to 1 minus the probability that three comes up at most 3 times, which is P(x ≥ 4) = 1–BINOM.DIST(3, 10, 1/6, TRUE).
      Another way to look at this is that P(x>=4) + P(x<4) = 1, and so P(x>=4) = 1 – P(x<4) = 1 - P(x<=3) = 1–BINOM.DIST(3, 10, 1/6, TRUE). Charles

      Reply
  15. What’s the approach using Excel for finding the upper limit of a sample proportion with a given level of confidence (1-alpha) for a one-tailed distribution.

    Reply
  16. Try to solve this for me.

    The number of credit card holders of a bank in two different cities (city – X and city – Y) settling their excess withdrawal amounts in time without attracting interest follows binomial distribution. The manager (collections) of the bank feels that the proportion of the number of such credit card holders in the city – X is not different from the proportion of the number of such credit card holders in the city – Y. to test his intuition, a sample of 200 credit card holders is taken from the city – X and it is found that 160 of them are settling their excess withdrawal amount in – time without attracting interest. Similarly a sample of 180 credit card holders is taken from the city – Y and it is found that 50 of them are settling their excess withdrawal amount in – time without attracting interest, check the intuition of the sales manager at a significance level of 0.05.

    Reply
    • Benson,
      This sounds like a homework assignment and I have decided that I shouldn’t do other people’a homework for them. In any case, whether or not this is a homework assignment, here is a hint: Look at the two sample hypothesis testing for the Proportion Distribution at
      Proportion Distribution
      Charles

      Reply
  17. Charles,

    As my understanding, p-value is the probability that, using a given statistical model, the statistical summary (such as the sample mean difference between two compared groups) would be the same as or more extreme than the actual observed results (Wikipedia), given the null hypothesis is true.

    As for Example 1, we try to find the probability of 4 or more times of #3, as the p-value, and compare it with α.

    So,
    dbinom(0,10,1/6), the density of 0 #3 is: .1615056,
    Similarly,
    dbinom(1,10,1/6) =.3230112
    dbinom(2,10,1/6)=.29071
    dbinom(3,10,1/6)=.1550454
    Therefore, sum(dbinom(1,10,1/6) + … +dbinom(3,10,1/6)) = .9302722
    Hence, the p-value of 4 or more #3 is:
    1 – sum(…) = 1 – .9302722 = .0697278, which is larger than .05, therefore, we fail to reject the null hypothesis.

    Similarly,
    Example 2:
    dbinom(6,9,.5) = 0.1640625
    dbinom(7,9,.5) = .0703125
    dbinom(8,9,.5) = 0.01757812
    dbinom(9,9,.5) = 0.001953125
    Therefore, if 8 or more head come up, null hypothesis should be rejected.

    Example 3:
    Similar to Example 1:
    p-value = 1- pbinom(12,24, .35)= 1- .9577469 = .04225307, therefore, we reject null hypothesis. Same conclusion, but weaker.

    Reply
    • William,
      Thank you for catching these errors. I have now corrected the referenced webpage.
      On behalf of all the users of this website, I appreciate your help in improving the accuracy and quality of the website.
      Charles

      Reply
  18. Hello. I am a statistic student with a question. With hypothesis test proportion binomial distribution, is it possible to have a left tail? In example
    Ho: p=.062
    Hi:p< .o62
    And if it possible how would that be solved?

    Reply
    • Hi Allison,
      For Example 3 on the referenced webpage I calculated p-value = 1 – BINOM.DIST(13, 24, .35, TRUE). For the case of
      H0: p >=.062
      H1: p < .062
      I would calculate p-value = BINOM.DIST(x, n, p, TRUE).
      Charles

      Reply
  19. Hello

    1. I am still analyzing the subject and found that, for example, Mathematica and Maple return values equal to those of Excel. MINITAB provides the following type of output:
    Inverse Cumulative Distribution Function

    ______________________________
    Binomial with n = 100 and p = 0,03

    x P( X <= x ) x P( X <= x )
    2 0,419775 3 0,647249
    ______________________________

    Statistical software in general associates the inverse of the distribution function F(x) to quantiles, calculate using the criterion of the BINOM.INV function.

    2. In what concerns the code sent, I think there is one situation in which no correction should be made to the Excel value:

    LEFT ONE TAIL TEST
    xBI Result of the BINOM.INV function
    xLC Lef tail critical value

    x xLC Non rejection interval
    xBI >= xLC

    If F(xBI) = alpha
    THEN xBI = xLC
    Do not subtract 1 from xBI

    Reply
    • António,
      From what you are saying, it seems that there is a role for both a BINOM.INV function and a BINON.CRIT function, where sometimes the values are different.
      I didn’t completely understand the situation where the values should be equal (your item #2).
      Charles

      Reply
  20. Charles

    In reference to the messages posted earlier about the BINOM.INV function, we must take into account the following:
    1. The function does not follow the rules you presented for an inversion function.
    2. In fact, contrary to its name, the purpose of the function is not inversion but to answer the following type of question: what is minimum number of tosses of a coin for which there is a p% chance of at least x heads.
    3. This fact is reflected when saying that alpha is the criterion value and not significance level or type I error. The function does not even know if the user is considering the right or left tail.
    4. In fact the former CRITBINOM function had a more appropriate name.
    5. To achieve the answer of the question type presented in 2 it is inevitable that for left tails we have: value returned =critical value +1.
    6. In view of this: (1) the right tail c. value is correct; (2) the left tail critical value is always inflated by one and needs to be corrected.
    7. To perform this correction it is necessary to indicate to which tail if the value wanted refers.
    8. This can be achieved at spreadsheet level using formulas or with UDF function such as the one below:

    Option Explicit
    Option Base 1

    Function xlBinom_CV(n As Integer, p, alpha, nTails, pTail)

    ‘ n – sample size
    ‘ p – probability
    ‘ alpha – Probability of type I error
    ‘ nTails – number of tails (1,2)
    ‘ pTail -Position of the tail (1 – Lower, 2 – Upper)

    ‘ ATTENTION – This function is not fully tested

    With WorksheetFunction

    If nTails = 1 And pTail = 2 Then
    alpha = 1 – alpha
    ElseIf nTails = 2 And pTail = 1 Then
    alpha = alpha / 2
    ElseIf nTails = 2 And pTail = 2 Then
    alpha = 1 – alpha / 2
    End If

    If pTail = 1 Then
    xlBinom_CV = _
    .Binom_Inv(n, p, alpha) – 1
    Else
    xlBinom_CV = _
    .Binom_Inv(n, p, alpha)
    End If
    End With

    End Function

    Reply
    • An additional indication about the VBA routine is that a valuie -1 indicates a non-existing left tail when P(x=0) > alpha or alpha/2.

      Reply
    • Thanks Antonio for the clear explanation. I will add this function to the Real Statistics Resource Pack to help people with this concept.
      Charles

      Reply
  21. Charles,

    I found this site very helpful. Thank you. However, I differ in opinion regarding the “critical value” that Excel returns and at what point one Rejects the null hypothesis at the level of alpha. Focusing on example 2; it seems that the critical value returned by Excel is the value which causes the cumulative probability to pass from the “Fail to Reject” region into the “Reject” region–however, since this is a discrete, rather than continuous distribution, there is no distinct point at which this transition occurs (we “jump” from one cumulative probability to the next). Which means that “enough” (as it cannot specifically be assigned given we are dealing with a discrete distribution) of the probability for the specific occurrence for the “critical value” returned by Excel exists in the “Fail to Reject” region that to be at a minimum level of alpha, one would only reject if one observed a number of events GREATER than the critical value returned by Excel.

    For instance, in example 2 the discrete probability of observing EXACTLY 7 heads is BINOMDIST(7, 9, .5, FALSE) = 0.0703, which is greater than alpha = 0.05 by itself! So the way I see it, to be confident at a minimum level of alpha, I could only reject if I observed greater than or equal to 8 heads. For this specific example, I do not see how it is possible to say I am rejecting p = 0.5 at a 95% percent confidence level if I observe 7 heads when there is a 7.o3% likelihood of observing the exact outcome of 7 out of 9 heads given p is actually equal to 0.5. I contend that my confidence level to reject at 7 or more heads (rather than 8 or more) is only BINOMDIST(6, 9, .5, TRUE) = 91.02%. The next confidence level that exists for this specific example is our “jump” to observing 8 or more heads with a corresponding confidence of BINOMDIST(7, 9, .5, TRUE) = 98.05%

    Reply
  22. Hi

    I’ve got a set of data for occurrences of a health condition in a number of different geographical populations.

    To look to see if the rate in a given country is significantly different from the overall worldwide average rate is it valid us use BINOMDIST(no of cases, number in sample group, worldwide average rate, TRUE) and look to see if the value is 0.95 ?

    Reply
    • Sarah,
      Do you have any evidence that this type of data has a binomial distribution (which if the number of countries is large enough is equivalent to having a normal distribution)?
      Charles

      Reply
  23. Charles,

    It’s not about what “some might consider”. It is about the definition. And the definition tells us that the critical value is the minimum number of events such that the probability of observing THAT MANY OR MORE events is LESS THAN OR EQUAL TO alpha. But what Excel function returns is the minimum number of events such that the probability of observing STRICTLY MORE events is LESS THAN OR EQUAL TO alpha.

    Example. I will also take n = 5 and p = 0.5. The cumulative probability of observing 4 events is BINOM.DIST(4, 5, 0.5, TRUE) = 0.96875. Let’s take alpha = 0.05. Then Excel function returns BINOM.INV(5, 0.5, 1 – 0.05) = 4. However, the probability of observing 4 or more events is 1 – BINOM.DIST(3, 5, 0.5, TRUE) = 1 – 0.8125 = 0.1875 > 0.05. That’s because Excel returns a value for which the probability of observing STRICTLY MORE events is less than or equal to alpha, and strictly more than 4 is 5, and the probability of observing 5 or more events is 1 – BINOM.DIST(4, 5, 0.5, TRUE) = 0.03125 < 0.05. So the correct number actually is 5, not 4.

    Cheers
    Michael

    Reply
    • Michael,

      For any distribution with cumulative distribution function F(x), the inverse distribution function I(alpha) should equal the smallest x such that F(x) <= alpha (at least on the left tail), i.e. the largest value of x that is in the critical region of F (i.e. the region where the null hypothesis is rejected). Similarly, on the right tail, the inverse function should find the smallest value of x which is in the critical region (i.e. where the null hypothesis is rejected). For the binomial distribution F(x) = BINOM.DIST(x,n,p,TRUE). Thus I(alpha) should equal the smallest x such that BINOM.DIST(x,n,p,TRUE) <= alpha In your example n = 5, p = 0.5, alpha = .05. Now BINOM.DIST(1,5,.5,TRUE) = .1875 and BINOM.DIST(0,5,.5,TRUE) = .03125. Since .03125 <= .05 but .1875 > .05, the critical value is 0 and not 1. But BINOM.INV(5,.5,.05) = 1 and so Excel doesn’t find the right answer.

      If instead we take alpha = .95 (the right tail), in Excel we get BINOM.DIST(3,5,.5,TRUE) = .8125, BINOM.DIST(4,5,.5,TRUE) = .96875 and BINOM.DIST(5,5,.5,TRUE) = 1. But BINOM.INV(5,.5,.95) = 4, which is the smallest value where the null hypothesis is rejected, which I believe is the correct answer.

      So it seems that at the very least, Excel is inconsistent, producing the correct answer on one tail and the incorrect answer on the other tail.

      Of course, many of the tables of critical values that I have seen published use a different definition of critical value, namely the smallest value not in the critical region on the left tail and the largest value not in the critical region on the right (the critical region is again defined as the region where the null hypothesis is rejected). In this case, Excel is still incorrect on one tail and correct on the other tail for the binomial distribution.

      The issue of what is significant is also quite confusing in the literature. What happens when the p-value is exactly equal to .05 (or some other value of alpha). Usually based on the definition given, the null hypothesis is rejected when p <= .05; having said this whenever a significant result occurs, the result is written up as "p < .05" and not as "p <= .05". Charles

      Reply
  24. Nope, it did not come out again. Let me try for the last time. What CRITBINOM gives is: k_excel = min{k : P(X>k) <= alpha}.

    Reply
    • This time it worked. So, we see that k_crit k_excel since for discrete distributions, such as the binomial, P(X>=k) P(X>k).
      Thanks and sorry for polluting your site with several posts. Feel free to correct formulas in the first one and delete all the others.

      Reply
      • What’s going on? There were (should be) “not equal” signs between the k’s and P’s.
        PS: Maybe you should allow some LaTeX type support in comments. Cheers.

        Reply
        • Michael,
          Sorry, but I no longer understand what your final comment is. Please send one more comment which captures what you are trying to say without referring to any of the previous comments.
          Charles

          Reply
          • Hi Charles,
            Sorry for the confusion. The point is that Excel function returns k for which P(X >k) is = k) is <= alpha. This two are not the same.

          • Hi Charles,
            Sorry for the confusion. The point is that Excel function returns k for which a probability of observing a value strictly greater than k is less than or equal to alpha. But the critical values of k is defined as that for which a probability of observing a value greater than or equal to k is less than or equal to alpha. There, said it in words. This should now come out right.

          • Michael,

            Let’s use a specific example. Suppose we are looking at a binomial distribution with n = 5 and p = .5. The probability of 0 successes is BINOM.DIST(0,5,.5,FALSE) = .03125 and the probability of 1 success is BINOM.DIST(1,5,.5,FALSE) = .15625. It also follows that the probability of 0 or 1 successes is given by .03125 + .15625 = .1875 or BINOM.DIST(1,5,.5,TRUE) = .1875.

            Not let alpha = .1875. The critical value as defined by Excel is BINOM.INV(5,.5,.1875) = 1, whereas BINOM.INV(5,.5,.18749999) = 1 and BINOM.INV(5,.5,.187500001) = 2. Some might consider the critical value for alpha = .1875 to be 2 instead of 1.

            Charles

  25. Hi, Charles.
    I think the calculation of a critical value of events you demonstrate using CRITBINOM function is not correct. The critical value is defined as

    k_crit = min{k : P(X>=k) <= alpha}

    but what the Excel function returns is

    k_excel = min{k : P(X= 1- alpha} = min{k : 1- P(X<=k) k) k) P(X>=k), the difference being, of course, P(X=k).

    I am not sure, actually, if there is a simple way to get the correct critical value in Excel using CRITBINOM. Any suggestions?

    Thanks
    Michael

    Reply
    • Sorry, don’t know what happed with formulas in my previous post above. The second one should read

      k_excel
      = min{k : P(X= 1- alpha}
      = min{k : 1- P(X<=k) k) <= alpha }

      Hope this one come out OK.

      Reply
  26. I understand it now. Excel gives cumulative probability, which for 1 to 7 heads is 0.9804. But 7 heads in itself has an exact probability of 0.0731, see the table below.
    So when Excel says 7 heads is the critical value, it means that 8 and above is 95% confident. Adding the exact probability of 8 heads (0.01758) and 9 heads (0.00195), gives a probability of 0.01953. 2-tailed that is 0.04 like my statistics program says.
    So when Excel says BINOM.DIST(8,9,.5,TRUE) = 0.001953, it is the cumulative probabality of getting 1 to 8 heads, and that is the same as the probability of getting 9 heads.

    Number of Successes
    Number of Failures
    Exact Probability
    Cumulative Probability
    0 9 0.195% 0.195%
    1 8 1.758% 1.953%
    2 7 7.031% 8.984%
    3 6 16.406% 25.391%
    4 5 24.609% 50.000%
    5 4 24.609% 74.609%
    6 3 16.406% 91.016%
    7 2 7.031% 98.047%
    8 1 1.758% 99.805%
    9 0 0.195% 100.000%

    Reply
  27. Hello, I have a question about example 2, tossing a coin 9 times and the result of the Critbinom function is 7 heads.
    When I input that in my statistical program and choose Non-parametric statistics – Binomial test, using a test proportion of 0.5, it gives a p-value of 0.18 (2-tailed)!
    8 heads out of 9 tosses gives a p-value of 0.04 (2-tailed).
    Doesn’t that mean that we need 8 heads to be 95% confident that the coin is biased towards heads?

    Reply
    • Erik,
      I am not sure where you got your p-value from, but 1-BINOM.DIST(8,9,.5,TRUE) = 0.001953. Thus p-value = .003906, which is close to .004 not .04.
      Charles

      Reply
      • Hello Charles,
        I got the p-value from my statistics program PSPP, it is similar to SPSS. I get the same result at this site:
        http://graphpad.com/quickcalcs/binomial1/

        Here is the result:
        “Sign and binomial test
        Number of “successes”: 7
        Number of trials (or subjects) per experiment: 9
        Sign test. If the probability of “success” in each trial or subject is 0.500, then:
        The one-tail P value is 0.0898
        This is the chance of observing 7 or more successes in 9 trials.
        The two-tail P value is 0.1797
        This is the chance of observing either 7 or more successes, or 2 or fewer successes, in 9 trials. ”

        /Erik

        Reply
  28. Based on the problem, the question was “how many heads you must observe so that the probability of getting head is not equal to 5/17 on the average?”. How was that?

    Reply
    • Rochelle,
      Remember that the probabilities that an event E occurs or doesn’t occur are interrelated, namely the probability that event E doesn’t occur is equal to 1 – the probability that it does occur. In your problem you need to look at confidence intervals. Inside the interval you are confident that some event occurs, while outside that interval you are confident that the event doesn’t occur.
      Charles

      Reply
  29. Hi! This site helps me a lot in answering some of our assignments. But there’s one problem that I, myself, can’t understand. Hope you can help me. Thank you!

    Suppose a coin is tossed 170 times and you observed that 50 heads and 120 tails. Now, if you are going to toss this coin 23 times, how many heads you must observe so that the probability of getting head is not equal to 5/17 on the average? (Hint: Hypothesis testing with interval estimation)

    Reply
    • Rochelle,
      I am reluctant to do your homework assignment, but I will give you a possible hint. If your were told that the coin is biased so that the probability of a head occurring is 5/17, then you could use the approach shown in Example 2 of the referenced webpage. Here 50 heads and 120 tails yields 50/170 = 5/17. Since you were told to use confidence intervals, you need to look beyond just the averages but at some interval around 5/17 (see how to calculate confidence intervals).
      Charles

      Reply
  30. Hi, this website is so helpful! Really glad I found it. I wonder if you could help me with a problem too. My English isn’t that good so I hope you understand. I did a discrimination test in school with two brands of popcorn. There where two cups of B-brand cheap popcorn and 1 cup of A-brand popcorn. The students that follow the same subject (statistics) where the test persons. There where 16 test persons, 8 of them pointed out the A brand popcorn as the different one, which was correct. Now I have to analyse these results with the five steps of hypothesis testing from the book of Agresti & Franklin. Can I use a binomial one tailed test? And is Ho: p=0.33 and Ha: p>0.33? I’m not sure if I’m doing it right and I’m not allowed to use my Texas Ti 83 calculator. And can I use a=0.05? I hope you can help me out or give me some hints. Thanks, Eliza.

    Reply
    • Eliza,
      If I understand the problem correctly, then I believe that the approach you are taking is correct. Assume p = probability of selecting A-brand on any single trial = 1/3, based on the null hypothesis that people pick completely at random. You can then apply the binomial one-tailed test as you have described.
      Charles

      Reply
  31. Hello, I like your website. I wonder if you could help me with a problem. I am a custody evaluator and I want to examine 89 reports to assess for whether I am biased in my decisions, for either fathers or mothers. Probability of an outcome is of course 50:50. So the null hypothesis is mothers and fathers are equal. Can the binomial test be used to show examine if my outcomes depart from equality? How many decisions in either direction would be necessary to show a bias in 89 reports? Thanks, Marvin

    Reply
    • Hello Marvin,
      It sounds like your problem is equivalent to Example 2 on the referenced webpage with n = 89 and p = .5.
      Charles

      Reply

Leave a Comment