6.5 one and two sample inference for proportions np>5; n(1-p)>5 n independent trials; x=# of...
Post on 31-Dec-2015
222 Views
Preview:
TRANSCRIPT
6.5 One and Two sample Inference for Proportions
• np>5; n(1-p)>5• n independent trials;• X=# of successes• p=probability of a success• Estimate:
n
Xp ˆ
Mean and variance of p̂
22
1 1ˆ ( ) *
1 (1 ) (1 )ˆ( ) ( ) ( ) ( )
XEp E EX np p
n n nX np p p p
Var p Var Var Xn n n n
When n is large, approximate probabilities for can be found using the normal distribution with the same mean and standard deviation.
p̂
• An approximate confidence interval for p is
ˆ ˆ(1 )ˆ
p pp z
n
Sample Size• The sample size required to have a certain
probability that our error (plus or minus part of the CI) is no more than size ∆ is
2 21 1(1 ) ( ) * ( )
2 2
z zn p p
ˆ ˆ(1 )p pz
n
If you know p is somewhere …• If thenmaximum p(1-p)=0.3(1-0.3)=0.21
• If thenmaximum p(1-p)=0.4(1-0.4)=0.24
3.0p
2
20.21
zn
6.0p
2
20.24
zn
• Estimate p(1-p) by substitute p with the value closest to 0.5
(0, 0.1), p=0.1(0.3, 0.4), p=0.4(0.6, 1.0), p=0.6
Example
• A state highway dept wants to estimate what proportion of all trucks operating between two cities carry too heavy a load
• 95% probability to assert that the error is no more than 0.04
• Sample size needed if1. p between 0.10 to 0.252. no idea what p is
Solution
1. ∆=0.04, p=0.25
Round up to get n=451
2. ∆=0.04, p(1-p)=1/4
n=601
1.96z
19.450004
96.1)75.0(25.0
2
2
n
1.96z
25.60004.04
96.12
2
n
Tests of Hypotheses
• Null H0: p=p0
• Possible Alternatives: HA: p<p0
HA: p>p0
HA: pp0
Test Statistics
• Under H0, p=p0, and
• Statistic:
is approximately standard normal under H0 .
Reject H0 if z is too far from 0 in either direction.
n
pp
n
ppp
)1()1( 00ˆ
n
pp
ppppz
p )1(
ˆˆ
00
0
ˆ
0
Rejection Regions
Alternative Hypotheses
HA: p>p0 HA: p<p0 HA: pp0
Rejection Regions
z>z z<-z z>z/2 or
z<-z/2
Equivalent Form:
0 0
0 0 0 0
ˆ*
(1 ) (1 )
p p X npnz
np p np p
n
Example
• H0: p=0.75 vs HA: p0.75• =0.05• n=300• x=206• Reject H0 if z<-1.96 or z>1.96
68667.0300
206ˆ
n
Xp
Observed z value
• Conclusion: reject H0 since z<-1.96• P(z<-2.5 or z>2.5)=0.0124< a reject H0.
0.68667 0.752.5
0.75(1 0.75)300
206 2252.5
300(0.75)(1 0.75)
z
or
z
Example
• Toss a coin 100 times and you get 45 heads• Estimate p=probability of getting a headIs the coin balanced one? a=0.05Solution: H0: p=0.50 vs HA: p0.50
45.0100
45ˆ p
Enough Evidence to Reject H0?• Critical value z0.025=1.96• Reject H0 if z>1.96 or z<-1.96
• Conclusion: accept H0
15
5
)50.01)(50.0(100
)50.0(10045
z
Another example
• The following table is for a certain screening test
91010Results Negative
80140Result Positive
Cancer AbsentCancer Present
FNA status
Truth = surgical biopsy
Total
220
920
Total 150 990 1140
True positive 140sensitivity 0.93
True Positives False Negatives 150
• Test to see if the sensitivity of the screening test is less than 97%.
• Hypothesis
• Test statistic
0 0
0
: .97
: .97
H p p
Ha p p
0 0
ˆ 0 0
estimated proportion-prestated proportion
standard error of the estimated proportion
ˆ ˆ 140 150 .972.6325
(1 ) .97 (1 .97)150
p
z
p p p p
SE p p
n
• Check p-value when z=-2.6325, p-value = 0.004
• Conclusion: we can reject the null hypothesis at level 0.05.
What is the conclusion?
One word of caution about sample size:• If we decrease the sample size by a factor of 10,
911Results Negative
814Result Positive
Cancer AbsentCancer Present
FNA status
Truth = surgical biopsy
Total
22
92
Total 15 99 114
True positive 14sensitivity 0.93
True Positives False Negatives 15
And if we try to use the z-test,
0 0
ˆ 0 0
estimated proportion-prestated proportion
standard error of the estimated proportion
ˆ ˆ 14 15 .970.8324
(1 ) .97 (1 .97)15
p
z
p p p p
SE p p
n
P-value is greater than 0.05 for sure (p=0.2026). So we cannot reach the same conclusion.
And this is wrong!
So for test concerning proportions
We want
np>5; n(1-p)>5
top related