Inference for Proportions

advertisement
Inference for Proportions
We can use the STATA command prtesti to construct confidence intervals and
perform hypothesis tests for problems dealing with proportions.
A. One sample tests and confidence intervals
To test H 0 : p  p 0 using a one-sample test of proportion, we use the command:
prtesti N phat p0
where N is the sample size, phat is the sample proportion and p0 is the
hypothesized population proportion.
If we instead are given integer counts of the number of “successes” in the
observed sample rather than the sample proportion we can include the option
count and write:
prtesti N X p0, count
Note that in this command we have replaced the sample proportion phat by the
number of successes X.
Ex. A factory claims that less than 10% of the components they produce are
defective. A consumer group is skeptical of the claim and checks a SRS of 300
components and finds that 39 are defective. Is there significant evidence to reject
the company’s claim?
In this example N=300, X=39 and p0=0.10. To solve this problem, using STATA
we can use the command:
prtesti 300 39 .10, count
This gives rise to the following output:
Since the alternative hypothesis is Ha: p>0.10, the p-value of the test is 0.0416. A
95% confidence interval for p is given by (0.092, 0.168).
If we instead were interested in a 99% confidence interval we would need to
include the option level, as follows:
prtesti 300 39 .10, count level(99)
This would give the following revised output:
Note the only difference in the output is that now we are given a 99% confidence
interval (0.080, 0.180).
B. Two sample tests and confidence intervals
To test H 0 : p1  p2 using a two-sample test of proportion, use the command:
prtesti N1 phat1 N2 phat2
or
prtesti N1 X1 N2 X2, count
where N1 and N2 are the sample sizes, phat1 and phat2 are the sample
proportions and X1 and X2 are the number of “successes” in each of the two
samples.
Ex. In two separate polls conducted 6 months apart, constituents were asked if
they approved of the job their congressman was doing. The results of the polls
are listed in the table below:
Population
Second Survey
First Survey
N
X
1100 700
900 500
Is there significant evidence that his approval rating has increased?
In this example N1=1100, X1=700, N2=900 and X2=500. To test whether there is
a significant difference in approval rating between the polls use the command:
prtesti 1100 700 900 500, count
This command gives the following output:
From the output we see that the p-value is 0.0001. A 95% confidence interval for
the difference is given by (0.038, 0.124).
HOMEWORK:
Q1. Do problem 20.26 from the textbook.
Solve the problem using STATA and the prtesti command. Make sure to hand in
your log file and answers to any questions in the text.
Q2. Do problem 22.20 from the textbook.
Solve the problem using STATA and the prtesti command. Make sure to hand in
your log file and answers to any questions in the text.
Download