Inference for a Single Proportion

also



z-test for a Single Proportion

Margin of Error for a Proportion
margin of error = sp*CVz
For example, the margin of error for a 95% confidence interval for p = .5 with 1000 observations is,
Confidence Interval for a Single Proportion

Single Sample z-test Example
A coin is tossed 4040 times with 2048 heads. Is it a fair coin?
Use a two-tail test with a = 0.05.
Critical Value of z = ±1.96
phat = 2048/4040 = 0.5069 qhat = 1 - 0.5069 = 0.4931
Standard Error = SQRT((.5069)(.4931)/4040) = 0.0079
Observed z = (0.5069 - 0.5000)/0.0079 = 0.88
Decision: Fail to reject H0.
The data do not support the hypothesis that the coin is biased.
Stata Example
prtesti 4040 .5069 .5
One-sample test of proportion x: Number of obs = 4040
------------------------------------------------------------------------------
Variable | Mean Std. Err. [95% Conf. Interval]
-------------+----------------------------------------------------------------
x | .5069 .0078657 .4914835 .5223165
------------------------------------------------------------------------------
p = proportion(x) z = 0.8771
Ho: p = 0.5
Ha: p < 0.5 Ha: p != 0.5 Ha: p > 0.5
Pr(Z < z) = 0.8098 Pr(|Z| > |z|) = 0.3804 Pr(Z > z) = 0.1902
Confidence Interval ExampleConstruct a 95% confidence interval on the preceding example.
Since the confidence interval contains the hypothesized population proportion, fail to reject the H0.
Stata Example
cii 4040 2048
-- Binomial Exact --
Variable | Obs Mean Std. Err. [95% Conf. Interval]
---------+-------------------------------------------------------------
| 4040 .5069307 .0078657 .4913908 .5224614
Comparing Two Independent Proportions


z-test for Comparing Two Independent Proportions

Two Independent Sample z-test Example
In a survey of high school seniors, how many have taken any AP math classes.
| Group | n | Frequency | p |
|---|---|---|---|
| Urban | 261 | 0.487 | |
| Rural | 160 | 0.400 |
Is the proportion of urban seniors significantly different from rural seniors?
Use a two=tailed test at a = 0.05
Critical Value of z = ±1.96
phat = (127+65)/(261+160) = 192/421 = 0.456
qhat = 1 - phat = 1 - 0.456 = .544
sp = SQRT(0.456*0.544*(1/261 + 1/160)) = 0.05
z = (0.487 - 0.400)/0.05 = 0.087/0.5 = 1.74
Decision: Fail to reject H0
There is no significant difference between the two proportions.
Stata Example
prtesti 261 .487 160 .4
Two-sample test of proportion x: Number of obs = 261
y: Number of obs = 160
------------------------------------------------------------------------------
Variable | Mean Std. Err. z P>|z| [95% Conf. Interval]
-------------+----------------------------------------------------------------
x | .487 .0309388 .4263611 .5476389
y | .4 .0387298 .3240909 .4759091
-------------+----------------------------------------------------------------
diff | .087 .0495702 -.0101558 .1841558
| under Ho: .0499896 1.74 0.082
------------------------------------------------------------------------------
diff = prop(x) - prop(y) z = 1.7404
Ho: diff = 0
Ha: diff < 0 Ha: diff != 0 Ha: diff > 0
Pr(Z < z) = 0.9591 Pr(|Z| < |z|) = 0.0818 Pr(Z > z) = 0.0409
Confidence Interval for Differences in Two Independent Proportions



Confidence Interval Example
In a survey of high school seniors, how many have taken any AP math classes.
| Group | n | Frequency | p |
|---|---|---|---|
| Urban | 261 | 0.487 | |
| Rural | 160 | 0.400 |
Construct a 95% confidence interval for the difference in these two independent proportions.
sD = SQRT((0.487 * 0.513)/261 + (0.400 * 0.600)/160)) = 0.0496
D = 0.487 - 0.400 = 0.087
D ± CVz * sD = 0.087 ± 1.96 * 0.0496 =
0.087 ± 0.097 =
(-0.01, 0.184)
For hypothesis testing purposes, see if 0 is in the interval. It is in the interval, thus fail to reject the H0.
There are no differences in the two proportions beyond chance.
prtesti 261 .487 160 .4
Two-sample test of proportion x: Number of obs = 261
y: Number of obs = 160
------------------------------------------------------------------------------
Variable | Mean Std. Err. z P>|z| [95% Conf. Interval]
-------------+----------------------------------------------------------------
x | .487 .0309388 .4263611 .5476389
y | .4 .0387298 .3240909 .4759091
-------------+----------------------------------------------------------------
diff | .087 .0495702 -.0101558 .1841558
| under Ho: .0499896 1.74 0.082
------------------------------------------------------------------------------
diff = prop(x) - prop(y) z = 1.7404
Ho: diff = 0
Ha: diff < 0 Ha: diff != 0 Ha: diff > 0
Pr(Z < z) = 0.9591 Pr(|Z| < |z|) = 0.0818 Pr(Z > z) = 0.0409
Intro Home Page
Phil Ender, 23nov05, 20Jun00