0% found this document useful (0 votes)
182 views54 pages

ANOVA and ANCOVA Explained

The document provides an overview of parametric tests, specifically focusing on ANOVA, F-Test, and ANCOVA. It explains the different types of ANOVA, including one-way, two-way, and repeated measures, along with their applications and statistical calculations. Additionally, it includes examples and detailed steps for conducting ANOVA tests, highlighting the importance of understanding group differences in statistical analysis.

Uploaded by

Lata Rajpurohit
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
182 views54 pages

ANOVA and ANCOVA Explained

The document provides an overview of parametric tests, specifically focusing on ANOVA, F-Test, and ANCOVA. It explains the different types of ANOVA, including one-way, two-way, and repeated measures, along with their applications and statistical calculations. Additionally, it includes examples and detailed steps for conducting ANOVA tests, highlighting the importance of understanding group differences in statistical analysis.

Uploaded by

Lata Rajpurohit
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd

Parametric Test: ANOVA , F-Test

and ANCOVA
Lt Col (Dr.) Nikunj Kansara (Retd)
Senior Resident
Dept. of Community Medicine
Contents
• Parametric and Non-parametric tests
• What is ANOVA?
• One way ANOVA
• Two way ANOVA
• ANOVA with repeated measures
• COVARIANCE
Summary Table of Statistical Tests
Sample Characteristics
Level of
2 Sample K Sample (i.e., >2) Correlation
Measurement
1 Sample
Independent Dependent Independent Dependent

Categorical Χ2 or bi- Χ2 Mac Namar’s Χ2 Cochran’s Q


or Nominal nominal Χ2

Rank or Mann Wilcoxin Kruskal Wallis Friedman’s Spearman’s


Ordinal Χ2 Whitney U Matched H ANOVA rho
Pairs Signed
Ranks

Parametric z test t test t test 1 way ANOVA 1 way ANOVA


(Interval & or between within between (within or Pearson’s
t test groups groups repeated r
Ratio) groups measure)

Factorial (2 way) ANOVA


What is ANOVA

 Statistical technique specially designed to


test whether the means of more than 2
quantitative populations are equal or not.

 Developed by Sir Ronald A. Fisher in


1920’s.
ANOVA
EXAMPLE: Study conducted among men of age group
18-25 year in community to assess effect of
SES on BMI
Lower SES Middle SES Higher SES
18,17,18,19,19 22,25,24,26,24,21 25,26,24,28,29
N1= 5 N2= 6 N3= 5
Mean=18.2 Mean= 23.6 Mean=26.4
ANOVA

One way ANOVA Two way ANOVA Three way ANOVA

Effect of SES on BMI Effect of age & SES on BMI Effect of age, SES, Diet
on BMI

ANOVA with repeated measures - comparing >3 group means


where the participants are same in each group. E.g.
Group of subjects is measured more than twice, generally over
time, such as patients weighed at baseline and every month after
a weight loss program
Why ANOVA?
• Unpaired t- test, Z- test Vs ANOVA
– Increase Probability of Alpha error
– In Multiple comparisons SE are calculated using
data from two samples
• Comparison of SE of all Groups
• Increase Power of the study
One Way ANOVA
Data required
One way ANOVA or single factor
ANOVA:
• Determines means of
≥ 3 independent groups
significantly different from one another.

• Fixed Effect Model


• Random Effect model
Steps
1. State null & alternative
hypotheses
2. State Alpha
3. Calculate degrees of Freedom
4. State decision rule

5. Calculate test statistic


- Calculate variance between
samples
- Calculate variance within
the samples
6. State ResultsF&statistic
- Calculate conclusion
1. State null & alternative hypotheses
H 0 1  2 ... i
H0 : there is no significant difference In means of 3
groups.
all sample means are equal

H a not all of the  i are equal


At least one sample has different mean
2. State Alpha i.e 0.05

3. Calculate degrees of Freedom


K-1& n-k
k= No of Samples,
n= Total No of observations

4. State decision rule


If calculated value of F >table value of F, reject Ho

5. Calculate test statistic


Calculating variance between
samples
1. Calculate the mean of each sample.
2. Calculate the Grand average
3. Take the difference between means of
various samples & grand average.
4. Square these deviations & obtain total
which will give sum of squares between
samples (SSB)
5. Divide the total obtained in step 4 by the
degrees of freedom to calculate the mean
sum of square between samples (MSB).
Calculating Variance within
Samples
1. Calculate mean value of each sample
2. Take the deviations of the various items in
a sample from the mean values of the
respective samples.
3. Square these deviations & obtain total
which gives the sum of square within
the samples (SSW)
4. Divide the total obtained in 3rd step by the
degrees of freedom to calculate the mean
sum of squares within samples (MSW).
The mean sum of squares

Calculation of MSB- Calculation of MSW


Mean sum of Squares Mean Sum Of Squares
between samples within samples

SSB SSW
MSB  MSW 
k1 n k
k= No of Samples, n= Total No of observations
Calculation of F statistic

Variabilit y between groups


F
Variabilit y within groups

F- statistic =

Compare the F-statistic value with F(critical) value which is


obtained by looking for it in F distribution tables against
degrees of freedom. The calculated value of F > table value
H0 is rejected
Between-group variance is large relative to the
within-group variance, so F statistic will be
larger & > critical value, therefore statistically
Between-Group
significant .
Variance Conclusion – At least one of group means is
Within-Group
significantly different from other group means
Variance
Within-group variance is larger, and the
between-group variance smaller, so F will
Between-Group be smaller (reflecting the likely-hood of
Variance
no significant differences between these
Within-Group
Variance
3 sample means)
One way ANOVA: Table
Source of SS (Sum of Degrees of MS (Mean Variance
Variation Squares) Freedom Square) Ratio of F

Between SSB k-1 MSB= MSB/MSW


Samples SSB/(k-1)

Within SSW n-k MSW=


Samples SSW/(n-k)

Total SS(Total) n-1


Example- one way ANOVA
Example: 3 samples obtained from normal
populations with equal variances. Test the
hypothesis that sample means are equal
or not??
8 7 12
10 5 9
7 10 13
14 9 12
11 9 14
[Link] hypothesis –
No significant difference in the means of 3 samples

2. State Alpha i.e 0.05

3. Calculate degrees of Freedom


k-1 & n-k = 2 & 12

4. State decision rule


Table value of F at 5% level of significance for d.f 2 & 12 is 3.88
The calculated value of F > 3.88 ,H0 will be rejected Column- k-1
Row – n-k
5. Calculate test statistic
X1 X2 X3
8 7 12
10 5 9
7 10 13
14 9 12
11 9 14
Total 50 40 60
M1= 10 M2 = 8 M3 = 12

Grand average = 10+ 8 + 12


= 10
3
Variance BETWEEN samples (M1=10,
M2=8,M3=12)
Sum of squares between samples (SSB) =
n1 (M1 – Grand avg)2 + n2 (M2– Grand avg)2 + n3(M3– Grand avg)2
5 ( 10 - 10) 2 + 5 ( 8 - 10) 2 + 5 ( 12 - 10) 2 = 40

Calculation of Mean sum of Squares between samples (MSB)

SSB 40
MSB   20
k1 2

k= No of Samples, n= Total No of observations


Variance WITH IN samples
X1 (X1 – M1)2 X2 (X2– M2)2 X3 (X3– M3)2

8 4 7 1 12 0
10 0 5 9 9 9
7 9 10 4 13 1
14 16 9 1 12 0
11 1 9 1 14 4
M1=10 30 M2=8 16 M3=12 14

Sum of squares within samples (SSW) = 30 + 16 +14 = 60


Calculation of Mean Sum Of Squares within samples (MSW)

SSW 60
MSW   5
n  k 12
Calculation of ratio F

Variabilit y between groups


F
Variabilit y within groups

F- statistic = = 20/5 =4

The Table value of F at 5% level of significance for d.f 2 & 12 is 3.88


The calculated value of F > table value
H0 is rejected. Hence there is significant difference in sample means
K-1

N
-k
AFTER ANOVA RESULTS?

• ANOVA test tells us whether we have an


overall difference between our groups but
it does not tell us which specific
groups differed.
ANOVA example:
mobility
 The hypothetical data below represent mobility
scores (higher score indicates improved mobility)
for 3 groups of patients:
 Control group did not receive any therapy
Treatment group 1 received physical therapy,
Treatment group 2 received counseling and
physical therapy.
 Assume that the mobility scores are normally
distributed.
Control Trt. 1 Trt. 2
35 38 47
38 43 53
42 45 42
34 52 45
28 40 46
Example continued..
 State the Hypotheses
 Null Hypothesis: m control =m trt 1 =m trt 2
 Alternative Hypothesis: at least two of the
means
(m control , m trt 1 ,m trt 2 ) are not equal

 Set the significance level


 a = 0.05.
Example continued..

 Group means = average of the


observations in each group
o Control mean = 36
o Treatment 1 mean = 44
o Treatment 2 mean = 45

Grand mean = average of all 18


observations = 41.7
Calculate the Between Sum
of Squares: SSB
 The overall mean = 41.7
 The three group means are:
 Control: mean = 36
 Treatment 1: mean = 44
 Treatment 2: mean = 45
 For each group square the difference between
the group mean and the overall mean and
multiply by the group sample size, then sum
these 3 terms for the SSB:

SSB = 6*(36 - 41.7)2 + 6*(44 – 41.7)2 + 6*(45 -


41.7)2 = 292
MSB = SSB/K-1 so MSB = 292/2
Calculate the Within Sum of Squares:
SSW

 The SSW for the control group (mean = 36)


(35 - 36)2 + (38 – 36)2 + (42 - 36)2 + (34 – 36)2 + (28 –
36)2 + (39 – 36)2 = 118

 The SSW for the treatment 1 group (mean =


44)
(38 - 44)2 + (43 – 44)2 + (45 - 44)2 + (52 – 44)2 + (40 –
44)2 + (46 – 44)2 = 122

 The SSW for the treatment 2 group (mean =


45)
(47 - 45)2 + (53 – 45)2 + (42 - 45)2 + (45 – 45)2 + (46 –
45)2 + (37 – 45)2 = 142
 SSW = sum of SSW for each group = 118 + 122 + 142
= 382
Calculate the ANOVA F-
statistic
 The ANOVA F-statistic = MSB/MSW
 ANOVA F-statistic for example = 146/25.47
= 5.73
Find the significance of the ANOVA
F-statistic
 The F-statistic for the example data = 5.73
 The df for the F-distribution are (3-1) = 2 for the
numerator and (18-3) = 15 for the denominator.

Table value of F at column 2 and row 15


F(t) = 3.68

F (c) > F(t)


Reject the H0.
One group mean from 3 groups is significantly
different from the other means at 0.05 level of
significance (95%).
K-1

N
-k
Two Way ANOVA
Data required
• When 2 independent variables
(Nominal/categorical) have
an effect on one dependent variable
(ordinal or ratio measurement scale)

• Compares relative influences on Dependent


Variable
• Examine interactions between independent
variables
• Just as we had Sums of Squares and Mean Squares
in One-way ANOVA, we have the same in Two-
way ANOVA.
Two way ANOVA
Include tests of three null hypotheses:
1) Means of observations grouped by one
factor are same;

2) Means of observations grouped by the


other factor are the same; and

3) There is no interaction between the two


factors. The interaction test tells whether
the effects of one factor depend on the
other factor
Example-
we have test score of boys & girls in age
group of 10 yr,11yr & 12 yr. If we want to
study the effect of gender & age on score.

Two independent factors- Gender, Age


Dependent factor - Test score
Ho -Gender will have no significant effect on
student score
Ha -

Ho - Age will have no significant effect on


student score
Ha -

Ho – Gender & age interaction will have no


significant effect on student score
Ha -
Two-way ANOVA Table

Source of Degrees of Sum of Mean P-value


Variation Freedom Squares Square F-ratio

Factor A r-1 SSA MSA FA = MSA / MSE Tail area

Factor B c- 1 SSB MSB FB = MSB / MSE Tail area

Interaction (r – 1) (c – 1) SSAB MSAB FAB = MSAB / MSE Tail area

Error rc(n – 1) SSE MSE


(within)
Total rcn - 1 SST
ANOVA with repeated
measures
ANOVA with Repeated Measures

• Determines whether means of 3 or more


measures from same person or matched
controls are similar or different.

• Used when we repeatedly measure


the same subjects multiple times
Calculate test statistic ( f= MS bw/ MS
error)
SS DF MS F
Between
Within
-subjects
- error
Total

State Results & conclusion


ANCOVA
ANCOVA
ANCOVA
ANCOVA
nikunjkumar.kansara30515@[Link]

Thank You!

04/05/2025 Parul Institute of Medical Sciences an 54


d Research

You might also like