Title | Testing Proportions prtest |
---|---|
Author | Anonymous User |
Course | Biologia |
Institution | Univerzitet u Tuzli |
Pages | 5 |
File Size | 267 KB |
File Type | |
Total Downloads | 98 |
Total Views | 148 |
test de proporciones...
Testing Proportions
http://www.philender.com/courses/intro/notes3/portion.ht
Testing Proportions Inference for a Single Proportion Sample Proportion
also
Population Proportion
Standard Error of a Proportion
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, sqrt(.5*(1-.5)/1000)*1.96 = .031 That is, the margin of error is about 3%. This is how the margin of error you read about in the newspapers for public opinion polling is calculated.
Confidence Interval for a Single Proportion
Testing Proportions
http://www.philender.com/courses/intro/notes3/portion.ht
Single Sample z-test Example A coin is tossed 4040 times with 2048 heads. Is it a fair coin? H0: p = 0.5
H1: p 0.5
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 Pr(Z < z) = 0.8098
Ha: p != 0.5 Pr(|Z| > |z|) = 0.3804
Ha: p > 0.5 Pr(Z > z) = 0.1902
Confidence Interval Example Construct a 95% confidence interval on the preceding example. phat ± CVz*standard error 0.5069 ± 1.96*0.0079 = 0.5069 ± 0.0155 (0.4914, 0.5224) 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
Testing Proportions
http://www.philender.com/courses/intro/notes3/portion.ht
Comparing Two Independent Proportions Pooled Proportions
Standard Error for Pooled 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
127
0.487
Rural 160
65
0.400
Is the proportion of urban seniors significantly different from rural seniors? H0: p1 = p2
H1: p1 p2
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
Testing Proportions
http://www.philender.com/courses/intro/notes3/portion.ht
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 Pr(Z < z) = 0.9591
Ha: diff != 0 Pr(|Z| < |z|) = 0.0818
Ha: diff > 0 Pr(Z > z) = 0.0409
Confidence Interval for Differences in Two Independent Proportions Difference in Proportions
Standard Error of Differences
Confidence Interval Formula
Confidence Interval Example In a survey of high school seniors, how many have taken any AP math classes. Group n Frequency
p
Urban 261
127
0.487
Rural 160
65
0.400
Construct a 95% confidence interval for the difference in these two independent proportions. The critical value of z at a = 0.05 is ±1.96 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)
Testing Proportions
http://www.philender.com/courses/intro/notes3/portion.ht
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.
Stata Example (same as above) 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 Pr(Z < z) = 0.9591
Intro Home Page Phil Ender, 23nov05, 20Jun00
Ha: diff != 0 Pr(|Z| < |z|) = 0.0818
Ha: diff > 0 Pr(Z > z) = 0.0409...