Download Chapter 19: Two-Factor Studies with Equal Sample Size

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

Data assimilation wikipedia , lookup

Choice modelling wikipedia , lookup

Coefficient of determination wikipedia , lookup

Transcript
Chapter 19: Two-Factor Studies with Equal
Sample Size
Lecture 12
March 29, 2007
Psych 791
Slide 1 of 33
Seen Previously
■
Tuesday we learned about all that great terminology and all
those wonderful Greek letters.
■
As a review:
Overview
● Previous Class
● Today’s Class
● Today’s Example
Cell Means Model
◆
αi is the effect of Factor A.
◆
βj is the effect of Factor B.
◆
(αβ)ij is the interaction effect of Factors A and B.
Factor Effects Model
Fitting The Model
Testing Effects
Wrapping Up
Slide 2 of 33
Today’s Class
■
Overview
Hopefully, by the end of this class, you will know:
◆
The formula for a 2-way ANOVA using the Cell Means
model.
◆
The formula for a 2-way ANOVA using the Factor Effect
model.
◆
The relationship between the two models.
◆
How to formulate both the model and design matrix for a
2-way ANOVA using the Factor Effects model.
◆
And, most important, how to test for both main effects and
interaction effects.
● Previous Class
● Today’s Class
● Today’s Example
Cell Means Model
Factor Effects Model
Fitting The Model
Testing Effects
Wrapping Up
Slide 3 of 33
Today’s Example
■
Overview
● Previous Class
● Today’s Class
● Today’s Example
Cell Means Model
Factor Effects Model
Fitting The Model
Testing Effects
Wrapping Up
From Street and Carroll (1972):
In testing food products for palatability, General Foods
employed a 7-point scale from -3 (terrible to +3
(excellent) with 0 representing "average". Their
standard method for testing palatability was to conduct
a taste test with 50 persons - 25 men and 25 women.
The experiment reported here involved the effects on
palatability of a course versus fine screen and of a low
versus high concentration of a liquid component. Four
groups of 50 consumers each were recruited from local
churches and club groups. Persons were assigned
randomly to the four treatment groups as they were
recruited. The experiment was replicated four times, so
that there were 16 groups of 50 consumers each in the
entire experiment
Slide 4 of 33
Today’s Example Data
Score
Liquid
Screen
35
0
0
39
0
0
77
0
0
● Today’s Example
16
0
0
Cell Means Model
104
1
0
Factor Effects Model
129
1
0
Fitting The Model
97
1
0
Testing Effects
84
1
0
Wrapping Up
24
0
1
21
0
1
39
0
1
60
0
1
65
1
1
94
1
1
86
1
1
64
1
1
Overview
● Previous Class
● Today’s Class
Slide 5 of 33
Cell Means Model
Slide 6 of 33
Cell Means Model
■
Our ANOVA model can now be stated as follows:
Overview
Yijk = µij + εijk
Cell Means Model
● Matrix Version
● Additional Comments
■
where:
■
µij are the parameters: treatment means.
■
εijk are independent N (0, σ 2 ).
■
i = 1,...,a;
■
j = 1,...,b;
■
k = 1,...,n.
Factor Effects Model
Fitting The Model
Testing Effects
Wrapping Up
Slide 7 of 33
Representation in Matrix Formula
■
Using our example’s 2X2 design:
Overview
Cell Means Model
● Matrix Version
● Additional Comments
Factor Effects Model
Fitting The Model
Testing Effects
Wrapping Up
Slide 8 of 33
Additional Comments
■
While this representation is easy to do, it isn’t particularly
interesting.
■
All you are recovering is the treatment level means.
■
Testing main effects would require you to perform contrasts
on the cell means.
■
Seems like it is back tracking.
■
We want to parameterize the model is such a way that it is
easy to test to main effects.
■
Oh, and we don’t want to abandon those nice little αs and βs
that we talked about on Tuesday.
Overview
Cell Means Model
● Matrix Version
● Additional Comments
Factor Effects Model
Fitting The Model
Testing Effects
Wrapping Up
Slide 9 of 33
Factor Effects Model
Slide 10 of 33
Cell Means Model Alteration
■
We are going to take the cell means model, and put it in a
format that is more intuitive for our analysis.
■
To do this, we will replace each treatment mean:
Overview
Cell Means Model
Factor Effects Model
● Matrix Formula
µij
Fitting The Model
Testing Effects
Wrapping Up
■
with this:
µij = µ·· + αi + βj + (αβ)ij
■
This will make the model...
Slide 11 of 33
Factor Effects Model
■
With our substitution:
Overview
Yijk = µ·· + αi + βj + (αβ)ij + εijk
Cell Means Model
Factor Effects Model
● Matrix Formula
■
µ·· is a constant (the grand mean).
■
εijk are independent N (0, σ 2 ).
P
αi constant with
αi = 0.
P
βj constant with βj = 0.
P
P
i (αβ)ij = 0 and
j (αβ)ij = 0.
Fitting The Model
Testing Effects
Wrapping Up
■
■
■
■
P P
i
j (αβ)ij
= 0.
Slide 12 of 33
Matrix Formula
■
Overview
Cell Means Model
Factor Effects Model
● Matrix Formula
Fitting The Model
Testing Effects
Wrapping Up
Slide 13 of 33
Fitting The Model
Slide 14 of 33
Fitting the Model
■
Basically take every formula that we talked about up to now,
and replace the µ’s with Y.
■
In condensed form, the estimated model is:
Overview
Cell Means Model
Factor Effects Model
Fitting The Model
Ybijk = Ȳ··· + (Ȳi·· − Ȳ··· ) + (Ȳ·j· − Ȳ··· ) + (Ȳij· − Ȳi·· − Ȳ·j· + Ȳ··· )
● Sum of Squares
● Partitions
● Decomposition
● Example
● Degrees of Freedom
● Partitioning DF
■
With residuals being:
● Mean Squares
Testing Effects
Wrapping Up
eijk = Yijk − Ȳij·
Slide 15 of 33
In SAS...
Overview
Cell Means Model
Factor Effects Model
proc glm data=palate;
class liquid screen;
model score=liquid|screen/solution;
lsmeans liquid|screen;
run;
Fitting The Model
● Sum of Squares
● Partitions
● Decomposition
● Example
● Degrees of Freedom
● Partitioning DF
● Mean Squares
Testing Effects
Wrapping Up
Slide 16 of 33
Sum of Squares
Overview
■
We are doing ANOVA, so will be analyzing some variances.
■
We are going to take our total sum of squares and do some
partitioning:
Cell Means Model
Factor Effects Model
XXX
Fitting The Model
i
● Sum of Squares
j
k
2
(Yijk − Ȳ··· ) = n
XX
XXX
2
2
(Ȳij· − Ȳ··· ) +
(Yijk − Ȳij· )
i
j
i
j
k
● Partitions
● Decomposition
● Example
● Degrees of Freedom
● Partitioning DF
■
The shortened form is this:
● Mean Squares
Testing Effects
SST O = SST R + SSE
Wrapping Up
Slide 17 of 33
Partitioning of Treatment SS
■
Since we have more than one effect, we need to partition our
sum of squares.
■
Remember when we did all the great partitioning in multiple
regression, well, all this partitioning will be done for us.
■
Here is the long formula:
Overview
Cell Means Model
Factor Effects Model
Fitting The Model
● Sum of Squares
● Partitions
● Decomposition
● Example
n
● Degrees of Freedom
● Partitioning DF
XX
X
X
XX
2
2
2
2
(Ȳij· −Ȳ··· ) = nb
(Ȳi·· −Ȳ··· ) +na
(Ȳ·j· −Ȳ··· ) +n
(Ȳij· −Ȳi·· −Ȳ·j· +Ȳ··· )
i j
i
j
i j
● Mean Squares
Testing Effects
Wrapping Up
■
And the short formula is this:
SST R = SSA + SSB + SSAB
Slide 18 of 33
Decomposition
■
So now, I will spare you the long formula and get right to the
short formula.
■
Our total error variance is going to be partitioned in this way:
Overview
Cell Means Model
Factor Effects Model
SST O = SSA + SSB + SSAB + SSE
Fitting The Model
● Sum of Squares
● Partitions
● Decomposition
● Example
● Degrees of Freedom
■
Just like in regression, we want to see how much variance is
attributed to which effect.
■
The larger the variability (or larger the partition), the more of
an effect there is.
● Partitioning DF
● Mean Squares
Testing Effects
Wrapping Up
Slide 19 of 33
SAS Example
The GLM Procedure
Dependent Variable: score
Source
Model
Error
Corrected Total
DF
3
12
15
R-Square
0.720813
Source
liquid
screen
liquid*screen
Sum of
Squares
12053.25000
4668.50000
16721.75000
Coeff Var
30.52091
DF
1
1
1
Mean Square
4017.75000
389.04167
Root MSE
19.72414
Type III SS
10609.00000
1024.00000
420.25000
F Value
10.33
Pr > F
0.0012
F Value
27.27
2.63
1.08
Pr > F
0.0002
0.1307
0.3191
score Mean
64.62500
Mean Square
10609.00000
1024.00000
420.25000
Slide 20 of 33
Degrees of Freedom
■
As you remember from all ANOVA tables, there are degrees of freedom
associated with each effect.
■
We need to break up our total degrees of freedom we have in our data (total
subjects - 1) into it’s particular parts.
■
You will notice that the title of the chapter is "Two-Factor Studies with Equal
Sample Sizes".
■
This idea of equal sample sizes refers to the number of subjects in each
treatment group.
■
There is an equal number in each treatment group.
■
We are going to refer to the number of subjects in each treatment group as n.
■
Therefore, our total sample size is nT = a × b × n.
Slide 21 of 33
Partitioning DF
Overview
■
Our partitioning of our Degrees of Freedom will be as follows:
■
Factor A: a − 1
■
Factor B: b − 1
■
AB Int: (a − 1)(b − 1)
■
error: ab(n − 1)
■
Total: abn − 1
Cell Means Model
Factor Effects Model
Fitting The Model
● Sum of Squares
● Partitions
● Decomposition
● Example
● Degrees of Freedom
● Partitioning DF
● Mean Squares
Testing Effects
Wrapping Up
Slide 22 of 33
Mean Squares
Overview
■
Do you remember how to get a mean square?
■
Take the Sum of Squares and Divide by your Degrees of
Freedom:
Cell Means Model
Factor Effects Model
SS/df
Fitting The Model
● Sum of Squares
● Partitions
● Decomposition
● Example
● Degrees of Freedom
■
So:
● Partitioning DF
● Mean Squares
Testing Effects
Wrapping Up
M SA = SSA/(a − 1)
M SB = SSB/(b − 1)
M SAB = SSAB/(a − 1)(b − 1)
M SE = SSE/ab(n − 1)
Slide 23 of 33
Testing Effects
Slide 24 of 33
Testing for Effects
Overview
■
Hypothesis tests should all look familiar.
■
To test effects, you are going to basically test for a significant
amount of variance in the effect.
■
How do you do this?
■
Going to be an F-test.
Cell Means Model
Factor Effects Model
Fitting The Model
Testing Effects
● Testing for Main Effect of A
● Testing for Main Effect of B
● Testing for Interaction Effect
of A × B
Wrapping Up
Slide 25 of 33
Testing for Main Effect of A
■
Null Hypothesis:
Overview
H0 : α1 = α2 = . . . = αa = 0
Cell Means Model
Factor Effects Model
Ha : not all αi = 0
Fitting The Model
Testing Effects
● Testing for Main Effect of A
● Testing for Main Effect of B
● Testing for Interaction Effect
of A × B
■
or alternatively:
H0 : µ1· = µ2· = . . . = µa·
Wrapping Up
Ha : not all µi· equal
■
To test:
M SA
F (a − 1, ab(n − 1)) =
M SE
Slide 26 of 33
SAS Example
The GLM Procedure
Dependent Variable: score
Source
Model
Error
Corrected Total
DF
3
12
15
R-Square
0.720813
Source
liquid
screen
liquid*screen
Sum of
Squares
12053.25000
4668.50000
16721.75000
Coeff Var
30.52091
DF
1
1
1
Mean Square
4017.75000
389.04167
Root MSE
19.72414
Type III SS
10609.00000
1024.00000
420.25000
F Value
10.33
Pr > F
0.0012
F Value
27.27
2.63
1.08
Pr > F
0.0002
0.1307
0.3191
score Mean
64.62500
Mean Square
10609.00000
1024.00000
420.25000
Slide 27 of 33
Testing for Main Effect of B
■
Null Hypothesis:
Overview
H0 : β1 = β2 = . . . = βb = 0
Cell Means Model
Factor Effects Model
Ha : not all βj = 0
Fitting The Model
Testing Effects
● Testing for Main Effect of A
● Testing for Main Effect of B
● Testing for Interaction Effect
of A × B
■
or alternatively:
H0 : µ·1 = µ·2 = . . . = µ·b
Wrapping Up
Ha : not all µ·j equal
■
To test:
M SB
F (b − 1, ab(n − 1)) =
M SE
Slide 28 of 33
SAS Example
The GLM Procedure
Dependent Variable: score
Source
Model
Error
Corrected Total
DF
3
12
15
R-Square
0.720813
Source
liquid
screen
liquid*screen
Sum of
Squares
12053.25000
4668.50000
16721.75000
Coeff Var
30.52091
DF
1
1
1
Mean Square
4017.75000
389.04167
Root MSE
19.72414
Type III SS
10609.00000
1024.00000
420.25000
F Value
10.33
Pr > F
0.0012
F Value
27.27
2.63
1.08
Pr > F
0.0002
0.1307
0.3191
score Mean
64.62500
Mean Square
10609.00000
1024.00000
420.25000
Slide 29 of 33
Testing for Interaction Effect of A × B
■
Null Hypothesis:
Overview
H0 : all (αβ)ij = 0
Cell Means Model
Factor Effects Model
Ha : not all (αβ)ij = 0
Fitting The Model
Testing Effects
● Testing for Main Effect of A
● Testing for Main Effect of B
● Testing for Interaction Effect
of A × B
■
or alternatively:
H0 : all µij equal
Wrapping Up
Ha : not all µij equal
■
To test:
F ((a − 1)(b − 1), ab(n − 1)) =
M SAB
M SE
Slide 30 of 33
SAS Example
The GLM Procedure
Dependent Variable: score
Source
Model
Error
Corrected Total
DF
3
12
15
R-Square
0.720813
Source
liquid
screen
liquid*screen
Sum of
Squares
12053.25000
4668.50000
16721.75000
Coeff Var
30.52091
DF
1
1
1
Mean Square
4017.75000
389.04167
Root MSE
19.72414
Type III SS
10609.00000
1024.00000
420.25000
F Value
10.33
Pr > F
0.0012
F Value
27.27
2.63
1.08
Pr > F
0.0002
0.1307
0.3191
score Mean
64.62500
Mean Square
10609.00000
1024.00000
420.25000
Slide 31 of 33
Final Thought
■
We saw today how
interaction terms are
parameterized.
■
We also so how such terms
are placed in the GLM
context with matrix forms.
■
Interactions are straightforward extensions of the modeling
framework you already know (see your notes on higher order
models from last semester).
■
Interpretation of interactions is less straightforward.
Overview
Cell Means Model
Factor Effects Model
Fitting The Model
Testing Effects
Wrapping Up
● Final Thought
● Next Class
Slide 32 of 33
Next Time
■
On Tuesday we will finish up the chapter by talking about
what to do when effects are significant
■
Then, we will also have a data analysis example to reiterate
everything we have talked about
Overview
Cell Means Model
Factor Effects Model
Fitting The Model
Testing Effects
Wrapping Up
● Final Thought
● Next Class
Slide 33 of 33