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
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.
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
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