Hypothesis testing - When to subtract one during type I and type II testing?

268 Views Asked by At

I'm currently studying statistics and I'm reviewing notes I took during a class last week. However, there's something I'm confused about. My professor subtracted 1 from the "successes" and I can't seem to figure out why. Essentially, the scenario was like this:

Someone flipped a coin 16 times.

$$H_0:p=0.5\text{ v.s. }H_a:p=0.55$$

Test 1: Reject $p = 0.50$ if 10 or more heads are observed out of 16.

$\text{Pr}(X \ge 10 \text{ when } p= 0.5)$ where X is a binomial with $n = 16$ and $p = 0.50$.

This is the part I don't understand. When using R, he did the following:

1 - pbinom(9, 16, 0.5)

Where did the 9 come from? Why did he subtract 1 from the initial 10 tosses? If I was in a scenario where I had:

$$\text{Pr}(X \le 15 \text{ when } p = 0.50)$$

Would I still subtract 1? Would the R solution be pbinom(15, 16, 0.50) or pbinom(14, 16, 0.50)? How do we decide when to subtract 1 like this?

( Sorry if my formatting is bad! I've never posted math equations like this to these forums and I can't seem to figure it out)

1

There are 1 best solutions below

0
On BEST ANSWER

$P(X \ge 10) = 1 - P(X \le 9) = 0.2272491.$ In R, pbinom is a binomial CDF and dbinom a binomial PDF.

For $X \sim \mathsf{Binom}(n=16,p=.5)$ here are three ways to find $P(X \ge 10)$ in R. The last, and most direct method, subtracting the CDF, is the one shown in class.

sum(dbinom(10:16, 16, .5))
[1] 0.2272491
1 - sum(dbinom(0:9, 16, .5))
[1] 0.2272491
1 - pbinom(9, 16, .5)
[1] 0.2272491

x = 0:16;  PDF = dbinom(x, 16, .5)
plot(x, PDF, type="h", lwd=2, main="PDF of BINOM(16, .5)")
 abline(v=0, col="green2");  abline(h=0, col="green2")
 abline(v = 9.5, col="red", lwd=2, lty="dotted")

enter image description here

The desired probability is the sum of the heights of the bars to the right of the dotted red line.