# Difference between cumulative binomial probability and discrete

I am new to this so I don't know if this question is too obvious or not. I have this question (its already solved I'm just trying to understand why). Say you want to prove that less than 10% of US citizen is vegetarian. So your H0: at least 10% of US citizen is vegetarian and H1: less than 10% of US citizen is vegetarian. Assuming that you have a sample of 300 people and 21 of them is found to be vegetarian. The problem is solved using the R function pbinom(21,300,0.3), which to my knowledge is the binom function P(X<=21). Why do we use cumulative here? Can we use dbinom(21,300,0.3) instead? (just find the probability of getting 21 out of 300 with 0.3)

Binomial PDF and CDF in R. First, let's look at pbinom and dbinom in R.

If $$Y \sim \mathsf{Binom}(n = 5, p = 1/2),$$ then $$P(Y = 2) = {5\choose 2}(1/2)^5 = 0.3125.$$ In R you can compute the formula for yourself or use the binomial PDF function dbinom.

choose(5, 2)/2^5
 0.3125
dbinom(2, 5, 1/2)
 0.3125


Now, if you want $$P(Y \le 2) = P(Y=0) + P(Y=1) + P(Y=2) = 0.5000,$$ you need to compute each of the three probabilities on the right side of the equation. You can do them individually, adding three results from dbinom or with one application of the binomial CDF pbinom.

dbinom(0:2, 5, 1/2)
 0.03125 0.15625 0.31250
sum(dbinom(0:2, 5, 1/2))
 0.5
pbinom(2, 5, 1/2)
 0.5


Next, for some terminology. It's not correct to say you want to "prove that less than 10% of US citizen is vegetarian." You can't prove anything for sure about the percentage of vegetarians in the US by taking a random sample of 300 US citizens and testing a hypothesis. However, you can make a statement about your sample, that sheds some light on that 10% hypothesis.

One sided hypothesis test of binomial success probability. If 10% of US citizens are vegetarian, then a sample of $$n = 300$$ should show about $$X = 30$$ vegetarians. In fact, you got $$X = 21 < 30,$$ which might make you think the percentage is less than 10%.

Null disribution. Let's look at a plot of the distribution $$\mathsf{Binom}(n = 300, p = .1).$$ This is called the 'null' distribution because it agrees with the equality in the null hypothesis $$H_0: p \ge 0.1.$$ [By the way, the null hypothesis must always contain an $$=$$ sign; maybe as $$=. \le,$$ or $$\ge.$$ In this problem it would have been OK to write $$H_0: p = 0.1.]$$

plot(x, PDF, xlim=c(0,70), xaxs="i", type = "h", col="blue", lwd=3)
abline(h=0, col="green2")
abline(v=21, col="red", lty="dotted") Almost all of the probability in this distribution lies below 70, so I showed only probabilities from 0 through 70. The red vertical dotted line shows the observed value $$X = 21.$$

P-value of the test. In order to test $$H_0: p \ge 0.1$$ against $$H_a: p < 0.1,$$ we want to know not just the probability $$P(X = 21),$$ but the probability $$P(X \le 21).$$ Values below 21 would be even more convincing evidence for small percentages of vegetarians in the US, so all of them need to be included to make a useful statement. The P-value of a test is the probability (based on $$H_0)$$ of getting a value as or more extreme than the observed value, in the direction(s) of the alternative hypothesis. [This is a one-sided alternative so we are only interested in values smaller than the observed 21.]

So assuming the true value is $$p = 0.1$$ specified in $$H_0$$ we seek $$P(X \le 21\,|\,p=0.1) = 0.0458 < 0.05.$$ This is the P-value of the test. Many times we test hypotheses at the 5% level, which means to reject $$H_0$$ when the P-value is smaller than $$0.05 = 5\%.$$ In terms of the graph above, the P-value is the sum of the heights of the bars at and to the left of the vertical dotted line.

pbinom(21, 300, 0.1)
 0.04580612


This is not 'proof' that the percentage of US citizens who are vegetarian is below 10%. Your observed value gives you a point estimate that $$\hat p = X/n = 21/300 = 0.07,$$ or 7%. We say that the observed value 7% is 'significantly' smaller than the hypothetical 10% (or more).

Notes: (1) You have a typo in your question, $$0.3$$ instead of $$0.1,$$ which may have added to your confusion. Using that would have given you an incorrect

pbinom(21, 300, 0.3) 1 7.664809e-23

(2) If you had observed $$X = 25$$ vegetarians out of $$n = 300$$ then your point estimate would have been $$\hat p = 25/300 = 0.083$$ or 8.3%. However, 8.3% is not 'significantly' smaller, at the 5% level, than the hypothetical 10% (even though it is smaller). The P-value of that observation would have been 0.19, which exceeds 0.05.

pbinom(25, 300, 0.1)
 0.1949021


(3) In fact, $$X = 21$$ is the 'critical value' for rejection at the 5% level. It is the largest observed value that would still lead to rejection of $$H_0.$$ In particular, $$X = 22$$ would have given a P-value above 0.05.

pbinom(22, 300, 0.1)
 0.06993984