Bernoulli experiment - hypothesis testing with specific scenario

85 Views Asked by At

Let's consider null hypothesis that we want to examine, that probability of success is smaller than $\frac 1 2$ in Bernouli distribution. We also have independent sample of $20$ observations: $x_1, x_2, ..., x_{20}$ from this distribution. We are going to reject the null hypothesis if any only if amount of observed successes in this experiment is 11 or lower. I want to calculate power of this test:

My work so far

$$X \sim \text{Bernouli}(\theta)$$ $$H_0:\theta < \frac 1 2$$

Function $\phi$ is a function that takes value $1$ when we reject null hypothesis and value $0$ when we do not reject it. In our example:

$$\phi(x_1, x_2, ..., x_{20}) = \begin{cases} 1& \text{with probability} \;{20 \choose 11} \theta^{11} (1 - \theta)^{9}\\ 0& \text{with probability} \;1 - {20 \choose 11} \theta^{11} (1 - \theta)^{9} \end{cases}$$

Then power of the test is given as $E_\theta[\phi(x_1,...,x_{20})] = {20 \choose 11} \theta^{11} (1 - \theta)^{9} $

Am I correct with my calculations?

1

There are 1 best solutions below

0
On

Comment: As @Henry comments, something must be wrong with the statement of your question. Maybe I can help you formulate a more reasonable version of it.

If you are testing $H_0: p = 1/2$ against $H_a: p < 1/2,$ then it might make sense to reject $H_0$ if you see $x \le 6$ Successes in $n = 20$ trials. Then the significance level of your test would be about 6%. [Because of the discreteness of the binomial distribution, it is not possible to have a (nonrandomized) test at exactly the 5% level.] Computation using R:

pbinom(6, 20, .5)
[1] 0.05765915

In order to find the power of my proposed test with critical value $c = 6,$ you would have to specify a particular alternative success probability $p_a.$

Perhaps you want to find the probability of rejecting $H_0$ with my test if the true success probability is $p_a = 1/4.$ Then you need to find $P(X \le 6 \,|\, p=1/4) = 0.7858,$ which is the power of my test against the alternative $p_a = 1/4.$

pbinom(6, 20, 1/4)
[1] 0.7857819

Taking another approach, let's look at the exact binomial test procedure binom.test in R: With $x = 11$ successes is $n=20$ trials, that test gives P-value $0.7483.$ To test (nearly) at the 5% level, you would want to see a P-value near $0.05 = 5\%.$

binom.test(11, 20, p=.5, alt = "less")

        Exact binomial test

data:  11 and 20
number of successes = 11, number of trials = 20, 
 p-value = 0.7483
alternative hypothesis: 
 true probability of success is less than 0.5
95 percent confidence interval:
 0.0000000 0.7413494
sample estimates:
 probability of success 
                   0.55 

The bottom line is that it would make no sense to reject $H_0: p=1/2$ in favor of $H_a: p < 1/2,$ when the estimated success probability is $\hat p = x/p = 0.55 > 1/2.$

Notes:

(1) Power curve. It is possible to make a 'power curve', showing powers of my test proposed above for various alternative values of $p_a.$ Red lines show the power for the particular alternative $p_a = 1/4,$ discussed above.

p.alt = seq(.1, .49, by=.01)
pwr = pbinom(6, 20, p.alt)
hdr="Power Curve for Proposed Test"
plot(p.alt, ylim=0:1, pwr, type="l", main=hdr)
 abline(v=.25, col="red")
 abline(h=.7858, col="red")

enter image description here

(2) Another reasonable scenario and test. If $n = 33,$ then it makes sense to use $c=11$ as the critical value for a left-sided test at the 4% level, which would have power about 90% against the alternative value $p_a = 1/4.$ [I will let you fill in the gaps on this proposed test, based on the following computations in R.]

pbinom(11, 33, .5)
[1] 0.04007166
pbinom(11, 33, .25)
[1] 0.9012785