Another service from Omega

The Power Function and the Size of a Test


*****

Problem

Suppose that the proportion, p, of defective items in a population is unknown, and that we want to test:
H0: p = 0.2
H1: p not equal 0.2
Suppose also that a random sample of 20 items is drawn at random from the population and we let Y denote the number of defectives in the sample. For the procedure that rejects the null when either Y > 6 or Y < 2 compute:
a) The value of the power function at the points
p=0,0.1,0.2,...,0.9,1; and sketch the power function.
b) The size of the test.

Solution:

Recall that the power is just the probability of rejecting the null as a function of the parameter. Let's call it w(p). Hence,

> w := p -> 1-sum(binomial(20,k)*p^k*(1-p)^(20-k),k=0..6)+
> sum(binomial(20,k)*p^k*(1-p)^(20-k),k=0..1);

              /  6                                     \
              |-----                                   |
              | \                     k        (20 - k)|
w := p -> 1 - |  )   binomial(20, k) p  (1 - p)        |
              | /                                      |
              |-----                                   |
              \k = 0                                   /

       /  1                                     \
       |-----                                   |
       | \                     k        (20 - k)|
     + |  )   binomial(20, k) p  (1 - p)        |
       | /                                      |
       |-----                                   |
       \k = 0                                   /
> seq(evalf(w(j/10),3),j=1..9);
            .394, .156, .400, .751, .942, .994, 1.000, 1.000, 1.000
> evalf(w(0.01),3);
                                     .983
> evalf(w(0.001),3);
                                     1.00
> plot(w(p),p=.001..0.999);
picture a picture here

as you can see the picture also solves the other question. The size is just w(0.2) = .156.


Link to the commands in this file
Carlos Rodriguez <carlos@math.albany.edu>
Last modified: Tue Nov 17 11:36:07 EST 1998