Lab 4 ANCOVA and Two-Way ANOVA_SR_rev
docx
keyboard_arrow_up
School
University of Alberta *
*We aren’t endorsed by this school
Course
505
Subject
Statistics
Date
Apr 3, 2024
Type
docx
Pages
13
Uploaded by ChiefRhinoceros2142
1
1.
Submit answers to the Google form by 11:20a.m. on Mar. 17, 2022:
https://forms.gle/mrotGVoHofCtGHpU8
LAB 4 ANCOVA and Two-Way ANOVA
Review
ANCOVAmodel
:
y
ij
=
μ
+
α
i
+
b x
ij
+
ϵ
ij
.
Represented using regression, the model is:
y
=
θ
0
+
θ
1
d
1
+
⋯
+
θ
a
−
1
d
a
−
1
+
θ
k
x
+
ϵ
1
.
In the regression model, the intercept, θ
0
, costs 1 degree of freedom. The covariate, x, costs 1 degree of
freedom to estimate θ
k
. Factor A costs a-1 degree of freedom. This is because if there are “a” groups, there will be a-1 dummy codes. Consequently, we need to estimate a-1 regression coefficients for factor
A, and the degree of freedom for factor A is a-1. Finally, the degree freedom for error, ϵ
, is N-1-(a-1)-1= N-a-1.
For sum of squares, it is easy to calculate the sum of squares of regression residual (variance of the residual *(N-1)), which equals to the within group sum of squares. To calculate sum of squares for Factor A, the most intuitive way is to first estimate the residual sum of squares for this regression:
y
=
γ
0
+
γ
1
x
+
ϵ
2
.
Then, SS
A
=
SS
ϵ
2
−
SS
ϵ
1
.
This is the intuitive way to calculate sum of squares, it is mathematically equivalent to the formula you learned during the lecture. Type 3 sum of squares is also calculated in a similar way.
The two-way ANOVA model is:
Two way ANOVA model
:
y
ij
=
μ
+
α
+
β
+
αβ
+
ε .
In regression terms, suppose factor A has 3 groups and factor B has 3 groups, the model looks like:
y
=
c
0
+
c
1
da
1
+
c
2
da
2
+
c
3
db
1
+
c
4
db
2
+
c
5
da
1
db
1
+
c
6
da
1
db
2
+
c
7
da
2
db
1
+
c
8
da
2
db
2
+
ε .
For degree of freedom, the intercept, c
0
, costs 1 degree of freedom. Factor A costs 3-1=2 degree of freedom to estimate c
1
and c
2
. Similarly, factor B costs 2 degree of freedom to estimate c
3
and c
4
. The interaction costs 2*2=4 degree of freedom. The error costs N-1-2-2-4 degree of freedoms. More generally, Factor A costs a-1 df, Factor B costs b-1 df, interaction costs (a-1)(b-1) df, residual costs N-1-
(a-1)-(b-1)-(a-1)(b-1)=N-1-a+1-b+1-ab+a+b-1=N-ab.
Sum of squares for factor A, B and interaction can be calculated in a similar way like in ANCOVA.
2
ANCOVA Exercise A researcher was interested in studying the effect of a drug on dementia patients’ memory. Thirty participants were randomly assigned to three groups: placebo, low dose, and high dose. Participants’ memory was measured using a memory test that scored from 0 to 10. The test was administered before and after the drug treatment. The data is presented in ‘
ANCOVA data.sav
’.
Using what you have learned in the previous lab, conduct an ANOVA test with dose as the independent variable, and pre memory score as the dependent variable. A.
Report the results. Does dose have a significant effect on pre memory score?
F(2,27)=1.979m p=.158. No pre-memory score is not significant
Conduct another ANOVA with dose as the independent variable, and post memory score as the dependent variable, report the results. B.
Does dose have a significant effect on post memory score? What can you conclude? F(2,27)=2.416, p=.108. No, also not significant (p> .05)
C.
Why is this approach problematic?
Because now it seems both the pre-test and post- test do not have a significant relationship with the independent variable, dosage
Now, conduct an ANCOVA test by clicking Analyze -> General Linear Model -> Univariate,
put post_score into the dependent variable box, put dose in the fixed factor(s) box, and put pre_score into the Covariate(s) box, click EM Means, put dose to the “Display Means for” box, check compare main effects, select LSD(none), Continue, Options, check Descriptive statistics, parameter estimates, Homogeneity tests, Continue, OK.
[PASTE Levene’s Test of Equality of Error Variances here]
D.
Based on the Levene’s test, is the homogeneity of variance assumption satisfied?
3
No
E.
If not, should you be concerned? Why(not)?
No, because the error variances differ between the groups
Tests of Between-Subjects Effects
Dependent Variable: post_score Source
Type III Sum of
Squares
df
Mean Square
F
Sig.
Corrected Model
31.920
a
3
10.640
3.500
.030
Intercept
76.069
1
76.069
25.020
.000
pre_score
15.076
1
15.076
4.959
.035
Dose
25.185
2
12.593
4.142
.027
Error
79.047
26
3.040
Total
683.000
30
Corrected Total
110.967
29
a. R Squared = .288 (Adjusted R Squared = .205)
F.
Does dose have a significant effect on post_score after controlling for pre_score? Report the statistics.
yes, because p > .05. F(2,30)=4.142, p=.027
Pairwise Comparisons
Dependent Variable: post_score (I) Dose
(J) Dose
Mean Difference
(I-J)
Std. Error
Sig.
b
95% Confidence Interval for
Difference
b
Lower Bound
Upper Bound
Placebo
Low Dose
-1.786
*
.849
.045
-3.532
-.040
High Dose
-2.225
*
.803
.010
-3.875
-.575
Low Dose
Placebo
1.786
*
.849
.045
.040
3.532
High Dose
-.439
.811
.593
-2.107
1.228
High Dose
Placebo
2.225
*
.803
.010
.575
3.875
Low Dose
.439
.811
.593
-1.228
2.107
Based on estimated marginal means
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
- Access to all documents
- Unlimited textbook solutions
- 24/7 expert homework help
4
*. The mean difference is significant at the .05 level.
b. Adjustment for multiple comparisons: Least Significant Difference (equivalent to no adjustments).
G.
Based on pairwise comparisons
, which groups are significantly different?
Placebo & Low Dose, Placebo & High Dose
ANCOVA also assumes Homogeneity of regression, which suggests that the regression slope between covariate and dependent variables are the same across groups. To check this assumption, click analyze, general linear model, Univariate. Since we just conducted an ANCOVA, we can keep the rest of the settings, click Model, Build custom terms, move/drag dose and pre_score to the model box, then use the down arrow to move Dose into Build Term, click By *, select pre_score under Factors & Covariates, move pre_score into Build Term, and move them both together to the model box by clicking “Add.” This will create the interaction term
. Continue, OK.
(*Hint: See screenshots on the next page.)
5
Tests of Between-Subjects Effects
Dependent Variable: post_score Source
Type III Sum of
Squares
df
Mean Square
F
Sig.
Corrected Model
52.346
a
5
10.469
4.286
.006
Intercept
53.542
1
53.542
21.921
.000
Dose
36.558
2
18.279
7.484
.003
pre_score
17.182
1
17.182
7.035
.014
Dose * pre_score
20.427
2
10.213
4.181
.028
Error
58.621
24
2.443
Total
683.000
30
Corrected Total
110.967
29
a. R Squared = .472 (Adjusted R Squared = .362)
If there is a significant interaction between dose and pre_score, it suggests that the assumption of homogeneity of regression is violated. H.
Report the results.
6
F(2,30)=4.181, p=.028
What do you do if the assumption of homogeneity of regression is violated? (You have learned a test to deal with this situation in an earlier lab).
I.
Which test can be used to interpret the interaction?
Brown-Forsythe
Create two dummy code variables, d1 (d1=1 if dose==1, else d1=0) and d2 (d2=1 if dose==2, else d2=0) to represent dose. (These steps are for illustrative purposes only. The dummy code variables have already been created.) Conduct a linear regression equivalent to the ANCOVA (Analyze > Regression > Linear), with post_score as the dependent variable and pre_score in the first block [click “Next” to get to
Block 2 of 2], and d1 and d2 in the second block.
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
- Access to all documents
- Unlimited textbook solutions
- 24/7 expert homework help
7
8
ANOVA
a
Model
Sum of Squares
df
Mean Square
F
Sig.
1
Regression
6.734
1
6.734
1.809
.189
b
Residual
104.232
28
3.723
Total
110.967
29
2
Regression
31.920
3
10.640
3.500
.030
c
Residual
79.047
26
3.040
Total
110.967
29
a. Dependent Variable: post_score
b. Predictors: (Constant), pre_score
c. Predictors: (Constant), pre_score, d2, d1
J.
What are the sum of squares residuals for model 1 and model 2? What is their difference? What
does it equal/represent in the ANCOVA model? Model 1: R2=104.232, F(1,29)=1.809, p=.189. Model 2: 79.047, F(3,29)=3.500, p=.030. Difference = 25.185.
9
Compare the Coefficients table from regression with the Parameter estimates table from ANCOVA.
K.
Were they the same or different?
Different
Parameter Estimates
Dependent Variable: post_score Paramet
er
B
Std.
Error
t
Sig.
95% Confidence
Interval
Lower
Bound
Upper
Bound
Intercept
4.014
.611
6.568
<.001
2.758
5.270
[Dose=1]
-2.225
.803
-2.771
.010
-3.875
-.575
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
- Access to all documents
- Unlimited textbook solutions
- 24/7 expert homework help
10
[Dose=2]
-.439
.811
-.541
.593
-2.107
1.228
[Dose=3]
0
a
.
.
.
.
.
pre_scor
e
.416
.187
2.227
.035
.032
.800
a. This parameter is set to zero because it is redundant.
Two-Way ANOVA Exercise
An anthropologist was interested in the effects of alcohol on mate selection at nightclubs. Her rationale was that after alcohol had been consumed, subjective perceptions of physical attractiveness would become more inaccurate (the well-known ‘beer-goggles effect’). She was also interested in whether this effect was different for men and women. She picked 48 students: 24 male and 24 female. She then took groups of eight participants to a night-club and gave them no alcohol (participants received placebo drinks of alcoholfree lager), 2 pints of strong lager, or 4 pints of strong lager. At the end of the evening she took a photograph of the person that the participant was chatting up. She then got a pool of independent judges to assess the attractiveness of the person in each photograph (out of 100). The data are in Table 12.1 and Goggles.sav
To conduct Factorial ANOVA, click Analyze, general linear model, univariate, put attractiveness into the dependent variable box, put gender and alcohol into the fixed factor box, click plots, move gender to the
separate lines box, move alcohol to the horizontal axis box, add, continue, click EM Means, move all variables to the display means for box, check compare main effects, Continue, Options, check descriptive
statistics, estimates of effect size, parameter estimates, and homogeneity tests box, continue, Paste. In the syntax window, after the line /EMMEANS=TABLES(Gender*Alcohol), paste COMPARE(Gender) ADJ(LSD) as shown below. The file should look like this:
UNIANOVA Attractiveness BY Gender Alcohol
/METHOD=SSTYPE(3)
/INTERCEPT=INCLUDE
/PLOT=PROFILE(Alcohol*Gender)
/EMMEANS=TABLES(Gender) COMPARE ADJ(LSD)
/EMMEANS=TABLES(Alcohol) COMPARE ADJ(LSD)
/EMMEANS=TABLES(Gender*Alcohol) COMPARE(Gender) ADJ(LSD)
/PRINT=ETASQ DESCRIPTIVE PARAMETER HOMOGENEITY
/CRITERIA=ALPHA(.05)
/DESIGN=Gender Alcohol Gender*Alcohol.
11
This modification will allow SPSS to do post hoc comparison for interaction by gender. Select (highlight with your mouse) all the above syntax. Click the green triangle icon to run the syntax.
Assume that Levene’s test is not significant, F(5,42)=1.527, p=.202, so the assumption of homogeneity of variance was not violated.
Tests of Between-Subjects Effects
Dependent Variable: Attractiveness of Date Source
Type III Sum of
Squares
df
Mean Square
F
Sig.
Partial Eta
Squared
Corrected Model
5479.167
a
5
1095.833
13.197
.000
.611
Intercept
163333.333
1
163333.333
1967.025
.000
.979
Gender
168.750
1
168.750
2.032
.161
.046
Alcohol
3332.292
2
1666.146
20.065
.000
.489
Gender * Alcohol
1978.125
2
989.062
11.911
.000
.362
Error
3487.500
42
83.036
Total
172300.000
48
Corrected Total
8966.667
47
a. R Squared = .611 (Adjusted R Squared = .565)
L.
Report the factorial ANOVA results. Which effects were significant?
Alcohol, F(2,42)=20.065, p<.001). Gender*Alcohol, F(2,42)=11.911, p<.001)
Parameter
B
Std. Error
t
Sig.
Partial Eta
Squared
Intercept
57.500
3.222
17.848
.000
.884
[Gender=0]
-21.875
4.556
-4.801
.000
.354
[Gender=1]
0
a
.
.
.
.
[Alcohol=1]
3.125
4.556
.686
.497
.011
[Alcohol=2]
5.000
4.556
1.097
.279
.028
[Alcohol=3]
0
a
.
.
.
.
[Gender=0] * [Alcohol=1]
28.125
6.443
4.365
.000
.312
[Gender=0] * [Alcohol=2]
26.250
6.443
4.074
.000
.283
[Gender=0] * [Alcohol=3]
0
a
.
.
.
.
[Gender=1] * [Alcohol=1]
0
a
.
.
.
.
12
[Gender=1] * [Alcohol=2]
0
a
.
.
.
.
[Gender=1] * [Alcohol=3]
0
a
.
.
.
.
M.
Write down the regression equation based on the Parameter estimates table.
57.500 = -21.875+3.125+5.00+28.125+26.250
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
- Access to all documents
- Unlimited textbook solutions
- 24/7 expert homework help
13
Since the interaction effect was significant, main effects were less meaningful. N.
Interpret the interaction effect based on plot and the post hoc comparison.
There was a significant interaction effect
Related Documents
Recommended textbooks for you
Algebra & Trigonometry with Analytic Geometry
Algebra
ISBN:9781133382119
Author:Swokowski
Publisher:Cengage
Recommended textbooks for you
- Algebra & Trigonometry with Analytic GeometryAlgebraISBN:9781133382119Author:SwokowskiPublisher:Cengage
Algebra & Trigonometry with Analytic Geometry
Algebra
ISBN:9781133382119
Author:Swokowski
Publisher:Cengage