Final - Analysis of Variance

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 20
At a glance
Powered by AI
The key takeaways are that ANOVA is used to test for differences between group means and involves calculating variance components and an F ratio to determine if group means are significantly different.

ANOVA is used to test for differences between three or more independent group means. It allows us to determine if the means are significantly different from each other.

The ANOVA calculation involves calculating the sum of squares between groups and within groups, dividing each by their respective degrees of freedom to obtain mean squares, and then taking the ratio of between and within mean squares to obtain an F value.

ANALYSIS OF VARIANCE(ANOVA)

Problem 1
Using the following data, perform a oneway analysis of variance using α=.05α=.05. Write up the
results in APA format.

⎡⎣⎢⎢⎢⎢⎢⎢⎢⎢Group15145334567⎤⎦⎥⎥⎥⎥⎥⎥⎥⎥⎡⎣⎢⎢⎢⎢⎢⎢⎢⎢Group22343234345⎤⎦⎥⎥
⎥⎥⎥⎥⎥⎥⎡⎣⎢⎢⎢⎢⎢⎢⎢⎢Group35676748756⎤⎦⎥⎥⎥⎥⎥⎥⎥⎥[Group15145334567]
[Group22343234345][Group35676748756]

Solution
Sample means (x¯x¯) for the groups: = 48.2, 35.4, 69.8
Intermediate steps in calculating the group variances:

[[1]]
value mean deviations sq deviations
1 51 48.2 2.8 7.84
2 45 48.2 -3.2 10.24
3 33 48.2 -15.2 231.04
4 45 48.2 -3.2 10.24
5 67 48.2 18.8 353.44

[[2]]
value mean deviations sq deviations
1 23 35.4 -12.4 153.76
2 43 35.4 7.6 57.76
3 23 35.4 -12.4 153.76
4 43 35.4 7.6 57.76
5 45 35.4 9.6 92.16

[[3]]
value mean deviations sq deviations
1 56 69.8 -13.8 190.44
2 76 69.8 6.2 38.44
3 74 69.8 4.2 17.64
4 87 69.8 17.2 295.84
5 56 69.8 -13.8 190.44
Sum of squared deviations from the mean (SS) for the groups:

[1] 612.8 515.2 732.8

Var1=612.85−1=153.2Var1=612.85−1=153.2
Var2=515.25−1=128.8Var2=515.25−1=128.8
Var3=732.85−1=183.2Var3=732.85−1=183.2
MSerror=153.2+128.8+183.23=155.07MSerror=153.2+128.8+183.23=155.07 Note: this is just the
average within-group variance; it is not sensitive to group mean differences!
Calculating the remaining error (or within) terms for the ANOVA table:

dferror=15−3=12dferror=15−3=12
SSerror=(155.07)(15−3)=1860.8SSerror=(155.07)(15−3)=1860.8
Intermediate steps in calculating the variance of the sample means:

Grand mean (x¯grandx¯grand) = 48.2+35.4+69.83=51.1348.2+35.4+69.83=51.13

group mean grand mean deviations sq deviations


48.2 51.13 -2.93 8.58
35.4 51.13 -15.73 247.43
69.8 51.13 18.67 348.57

Sum of squares (SSmeans)=604.58(SSmeans)=604.58

Varmeans=604.583−1=302.29Varmeans=604.583−1=302.29
MSbetween=(302.29)(5)=1511.45MSbetween=(302.29)(5)=1511.45 Note: This method of
estimating the variance IS sensitive to group mean differences!
Calculating the remaining between (or group) terms of the ANOVA table:

dfgroups=3−1=2dfgroups=3−1=2
SSgroup=(1511.45)(3−1)=3022.9SSgroup=(1511.45)(3−1)=3022.9
Test statistic and critical value

F=1511.45155.07=9.75F=1511.45155.07=9.75
Fcritical(2,12)=3.89Fcritical(2,12)=3.89
 Decision: reject H0  Decision: reject H0 
ANOVA table

source SS df MS
group 3022.9 2 1511.45
error 1860.8 12 155.07
total 4883.7
Effect size
η2=3022.94883.7=0.62η2=3022.94883.7=0.62
APA writeup

F(2, 12)=9.75, p <0.05, η2η2=0.62.

Problem 2
Using the following summary data, perform a oneway analysis of variance using α=.01α=.01.

⎡⎣⎢⎢⎢n303030mean50.2645.3253.67sd10.4512.7611.47⎤⎦⎥⎥⎥[nmeansd3050.2610.45
3045.3212.763053.6711.47]

Solution
Var1=10.452=109.2Var1=10.452=109.2
Var2=12.762=162.82Var2=12.762=162.82
Var3=11.472=131.56Var3=11.472=131.56
MSerror=109.2+162.82+131.563=134.53MSerror=109.2+162.82+131.563=134.53 Note: this is just
the average within-group variance; it is not sensitive to group mean differences!
Calculating the remaining error (or within) terms for the ANOVA table:

dferror=90−3=87dferror=90−3=87
SSerror=(134.53)(90−3)=11703.82SSerror=(134.53)(90−3)=11703.82
Intermediate steps in calculating the variance of the sample means:

Grand mean (x¯grandx¯grand) = 50.26+45.32+53.673=49.7550.26+45.32+53.673=49.75

group mean grand mean deviations sq deviations


50.26 49.75 0.51 0.26
45.32 49.75 -4.43 19.62
53.67 49.75 3.92 15.37

Sum of squares (SSmeans)=35.25(SSmeans)=35.25

Varmeans=35.253−1=17.62Varmeans=35.253−1=17.62
MSbetween=(17.62)(30)=528.75MSbetween=(17.62)(30)=528.75 Note: This method of
estimating the variance IS sensitive to group mean differences!
Calculating the remaining between (or group) terms of the ANOVA table:

dfgroups=3−1=2dfgroups=3−1=2
SSgroup=(528.75)(3−1)=1057.5SSgroup=(528.75)(3−1)=1057.5
Test statistic and critical value

F=528.75134.53=3.93F=528.75134.53=3.93
Fcritical(2,87)=4.86Fcritical(2,87)=4.86
 Decision: fail to reject H0  Decision: fail to reject H0 
ANOVA table

source SS df MS
group 1057.5 2 528.75
error 11703.82 87 134.53
total 12761.32
Effect size

η2=1057.512761.32=0.08η2=1057.512761.32=0.08
APA writeup

F(2, 87)=3.93, p >=0.01, η2η2=0.08.

Problem 3
A clinical psychologist has run a between-subjects experiment comparing two treatments for
depression (cognitive-behavioral therapy (CBT) and client-centered therapy (CCT) against a
control condition. Subjects were randomly assigned to the experimental condition. After 12
weeks, the subject’s depression scores were measured using the CESD depression scale. The data
are summarized as follows:

⎡⎣⎢⎢⎢controlCBTCCTn404040mean21.416.919.1sd4.55.55.8⎤⎦⎥⎥⎥[nmeansdcontrol
4021.44.5CBT4016.95.5CCT4019.15.8]

Use a oneway ANOVA with α=.01α=.01 for the test.

Solution
Var1=4.52=20.25Var1=4.52=20.25
Var2=5.52=30.25Var2=5.52=30.25
Var3=5.82=33.64Var3=5.82=33.64
MSerror=20.25+30.25+33.643=28.05MSerror=20.25+30.25+33.643=28.05 Note: this is just the
average within-group variance; it is not sensitive to group mean differences!
Calculating the remaining error (or within) terms for the ANOVA table:

dferror=120−3=117dferror=120−3=117
SSerror=(28.05)(120−3)=3281.46SSerror=(28.05)(120−3)=3281.46
Intermediate steps in calculating the variance of the sample means:

Grand mean (x¯grandx¯grand) = 21.4+16.9+19.13=19.1321.4+16.9+19.13=19.13

group mean grand mean deviations sq deviations


21.4 19.13 2.27 5.15
16.9 19.13 -2.23 4.97
19.1 19.13 -0.03 0.00

Sum of squares (SSmeans)=10.12(SSmeans)=10.12

Varmeans=10.123−1=5.06Varmeans=10.123−1=5.06
MSbetween=(5.06)(40)=202.4MSbetween=(5.06)(40)=202.4 Note: This method of estimating
the variance IS sensitive to group mean differences!
Calculating the remaining between (or group) terms of the ANOVA table:

dfgroups=3−1=2dfgroups=3−1=2
SSgroup=(202.4)(3−1)=404.8SSgroup=(202.4)(3−1)=404.8
Test statistic and critical value

F=202.428.05=7.22F=202.428.05=7.22
Fcritical(2,117)=4.79Fcritical(2,117)=4.79
 Decision: reject H0  Decision: reject H0 
ANOVA table

source SS df M
group 404.8 2 202.4
error 3281.46 117 28.05
total 3686.26
Effect size

η2=404.83686.26=0.11η2=404.83686.26=0.11
APA writeup

F(2, 117)=7.22, p <0.01, η2η2=0.11.

Problem 4
An education researcher is comparing four different algebra curricula. Eighth grade students are
randomly assigned to one one of the four groups. Their state achievement test scores are compared
at the end of the year. Use the appropriate statistical procedure to determine whether the curricula
differ with respect to math achievement. An alpha criterion of .05 should be used for the test.

⎡⎣⎢⎢⎢⎢⎢⎢curriculum 1curriculum 2curriculum 3curriculum 4n50505050mean170.
5168.3167.6172.8sd14.512.817.716.8⎤⎦⎥⎥⎥⎥⎥⎥[nmeansdcurriculum
150170.514.5curriculum 250168.312.8curriculum 350167.617.7curriculum 450172.816.8]

Solution
Var1=14.52=210.25Var1=14.52=210.25
Var2=12.82=163.84Var2=12.82=163.84
Var3=17.72=313.29Var3=17.72=313.29
Var3=16.82=282.24Var3=16.82=282.24
MSerror=210.25+163.84+313.294=242.41MSerror=210.25+163.84+313.294=242.41 Note: this is
just the average within-group variance; it is not sensitive to group mean differences!
Calculating the remaining error (or within) terms for the ANOVA table:

dferror=200−4=196dferror=200−4=196
SSerror=(242.41)(200−4)=47511.38SSerror=(242.41)(200−4)=47511.38
Intermediate steps in calculating the variance of the sample means:

Grand mean (x¯grandx¯grand) = 170.5+168.3+167.63=169.8170.5+168.3+167.63=169.8

group mean grand mean deviations sq deviations


170.5 169.8 0.7 0.49
168.3 169.8 -1.5 2.25
167.6 169.8 -2.2 4.84
172.8 169.8 3.0 9.00

Sum of squares (SSmeans)=16.58(SSmeans)=16.58

Varmeans=16.584−1=5.53Varmeans=16.584−1=5.53
MSbetween=(5.53)(50)=276.33MSbetween=(5.53)(50)=276.33 Note: This method of
estimating the variance IS sensitive to group mean differences!
Calculating the remaining between (or group) terms of the ANOVA table:

dfgroups=4−1=3dfgroups=4−1=3
SSgroup=(276.33)(4−1)=829SSgroup=(276.33)(4−1)=829
Test statistic and critical value

F=276.33242.41=1.14F=276.33242.41=1.14
Fcritical(3,196)=2.65Fcritical(3,196)=2.65
 Decision: fail to reject H0  Decision: fail to reject H0 
ANOVA table

source SS df M
group 829 3 276.33
error 47511.38 196 242.41
total 48340.38
Effect size

η2=82948340.38=0.02η2=82948340.38=0.02
APA writeup
F(3, 196)=1.14, p >=0.05, η2η2=0.02.

PROBLEM 5

Solve using One-way ANOVA method


Observation A B C D
1 8 12 18 13
2 10 11 12 9
3 12 9 16 12
4 8 14 6 16
5 7 4 8 15

Solution:
A B C D
8 12 18 13
10 11 12 9
12 9 16 12
8 14 6 16
7 4 8 15

∑A=45 ∑B=50 ∑C=60 ∑D=65

A2 B2 C2 D2
64 144 324 169
100 121 144 81
144 81 256 144
64 196 36 256
49 16 64 225

∑A2=42 ∑B2=55 ∑C2=82 ∑D2=87


1 8 4 5

Data table
Grou A B C D Total
p
N n1=5 n2=5 n3=5 n4=5 n=20
T1= T2= T3= T4=
∑xi ∑x1 ∑x2 ∑x3 ∑x4 ∑x=22
0
=45 =50 =60 =65

∑x21 ∑x22 ∑x23 ∑x24 ∑x2=2


∑x2i =421 =558 =824 =875 678
Mean  ˉx1= ˉx2= ˉx3= ˉx4= Overall 
ˉxi 9 10 12 13 ˉx=11
Std
S2=3. S3=5. S4=2.
Dev  S1=2
8079 099 7386
Si

Let k = the number of different samples = 4


n=n1+n2+n3+n4=5+5+5+5=20

Overall ˉx=22020=11

∑x=T1+T2+T3+T4=45+50+60+65=220→(1)
(∑x)2n=220220=2420→(2)

∑T2ini= ( 4525+5025+6025+6525 ) =2470→(3)

∑x2=∑x21+∑x22+∑x23+∑x24=421+558+824+875=2678→(4)

ANOVA:
Step-1 : sum of squares between samples

SSB= ( )
∑T2ini -(∑x)2n=(3)-(2)

=2470-2420

=50

Or

(
SSB=∑nj⋅ ˉxj-ˉx )
2

=5×(9-11)2+5×(10-11)2+5×(12-11)2+5×(13-11)2

=50
Step-2 : sum of squares within samples

SSW=∑x2- ( )
∑T2ini =(4)-(3)

=2678-2470

=208

Step-3 : Total sum of squares


SST=SSB+SSW

=50+208

=258

Step-4 : variance between samples


MSB=SSBk-1

=503

=16.6667

Step-5 : variance within samples


MSW=SSWn-k

=20820-4

=20816

=13

Step-6 : test statistic F for one way ANOVA test


F=MSBMSW

=16.666713

=1.2821

the degree of freedom between samples


k-1=3

Now, degree of freedom within samples


n-k=20-4=16

ANOVA table
Sums Degrees Mea
Source p-
of of n
of va
Squar freedo Squa F
Variatio lu
es m res
n e
SS DF MS
Betwee SSB = k-1 = 3 MSB 1. 0.
2
=
n 8 31
50 16.66
samples 2 44
67
1
MS
Within SSW
n-k = 16 W =
samples = 208
13
SST =
Total n-1 = 19
258

H0 : There is no significant differentiating between samples

H1 : There is significant differentiating between samples

F(3,16) at 0.05 level of significance

=3.2389

As calculated F=1.2821<3.2389

So, H0 is accepted, Hence there is no significant differentiating between samples

PROBLEM 6
Solve using One-way ANOVA method
Observation A B C
1 8 7 6
2 10 7 8
3 6 8 10
4 7 9 6
5 9 8 4
6 0 5 5
7 0 0 7

Solution:
A B C
8 7 6
10 7 8
6 8 10
7 9 6
9 8 4
0 5 5
0 0 7

∑A=40 ∑B=44 ∑C=46

A2 B2 C2
64 49 36
100 49 64
36 64 100
49 81 36
81 64 16
0 25 25
0 0 49

∑A2=330 ∑B2=332 ∑C2=326

Data table
Group A B C Total
N n1=5 n2=6 n3=7 n=18

T1=∑x T2=∑x T3=∑x


∑xi 1=40 2=44 3=46
∑x=130

∑x2i ∑330
x21= ∑x22= ∑x23=
332 326
∑x2=988
Mean  ˉx2=7.3 ˉx3=6.5 Overall ˉx=
ˉx1=8
ˉxi 333 714 7.2222
Std S1=1.5 S2=1.3 S3=1.9
Dev Si 811 663 881

Let k = the number of different samples = 3


n=n1+n2+n3=5+6+7=18

Overall ˉx=13018=7.2222

∑x=T1+T2+T3=40+44+46=130→(1)
(∑x)2n=130218=938.8889→(2)
∑T2ini= ( 4025+4426+4627 ) =944.9524→(3)

∑x2=∑x21+∑x22+∑x23=330+332+326=988→(4)

ANOVA:
Step-1 : sum of squares between samples

SSB= ( ) ∑T2ini -(∑x)2n=(3)-(2)

=944.9524-938.8889

=6.0635

Or

(
SSB=∑nj⋅ ˉxj-ˉx )
2

=5×(8-7.2222)2+6×(7.3333-7.2222)2+7×(6.5714-7.2222)2

=6.0635

Step-2 : sum of squares within samples

SSW=∑x2- ( )
∑T2ini =(4)-(3)

=988-944.9524

=43.0476

Step-3 : Total sum of squares


SST=SSB+SSW

=6.0635+43.0476

=49.1111

Step-4 : variance between samples


MSB=SSBk-1

=6.06352

=3.0317

Step-5 : variance within samples


MSW=SSWn-k

=43.047618-3
=43.047615

=2.8698

Step-6 : test statistic F for one way ANOVA test


F=MSBMSW

=3.03172.8698

=1.0564

the degree of freedom between samples


k-1=2

Now, degree of freedom within samples


n-k=18-3=15

ANOVA table
Sums
Source Degrees Mean p-
of
of of Squar va
Square F
Variatio freedom es lu
s
n DF MS e
SS
MSB 1. 0.3
Between SSB =
k-1 = 2 = 05 72
samples 6.0635
3.0317 64 2
MSW
Within SSW =
n-k = 15 =
samples 43.0476
2.8698
SST =
Total n-1 = 17
49.1111

H0 : There is no significant differentiating between samples

H1 : There is significant differentiating between samples

F(2,15) at 0.05 level of significance

=3.6823

As calculated F=1.0564<3.6823

So, H0 is accepted, Hence there is no significant differentiating between samples

PROBLEM 7
Three different techniques namely medication, exercises and special diet
are randomly assigned to (individuals diagnosed with high blood
pressure) lower the blood pressure. After four weeks the reduction in each
person’s blood pressure is recorded. Test at 5% level, whether there is
significant difference in mean reduction of blood pressure among the
three techniques.

Solution:

Step 1 : Hypotheses

Null Hypothesis: H0: µ1 = µ2 = µ3

That is, there is no significant difference among the three groups on the
average reduction in blood pressure.

Alternative Hypothesis: H1: μi ≠ μj for atleast one pair (i, j); i, j = 1, 2,


3; i ≠ j.

That is, there is significant difference in the average reduction in blood


pressure in atleast one pair of treatments.

Step 2 : Data

Step 3 : Level of significance α = 0.05

Step 4 : Test statistic

F0 = MST / MSE

Step 5 : Calculation of Test statistic


Step 6 : Critical value

f(2, 12),0.05 = 3.8853.

Step 7 : Decision

As F0 = 9.17 > f(2, 12),0.05 = 3.8853, the null hypothesis is rejected. Hence,


we conclude that there exists significant difference in the reduction of the
average blood pressure in atleast one pair of techniques.

PROBLEM 8
Three composition instructors recorded the number of spelling errors
which their students made on a research paper. At 1% level of
significance test whether there is significant difference in the average
number of errors in the three classes of students.

Solution:

Step 1 : Hypotheses

Null Hypothesis: H0 : µ1 = µ2 = µ3

That is there is no significant difference among the mean number of


errors in the three classes of students.

Alternative Hypothesis

H1 : μi ≠ μj for at one pair (i, j); i,j = 1,2,3; i ≠ j.

That is, atleast one pair of groups differ significantly on the mean number
of errors.

Step 2 : Data
Step 3 : Level of significance α = 5%

Step 4 : Test Statistic

F0 = MST / MSE

Step 5 : Calculation of Test statistic

Individual squares
ANOVA Table

Step 6 : Critical value

The critical value = f(15, 2),0.05 = 3.6823.


Step 7 : Decision

As F0 = 0.710 < f(15, 2),0.05 = 3.6823, null hypothesis is not rejected. There


is no enough evidence to reject the null hypothesis and hence we
conclude that the mean number of errors made by these three classes of
students are not equal.

PROBLEM 9

SOLUTION:
PROBLEM 10

SOLUTION:

You might also like