Download Lecture 10: Comparing two populations: proportions

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

Bootstrapping (statistics) wikipedia , lookup

Psychometrics wikipedia , lookup

Taylor's law wikipedia , lookup

Omnibus test wikipedia , lookup

Misuse of statistics wikipedia , lookup

Resampling (statistics) wikipedia , lookup

Student's t-test wikipedia , lookup

Transcript
Lecture 10: Comparing two populations: proportions
Problem: Compare two sets of sample data: e.g. is the proportion of As in
this semester 152 the same as last Fall?
Methods: Extend the methods introduced for situations involving one
sample to the new situation with two samples.
We will learn how to use two sample proportions for:
•
constructing a confidence interval estimate of the difference between
the corresponding population proportions, and
•
testing a claim made about the two population proportions.
Data requirements
We have sample proportions from two independent simple random
samples.
For each of the two samples, the number of successes is at least 5
and the number of failures is at least 5.
COMPARING PROPORTIONS IN LARGE SAMPLES
Examples: Compare probability of H on two coins.
Compare proportions of republicans in two cities.
2 populations: p1=proportion of S (successes) in population 1,
p2=proportion of S in population 2.
GOAL: Determine if p1=p2 based on two samples.
Perform two Binomial experiments (one in each population)
x
= ;
m
y
ˆp2 = .
n
1ST sample: x successes in m ind. trials, get sample prop. of S: p
ˆ1
2nd sample: y successes in n ind. trials, get sample prop. of S:
Test
Ho: p1= p2
vs
Ha: p1≠ p2 or
Ha: p1> p2 or Ha: p1< p2
TESTING HYPOTHESES PROCEDURE
Test on significance level α.
STEP1. Ho: p1= p2
STEP 2. Test statistic:
where,
p̂
vs
z=
Ha: p1≠ p2 or
Ha: p1> p2 or Ha: p1< p2
pˆ1 − pˆ 2
,
1 1
pˆ (1 − pˆ )( + )
m n
is the “pooled” or combined proportion
pˆ =
x+ y
.
m+n
Under the Ho, the test statistic has standard normal distribution for large
samples.
STEP 3. Critical value? For one-sided test zα, for two-sided zα/2 .
STEP 4. DECISION-critical/rejection region(s) depends on Ha.
Ha: p1 ≠ p2 Reject Ho if |z|> zα/2;
Ha: p1 > p2 Reject Ho if z > zα;
Ha: p1 < p2
Reject Ho if z < - zα.
STEP 5. Answer the question in the problem.
EXAMPLE
A sample of 180 college graduates was surveyed. 100 of them men
and 80 women, and each was asked if they make more or less
than $40,000 per year. The following data was obtained.
≥ $40,000
Men:
60
Women: 30
Total
90
< $40,000
40
50
90
Total
100
80
180
Are men more likely to make more than $40,000 than women? Use
α=0.05.
Soln. Let p1 = true proportion of men making over $40k;
p2 = true proportion of women making over $40k;
EXAMPLE, contd.
STEP1. Ho: p1= p2
pˆ1 =
vs
Ha: p1> p2
60
30
60 + 30
= 0.6, pˆ 2 =
= 0.375, pˆ =
.
100
80
100 + 80
STEP 2. Test statistic:
z=
pˆ1 − pˆ 2
0.6 − 0.375
=
= 3.
1 1
1
1
pˆ (1 − pˆ )( + )
0.5(0.5)(
+ )
m n
100 80
STEP 3. Critical value= zα=z0.05=1.645.
STEP 4. DECISION. z = 3 > 1.645, reject Ho.
STEP 5. Men are more likely than women to make over $40k.
EXAMPLE contd.
Find the p-value for the test
P-value = P(Z>z) = P(Z>3) = 0.0013
Since the p-value is smaller than the significance level, we reject
Ho.
Example: For the sample data listed in the Table below, use a 0.05
significance level to test the claim that the proportion of black
drivers stopped by the police is greater than the proportion of
white drivers who are stopped.
Soln. Let p1 = true proportion of white drivers stopped;
p2 = true proportion of black drivers stopped;
EXAMPLE, contd.
STEP1. Ho: p1= p2
vs
Ha: p1< p2
147
24
147 + 24
= 0.105, pˆ 2 =
= 0.120, pˆ =
= 0.1069.
1400
200
1400 + 200
STEP 2. Test statistic:
pˆ1 =
z=
pˆ1 − pˆ 2
0.105 − 0.120
=
= −0.64.
1 1
1
1
pˆ (1 − pˆ )( + )
0.1069(0.8931)(
)
+
m n
1400 200
STEP 3. Critical value= zα=z0.05= - 1.645.
STEP 4. DECISION. z = -0.64 > -1.645, do not reject Ho.
STEP 5. Black men are not more likely to be stopped than white
men by the police.
EXAMPLE contd.
Find the p-value for the test
P-value = P(Z < z) = P(Z < -0.64) = 0.2611
The p-value =0.2611 > 0.05 (significance level), so we do not reject
Ho.
Independent and dependent samples
Two samples are independent if the sample values selected from one
population are not related to or somehow paired or matched with the
sample values selected from the other population.
Examples: weights of students in different univ., test results of students
in different towns, yields on different fields, etc.
Two samples are dependent (or consist of matched pairs) if the members
of one sample can be used to determine the members of the other
sample.
Examples: Test results for students before and after a study session,
weight of a group of people before and after a weight loss program,
predicted and true max temps for several days in a given month in
Reno, etc.
COMPARING MEANS: INDEPENDENT SAMPLES
1ST sample: x1, x2, …, xm from population with mean µx;
2nd sample: y1, y2, …, yn from population with mean µy;
GOAL: Determine if µx = µy based on the two samples.
Test
Ho: µx = µy
vs
Ha: µx ≠ µy or
Ha: µx > µy or Ha: µx < µy
Procedure depends on what we can assume about variability of the
populations: σx and σy.
CASE1. σx and σy are known.
CASE2. σx and σy are not known, but may be assumed equal σx=σy
CASE3. σx and σy are not known, and can not be assumed equal.
Test statistics are developed for each of the 3 cases.
COMPARING MEANS: INDEPENDENT SAMPLES
CASE 1: σx and σy known
Test on significance level α.
STEP1. Ho: µx = µy
STEP 2. Test statistic:
vs
z=
Ha: µx ≠ µy or
x−y
σ
2
x
m
+
σ
2
y
Ha: µx > µy
.
n
Under the Ho, the test statistic has standard normal distribution.
STEP 3. Critical value? For one-sided test zα, for two-sided zα/2 .
STEP 4. DECISION-critical/rejection region(s) depends on Ha.
Ha: µ ≠ µo Reject Ho if |z|> zα/2;
Ha: µ > µo Reject Ho if z > zα;
Ha: µ < µo
Reject Ho if z < - zα.
STEP 5. Answer the question in the problem.
COMPARING MEANS: INDEPENDENT SAMPLES
CASE 2: σx and σy not known, but assumed equal.
STEP 2. Test statistic:
where
s 2p
x−y
t=
,
1 1
sp
+
m n
is a pooled estimate of the common variance
1
2
2
s =
(
m
−
1)
s
+
(
n
−
1)
s
{
x
y }.
m+n−2
2
p
Under the Ho, the test statistic has t distribution with df = m+n-2.
STEP 3. Critical value? One-sided test tα, two-sided tα/2 .
STEP 4. DECISION-critical/rejection region(s) depends on Ha.
Ha: µ ≠ µo Reject Ho if |t|> tα/2;
Ha: µ > µo Reject Ho if t > tα;
Ha: µ < µo
Reject Ho if t < - tα.
COMPARING MEANS: INDEPENDENT SAMPLES
CASE 3: σx and σy not known, and may not be assumed equal.
STEP 2. Test statistic:
t=
x−y
2
sx2 s y
+
m n
.
Under Ho, the degrees of freedom for the t distribution may be
approximated by df=min(m-1, n-1) (i.e. smaller of m-1 and n-1).
STEP 3. Critical value? One-sided test tα, two-sided tα/2 .
STEP 4. DECISION-critical/rejection region(s) depends on Ha.
Ha: µ ≠ µo Reject Ho if |t|> tα/2;
Ha: µ > µo Reject Ho if t > tα;
Ha: µ < µo
Reject Ho if t < - tα.
EXAMPLE1
A medication for blood pressure was administered to a group of
13 randomly selected patients with elevated blood pressure
while a group of 15 was given a placebo. At the end of 3
months, the following data was obtained on their Systolic
Blood Pressure.
Control group, x: n=15, sample mean = 180, s=50
Treated group, y: m=13, sample mean =150, s=30.
Test if the treatment has been effective. Assume the variances are
the same in both groups and use α=0.01.
Soln. Let µx= mean blood pressure for the control group;
µy= mean blood pressure for the treatment group.
Then, n=15,
= 180, sx=50, m=13, y =150, sy =30. Assumed
equality of variances/st.dev. σx=σy
x
EXAMPLE1 contd.
STEP1. Ho: µx = µy (medicine not effective) vs
Ha: µx > µy (med. effective)
STEP 2. Pooled variance:
s =
2
p
Standard deviation
(m − 1) sx2 + (n − 1) s 2y
m+n−2
(15 − 1)502 + (13 − 1)302
=
= 1761.54.
15 + 13 − 2
s p = s 2p = 1761.54 = 41.97
Test statistic:
x−y
180 − 150
t=
=
= 1.8863.
1 1
1 1
sp
+
41.97
+
15 13
m n
STEP 3. Critical value=t0.01=2.479, df=26.
STEP 4. t=1.8863 not > 2.479, do not reject Ho.
STEP 5. Not enough evidence to conclude that the medicine is effective.
Example 2.
Sample statistics are shown for the distances of the home runs hit
in record-setting seasons by Mark McGwire and Barry Bonds. Use
a 0.05 significance level to test the claim that the distances come
from populations with different means.
McGwire
Bonds
n
70
73
x
418.5
403.7
s
45.5
30.6
Soln. Let µx= mean distance for McGwire;
µy= mean distance for Bonds.
CASE3. σx and σy are not known, and can not be assumed equal.
EXAMPLE2 contd.
STEP1. Ho: µx = µy (same mean distances) vs Ha: µx ≠ µy
(different mean distances)
Test statistic:
t=
x−y
2
y
sx2 s
+
m n
=
418.5 − 403.7
2
45.5 30.6
+
70
73
2
= 2.273.
STEP 3. Critical value= t0.025 = 1.994 , df=69 (min(69, 72)).
STEP 4. t=2.273 > 1.994, reject Ho.
STEP 5. There is enough evidence to conclude that the mean
distances of the home runs for the two players are different.
Independent and dependent samples
Recall:
Two samples are independent if the sample values selected from
one population are not related to or somehow paired or
matched with the sample values selected from the other
population.
Two samples are dependent (or consist of matched pairs) if the
members of one sample can be used to determine the members
of the other sample.
PAIRED t-TEST: comparing dependent samples
Observations come as matched pairs (X,Y).
X and Y are NOT independent, X and Y are dependent.
Examples.
X is score on a test before studying hard; Y is score on the test
after studying hard for the same student;
X is score on a test or in sports before training program, Y
score after training program;
X is weight before weight loss program, Y is weight after the
program;
X and Y are heights of twins or siblings.
PAIRED t-TEST: HYPOTHESES
Hypotheses of interest: does training make a difference?
µx = score before training;
Ho: µx = µy
(no difference)
vs
µy = score after training.
Ha: µx < µy
(score after training is higher)
Data are pairs of observations: (x1, y1), (x2, y2), …, (xn, yn).
Typically, we work with differences: d=X-Y,
phrase hypotheses in terms of differences: µd = true mean difference.
obs
before
after
difference
In terms of differences:
1
x1
y1
d1=x1-y1
Hypotheses
2
x2
y2
d2=x2=y2
e.g. Ho: µd = 0 vs Ha: µd < 0
.
.
.
.
n
xn
yn
dn=xn-yn
Data: d1, d2, …, dn.
PAIRED t-TEST: TEST PROCEDURE
To test Ho, we do one sample t-test. Need sample mean and
standard deviation of d’s:
n
1 n
d = ∑ di and sd2 =
n i =1
Compute the test statistic:
2
(
d
−
d
)
∑ i
i =1
n −1
.
d
t=
.
sd / n
Under Ho the test statistic has t(n-1) distribution.
Make decision in exactly the same way as for the one sample ttest.
PAIRED t-TEST: an example
The amount of lactic acid in the blood was examined for 10 men,
before and after a strenuous exercise, with the results in the
following table.
(a) Test if exercise changes the level of lactic acid in blood. Use
significance level α=0.01.
(b) Find a 95% CI for the mean change in the blood lactose level.
Before
15
16
13
13
17
20
13
16
14
18
After
33
20
30
35
40
37
18
26
21
19
PAIRED t-TEST: lactic acid example contd.
Solution. Take d=“After level” – “before level” of lactic acid.
Data for d: 18, 4, 17, 22, 23, 17, 5, 10, 7, 1. Sample stats:
d = 12.4 and sd2 = 63.156.
STEP1. Ho: µd = 0 vs Ha: µd ≠ 0
d
12.4
STEP 2. Test statistic: t =
=
= 4.93.
sd / n 7.95 / 10
STEP 3. Critical value? df=n-1=9, tα/2 =t0.005=3.25.
STEP 4. DECISION: t = 4.93 > 3.25 = t0.005 , so reject Ho.
STEP 5. There is enough evidence to conclude that exercise
changes lactic acid level.
Example 2: Are Forecast Temperatures Accurate?
The following Table consists of five actual low temperatures and the
corresponding low temperatures that were predicted five days
earlier. Use a 0.05 significance level to test the claim that there is a
difference between the actual low temperatures and the low
temperatures that were forecast five days earlier.
Example 2: contd.
Computed from the data:
d
= –13.2, sd = 10.7, n = 5
µd = mean daily difference between the predicted and the observed
min temperatures.
H0: µd = 0
H1: µd ≠ 0
Step 2. Test statistic:
d
−13.2
t=
=
= −2.759.
sd / n 10.7 / 5
STEP 3. Critical value? df=n-1=4, tα/2 =t0.025=2.776.
STEP 4. DECISION: t = -2.759 > -2.776 , so do not reject Ho.
STEP 5. There is no significant difference between the mean predicted
and observed min daily temperatures.