Lecture 10 - University of Pennsylvania

Download Report

Transcript Lecture 10 - University of Pennsylvania

Lecture 10
• Inference about the difference between
population proportions (Chapter 13.6)
• One-way analysis of variance (Chapter
15.2)
Testing p1 – p2
• There are two cases to consider:
Case 1:
H0: p1-p2 =0
Calculate the pooled proportion
pˆ 
Then
Case 2:
H0: p1-p2 =D (D is not equal to 0)
Do not pool the data
x1  x 2
n1  n 2
(pˆ 1  pˆ 2 )  (p1  p 2 )
Z
1
1
ˆp(1  pˆ )(  )
n1 n2
pˆ 1 
Then
Z
x1
n1
pˆ 2 
x2
n2
(pˆ 1  pˆ 2 )  D
pˆ 1 (1  pˆ 1 ) pˆ 2 (1  pˆ 2 )

n1
n2
Testing p1 – p2
• Example 13.9 (Revisit Example 13.8)
– Management needs to decide which of two new
packaging designs to adopt, to help improve sales
of a certain soap.
– A study is performed in two supermarkets:
– For the brightly-colored design to be financially
viable it has to outsell the simple design by at
least 3%.
Testing p1 – p2 (Case 2)
• Solution
– The hypotheses to test are
H0: p1 - p2 = .03
H1: p1 - p2 > .03
– We identify this application as case 2 (the
hypothesized difference is not equal to zero).
Testing p1 – p2 (Case 2)
• Compute: Manually
Z 

( pˆ 1  pˆ 2 )  D
pˆ 1 (1  pˆ 1 ) pˆ 2 (1  pˆ 2 )

n1
n2
 180   155 
  .03

  
 904   1,038 
 1 .15
.1991 (1  .1991 ) .1493 (1  .1493 )

904
1,038
The rejection region is z > za = z.05 = 1.645.
Conclusion: Since 1.15 < 1.645 do not reject the null hypothesis.
There is insufficient evidence to infer that the brightly-colored
design will outsell the simple design by 3% or more.
Confidence Interval for p1  p2
•
•
(1  a ) 100%
( pˆ1  pˆ 2 )  za / 2
confidence interval :
pˆ1 (1  pˆ1 ) pˆ 2 (1  pˆ 2 )

n1
n2
Estimating p1 – p2
• Estimating the cost of life saved
– Two drugs are used to treat heart attack victims:
• Streptokinase (available since 1959, costs $460)
• t-PA (genetically engineered, costs $2900).
– The maker of t-PA claims that its drug outperforms
Streptokinase.
– An experiment was conducted in 15 countries.
• 20,500 patients were given t-PA
• 20,500 patients were given Streptokinase
• The number of deaths by heart attacks was recorded.
Estimating p1 – p2
• Experiment results
– A total of 1497 patients treated with
Streptokinase died.
– A total of 1292 patients treated with t-PA died.
• Estimate the cost per life saved by using t-PA
instead of Streptokinase.
Estimating p1 – p2
• Interpretation
– We estimate that between .51% and 1.49%
more heart attack victims will survive because
of the use of t-PA.
– The difference in cost per life saved is
2900-460= $2440.
– The cost per life saved by switching to t-PA is
estimated to be between 2440/.0149 = $163,758
and 2440/.0051 = $478,431
15.2 One-way ANOVA
• Analysis of variance compares two or more
populations of interval data.
• Specifically, we are interested in determining
whether differences exist between the population
means.
• We obtain independent samples from each
population.
• Generalization of two sample problem to two or
more populations
Examples
• Compare the effect of three different
teaching methods on test scores.
• Compare the effect of four different
therapies on how long a cancer patient lives.
• Compare the effect of using different
amounts of fertilizer on the yield of a crop.
• Compare the amount of time that ten
different tire brands last.
One Way Analysis of Variance
• Example 15.1
– An apple juice manufacturer is planning to develop
a new product -a liquid concentrate.
– The marketing manager has to decide how to market
the new product.
– Three strategies are considered
• Emphasize convenience of using the product.
• Emphasize the quality of the product.
• Emphasize the product’s low price.
One Way Analysis of Variance
• Example 15.1 - continued
– An experiment was conducted as follows:
• In three cities an advertisement campaign was launched .
• In each city only one of the three characteristics (convenience,
quality, and price) was emphasized.
• The weekly sales were recorded for twenty weeks following
the beginning of the campaigns.
One Way Analysis of Variance
Convnce
Weekly
sales
529
658
793
514
663
719
711
606
461
Weekly
529
sales
498
663
604
495
485
557
353
557
542
614
Quality
Price
804
630
774
717
679
604
620
697
706
615
492
719
787
699
572
Weekly
523
584
sales
634
580
624
672
531
443
596
602
502
659
689
675
512
691
733
698
776
561
572
469
581
679
532
See file
Xm15 -01
One Way Analysis of Variance
• Solution
– The data are interval.
– The problem objective is to compare sales in
three cities.
– We hypothesize that the three population means
are equal.
Defining the Hypotheses
• Solution
H0: m1 = m2= m3
H1: At least two means differ
To build the statistic needed to test the
hypotheses use the following notation:
Notation
Independent samples are drawn from k populations (treatments).
First observation,
first sample
Second observation,
second sample
1
2
k
X11
x21
.
.
.
Xn1,1
X12
x22
.
.
.
Xn2,2
X1k
x2k
.
.
.
Xnk,k
n2
nk
x2
xk
n1
x1
Sample size
Sample mean
X is the “response variable”.
The variables’ value are called “responses”.
Terminology
• In the context of this problem…
Response variable – weekly sales
Responses – actual sale values
Experimental unit – weeks in the three cities when we
record sales figures.
Factor – the criterion by which we classify the
populations (the treatments). In this problems the factor
is the marketing strategy.
Factor levels – the population (treatment) names. In
this problem factor levels are the marketing strategies.
Rationale Behind Test Statistic
• Two types of variability are employed when
testing for the equality of population means
– Variability of the sample means
– Variability within samples
• Test statistic is essentially (Variability of the
sample means)/(Variability within samples)
The rationale behind the test statistic – I
• If the null hypothesis is true, we would
expect all the sample means to be close to
one another (and as a result, close to the
grand mean).
• If the alternative hypothesis is true, at least
some of the sample means would differ.
• Thus, we measure variability between
sample means.
Variability between sample means
• The variability between the sample means is
measured as the sum of squared distances
between each mean and the grand mean.
This sum is called the
Sum of Squares for Treatments
SST
In our example treatments are
represented by the different
advertising strategies.
Sum of squares for treatments (SST)
k
SST   n j ( x j  x)
2
j 1
There are k treatments
The size of sample j
The mean of sample j
Note: When the sample means are close to
one another, their distance from the grand
mean is small, leading to a small SST. Thus,
large SST indicates large variation between
sample means, which supports H1.
Sum of squares for treatments (SST)
• Solution – continued
Calculate SST
x1  577.55 x 2  653.00 x 3  608.65
k
SST   n j ( x j  x) 2
j 1
The grand mean is calculated by
n1x1  n2 x 2  ... nk x k
X
n1  n2  ... nk
= 20(577.55 - 613.07)2 +
+ 20(653.00 - 613.07)2 +
+ 20(608.65 - 613.07)2 =
= 57,512.23
Sum of squares for treatments (SST)
Is SST = 57,512.23 large enough to
reject H0 in favor of H1?
Large compared to what?
30
25
x 3  20
20
x 2  15
16
15
14
11
10
9
x 3  20
20
19
x 2  15
x1  10
12
10
9
x1  10
7
A small variability within
the samples makes it easier
Treatment 1 Treatment 2 Treatment 3
to draw a conclusion about the
population means.
The
1 sample means are the same as before,
but the larger within-sample variability
Treatment 1
Treatment 2 Treatment 3
makes it harder to draw a conclusion
about the population means.
The rationale behind test statistic – II
• Large variability within the samples
weakens the “ability” of the sample means
to represent their corresponding population
means.
• Therefore, even though sample means may
markedly differ from one another, SST must
be judged relative to the “within samples
variability”.
Within samples variability
• The variability within samples is measured
by adding all the squared distances between
observations and their sample means.
This sum is called the
Sum of Squares for Error
SSE
In our example this is the
sum of all squared differences
between sales in city j and the
sample mean of city j (over all
the three cities).
Sum of squares for errors (SSE)
• Solution – continued
Calculate SSE
s12  10,775.00 s22  7,238,11 s32  8,670.24
k
SSE 
nj

(xij  x j ) 2 (n1 - 1)s12 + (n2 -1)s22 + (n3 -1)s32
j 1 i 1
= (20 -1)10,774.44 + (20 -1)7,238.61+ (20-1)8,670.24
= 506,983.50
Sum of squares for errors (SSE)
Is SST = 57,512.23 large enough
relative to SSE = 506,983.50 to
reject the null hypothesis that
specifies that all the means are
equal?
The mean sum of squares
To perform the test we need to calculate
the mean squares as follows:
Calculation of MST Mean Square for Treatments
SST
k 1
57,512.23

3 1
 28,756.12
MST 
Calculation of MSE
Mean Square for Error
SSE
nk
509,983.50

60  3
 8,894.45
MSE 
Calculation of the test statistic
Required Conditions:
1. The populations tested
are normally distributed.
2. The variances of all the
populations tested are
equal.
MST
F
MSE
28,756.12

8,894.45
 3.23
with the following degrees of freedom:
v1=k -1 and v2=n-k
The F test rejection region
And finally the hypothesis test:
H0: m1 = m2 = …=mk
H1: At least two means differ
MST
Test statistic: F
MSE
R.R: F>Fa,k-1,n-k
The F test
MST
MSE
28,756.12

8,894.17
 3.23
F
Ho: m1 = m2= m3
H1: At least two means differ
Test statistic F= MST/ MSE= 3.23
R.R. : F  Fak 1nk  F0.05,31,603  3.15
Since 3.23 > 3.15, there is sufficient evidence
to reject Ho in favor of H1, and argue that at least one
of the mean sales is different than the others.