SlideShare a Scribd company logo
1 of 24
Download to read offline
Lab 5 ā€“ Assumptions of ANOVA
September 17 & 18, 2018
FANR 6750
Richard Chandler and Bob Cooper
Todayā€™s Topics
1 Assumptions of ANOVA
2 Transformations
3 Non-parametrics
Assumptions of ANOVA
A common misconception is that the response variable must be
normally distributed when conducting an ANOVA.
Assumptions of ANOVA Transformations Non-parametrics 3 / 16
Assumptions of ANOVA
A common misconception is that the response variable must be
normally distributed when conducting an ANOVA.
This is incorrect because the normality assumptions pertain to the
residuals, not the response variable. The key assumption of
ANOVA is that the residuals are independent and come from a
normal distribution with mean 0 and variance Ļƒ2.
Assumptions of ANOVA Transformations Non-parametrics 3 / 16
Assumptions of ANOVA
A common misconception is that the response variable must be
normally distributed when conducting an ANOVA.
This is incorrect because the normality assumptions pertain to the
residuals, not the response variable. The key assumption of
ANOVA is that the residuals are independent and come from a
normal distribution with mean 0 and variance Ļƒ2.
yij = Āµ + Ī±i + Īµij
Īµij āˆ¼ Normal(0, Ļƒ2
)
Assumptions of ANOVA Transformations Non-parametrics 3 / 16
Assumptions of ANOVA
A common misconception is that the response variable must be
normally distributed when conducting an ANOVA.
This is incorrect because the normality assumptions pertain to the
residuals, not the response variable. The key assumption of
ANOVA is that the residuals are independent and come from a
normal distribution with mean 0 and variance Ļƒ2.
yij = Āµ + Ī±i + Īµij
Īµij āˆ¼ Normal(0, Ļƒ2
)
We can assess this assumption by looking at the residuals
themselves or the data within each treatment
Assumptions of ANOVA Transformations Non-parametrics 3 / 16
Normality diagnostics
Consider the data:
infectionRates <- read.csv("infectionRates.csv")
str(infectionRates)
## 'data.frame': 90 obs. of 2 variables:
## $ percentInfected: num 0.21 0.25 0.17 0.26 0.21 0.21 0.22 0.27 0.23 0.14 ...
## $ landscape : Factor w/ 3 levels "Park","Suburban",..: 1 1 1 1 1 1 1 1 1 1 ...
summary(infectionRates)
## percentInfected landscape
## Min. :0.010 Park :30
## 1st Qu.:0.040 Suburban:30
## Median :0.090 Urban :30
## Mean :0.121
## 3rd Qu.:0.210
## Max. :0.330
These data are made-up, but imagine they come from a study in which
100 crows are placed in n = 30 enclosures in each of 3 landscapes. The
response variable is the proportion of crows infected with West Nile virus
at the end of the study.
Assumptions of ANOVA Transformations Non-parametrics 4 / 16
ANOVA diagnostics
anova1 <- aov(percentInfected ~ landscape,
data=infectionRates)
summary(anova1)
## Df Sum Sq Mean Sq F value Pr(>F)
## landscape 2 0.6384 0.3192 306 <2e-16 ***
## Residuals 87 0.0908 0.0010
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Assumptions of ANOVA Transformations Non-parametrics 5 / 16
ANOVA diagnostics
anova1 <- aov(percentInfected ~ landscape,
data=infectionRates)
summary(anova1)
## Df Sum Sq Mean Sq F value Pr(>F)
## landscape 2 0.6384 0.3192 306 <2e-16 ***
## Residuals 87 0.0908 0.0010
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Signiļ¬cant, but did we meet the assumptions?
Assumptions of ANOVA Transformations Non-parametrics 5 / 16
Boxplots
boxplot(percentInfected~landscape, infectionRates,
col="lightgreen", cex.lab=1.5, cex.axis=1.3,
ylab="Percent forest cover")
Park Suburban Urban
0.000.050.100.150.200.250.30
Percentforestcover
Assumptions of ANOVA Transformations Non-parametrics 6 / 16
Are group variances equal?
bartlett.test(percentInfected~landscape, data=infectionRates)
##
## Bartlett test of homogeneity of variances
##
## data: percentInfected by landscape
## Bartlett's K-squared = 42.926, df = 2, p-value = 4.773e-10
We reject the null hypothesis that the group variances are equal
Assumptions of ANOVA Transformations Non-parametrics 7 / 16
Histogram of residuals
resids <- resid(anova1)
hist(resids, col="turquoise", breaks=10, xlab="Residuals")
Histogram of resids
Residuals
Frequency
āˆ’0.10 āˆ’0.05 0.00 0.05 0.10
051015202530
Assumptions of ANOVA Transformations Non-parametrics 8 / 16
Normality test on residuals
shapiro.test(resids)
##
## Shapiro-Wilk normality test
##
## data: resids
## W = 0.95528, p-value = 0.003596
Assumptions of ANOVA Transformations Non-parametrics 9 / 16
Normality test on residuals
shapiro.test(resids)
##
## Shapiro-Wilk normality test
##
## data: resids
## W = 0.95528, p-value = 0.003596
We reject the null hypothesis that the residuals come from a
normal distribution. Time to consider transformations and/or
nonparametric tests.
Assumptions of ANOVA Transformations Non-parametrics 9 / 16
Logarithmic Transformation
y = log(u + C)
ā€¢ The constant C is often 1, or 0 if there are no zeros in the
data (u)
ā€¢ Useful when group variances are proportional to the means
Assumptions of ANOVA Transformations Non-parametrics 10 / 16
Square Root Transformation
y =
āˆš
u + C
ā€¢ C is often 0.5 or some other small number
ā€¢ Useful when group variances are proportional to the means
Assumptions of ANOVA Transformations Non-parametrics 11 / 16
Arcsine-square root Transformation
y = arcsin(
āˆš
u)
ā€¢ Used on proportions.
ā€¢ logit transformation is an alternative: y = log( u
1āˆ’u
)
Assumptions of ANOVA Transformations Non-parametrics 12 / 16
Reciprocal Transformation
y =
1
u + C
ā€¢ C is often 1 but could be 0 if there are no zeros in u
ā€¢ Useful when group SDs are proportional to the squared
group means
Assumptions of ANOVA Transformations Non-parametrics 13 / 16
ANOVA on transformed data
Tranformation can be done in the aov formula
anova2 <- aov(log(percentInfected)~landscape,
data=infectionRates)
summary(anova2)
## Df Sum Sq Mean Sq F value Pr(>F)
## landscape 2 60.93 30.46 303.5 <2e-16 ***
## Residuals 87 8.73 0.10
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Assumptions of ANOVA Transformations Non-parametrics 14 / 16
ANOVA on transformed data
Tranformation can be done in the aov formula
anova2 <- aov(log(percentInfected)~landscape,
data=infectionRates)
summary(anova2)
## Df Sum Sq Mean Sq F value Pr(>F)
## landscape 2 60.93 30.46 303.5 <2e-16 ***
## Residuals 87 8.73 0.10
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Now we fail to reject the normality assumption ā€“ good news
shapiro.test(resid(anova2))
##
## Shapiro-Wilk normality test
##
## data: resid(anova2)
## W = 0.97092, p-value = 0.04106
Assumptions of ANOVA Transformations Non-parametrics 14 / 16
Non-parametric Tests
Wilcoxan rank sum test
ā€¢ For 2 group comparisons
ā€¢ a.k.a. the Mann-Whitney U test
ā€¢ wilcox.test
Assumptions of ANOVA Transformations Non-parametrics 15 / 16
Non-parametric Tests
Wilcoxan rank sum test
ā€¢ For 2 group comparisons
ā€¢ a.k.a. the Mann-Whitney U test
ā€¢ wilcox.test
Kruskal-Wallis One-Way ANOVA
ā€¢ For testing diļ¬€erences in > 2 groups
ā€¢ kruskal.test
Assumptions of ANOVA Transformations Non-parametrics 15 / 16
Non-parametric Tests
Wilcoxan rank sum test
ā€¢ For 2 group comparisons
ā€¢ a.k.a. the Mann-Whitney U test
ā€¢ wilcox.test
Kruskal-Wallis One-Way ANOVA
ā€¢ For testing diļ¬€erences in > 2 groups
ā€¢ kruskal.test
These two functions can be used in almost the exact same way
as t.test and aov , respectively.
Assumptions of ANOVA Transformations Non-parametrics 15 / 16
Assignment
(1) Decide which transformation is best for the infectionRates data by
conducting an ANOVA on the untransformed and transformed data. Use
graphical assessments, Bartlettā€™s test, and Shapiroā€™s test to evaluate each
of the following tranformations:
log
square-root
acrsine square-root
reciprocal
(2) Does transformation alter the conclusion about the null hypothesis of no
diļ¬€erence in means? If not, were the transformations necessary?
(3) Test the hypothesis that infection rates are equal between suburban and
urban landscapes using a Wilcoxan rank sum test. What is the
conclusion?
(4) Conduct a Kruskal-Wallis test on the data. What is the conclusion?
Use comments in your R script to explain your answers. Upload your results to
ELC at least one day before your next lab.
Assumptions of ANOVA Transformations Non-parametrics 16 / 16

More Related Content

What's hot (20)

T test and anova
T test and anovaT test and anova
T test and anova
Ā 
t distribution, paired and unpaired t-test
t distribution, paired and unpaired t-testt distribution, paired and unpaired t-test
t distribution, paired and unpaired t-test
Ā 
Manova
ManovaManova
Manova
Ā 
T test statistics
T test statisticsT test statistics
T test statistics
Ā 
Analysis of variance anova
Analysis of variance anovaAnalysis of variance anova
Analysis of variance anova
Ā 
Correlation ppt...
Correlation ppt...Correlation ppt...
Correlation ppt...
Ā 
What is a partial correlation?
What is a partial correlation?What is a partial correlation?
What is a partial correlation?
Ā 
Z-test
Z-testZ-test
Z-test
Ā 
Manova
ManovaManova
Manova
Ā 
coefficient correlation
 coefficient correlation coefficient correlation
coefficient correlation
Ā 
Chi square test
Chi square testChi square test
Chi square test
Ā 
Randomized complete block_design_rcbd_
Randomized complete block_design_rcbd_Randomized complete block_design_rcbd_
Randomized complete block_design_rcbd_
Ā 
Statistics "Descriptive & Inferential"
Statistics "Descriptive & Inferential"Statistics "Descriptive & Inferential"
Statistics "Descriptive & Inferential"
Ā 
F test
F testF test
F test
Ā 
Chi squared test
Chi squared testChi squared test
Chi squared test
Ā 
Analysis of variance (ANOVA)
Analysis of variance (ANOVA)Analysis of variance (ANOVA)
Analysis of variance (ANOVA)
Ā 
MONOVA
MONOVAMONOVA
MONOVA
Ā 
F test and ANOVA
F test and ANOVAF test and ANOVA
F test and ANOVA
Ā 
Anova, ancova
Anova, ancovaAnova, ancova
Anova, ancova
Ā 
Kruskal wallis test
Kruskal wallis testKruskal wallis test
Kruskal wallis test
Ā 

Similar to Assumptions of ANOVA

Regression Analysis
Regression AnalysisRegression Analysis
Regression AnalysisMichael770443
Ā 
Variance component analysis by paravayya c pujeri
Variance component analysis by paravayya c pujeriVariance component analysis by paravayya c pujeri
Variance component analysis by paravayya c pujeriParavayya Pujeri
Ā 
10.Analysis of Variance.ppt
10.Analysis of Variance.ppt10.Analysis of Variance.ppt
10.Analysis of Variance.pptAbdulhaqAli
Ā 
U1.4-RVDistributions.ppt
U1.4-RVDistributions.pptU1.4-RVDistributions.ppt
U1.4-RVDistributions.pptSameeraasif2
Ā 
604_multiplee.ppt
604_multiplee.ppt604_multiplee.ppt
604_multiplee.pptRufesh
Ā 
Test for equal variances
Test for equal variancesTest for equal variances
Test for equal variancesJohn Smith
Ā 
Analysis of Variance (ANOVA), MANOVA: Expected variance components, Random an...
Analysis of Variance (ANOVA), MANOVA: Expected variance components, Random an...Analysis of Variance (ANOVA), MANOVA: Expected variance components, Random an...
Analysis of Variance (ANOVA), MANOVA: Expected variance components, Random an...Satish Khadia
Ā 
Analysis of variance (anova)
Analysis of variance (anova)Analysis of variance (anova)
Analysis of variance (anova)Sadhana Singh
Ā 
Mba2216 week 11 data analysis part 02
Mba2216 week 11 data analysis part 02Mba2216 week 11 data analysis part 02
Mba2216 week 11 data analysis part 02Stephen Ong
Ā 
Inorganic CHEMISTRY
Inorganic CHEMISTRYInorganic CHEMISTRY
Inorganic CHEMISTRYSaikumar raja
Ā 
Repeated measures analysis in R
Repeated measures analysis in RRepeated measures analysis in R
Repeated measures analysis in Rrichardchandler
Ā 
2.0.statistical methods and determination of sample size
2.0.statistical methods and determination of sample size2.0.statistical methods and determination of sample size
2.0.statistical methods and determination of sample sizesalummkata1
Ā 
lecture-2.ppt
lecture-2.pptlecture-2.ppt
lecture-2.pptNoorelhuda2
Ā 
Design of experiments(
Design of experiments(Design of experiments(
Design of experiments(Nugurusaichandan
Ā 

Similar to Assumptions of ANOVA (20)

Regression Analysis
Regression AnalysisRegression Analysis
Regression Analysis
Ā 
Variance component analysis by paravayya c pujeri
Variance component analysis by paravayya c pujeriVariance component analysis by paravayya c pujeri
Variance component analysis by paravayya c pujeri
Ā 
10.Analysis of Variance.ppt
10.Analysis of Variance.ppt10.Analysis of Variance.ppt
10.Analysis of Variance.ppt
Ā 
Regression analysis
Regression analysisRegression analysis
Regression analysis
Ā 
U1.4-RVDistributions.ppt
U1.4-RVDistributions.pptU1.4-RVDistributions.ppt
U1.4-RVDistributions.ppt
Ā 
Stats chapter 15
Stats chapter 15Stats chapter 15
Stats chapter 15
Ā 
604_multiplee.ppt
604_multiplee.ppt604_multiplee.ppt
604_multiplee.ppt
Ā 
Test for equal variances
Test for equal variancesTest for equal variances
Test for equal variances
Ā 
Analysis of Variance (ANOVA), MANOVA: Expected variance components, Random an...
Analysis of Variance (ANOVA), MANOVA: Expected variance components, Random an...Analysis of Variance (ANOVA), MANOVA: Expected variance components, Random an...
Analysis of Variance (ANOVA), MANOVA: Expected variance components, Random an...
Ā 
Analysis of variance (anova)
Analysis of variance (anova)Analysis of variance (anova)
Analysis of variance (anova)
Ā 
Mba2216 week 11 data analysis part 02
Mba2216 week 11 data analysis part 02Mba2216 week 11 data analysis part 02
Mba2216 week 11 data analysis part 02
Ā 
Inorganic CHEMISTRY
Inorganic CHEMISTRYInorganic CHEMISTRY
Inorganic CHEMISTRY
Ā 
Repeated measures analysis in R
Repeated measures analysis in RRepeated measures analysis in R
Repeated measures analysis in R
Ā 
Analysis of Variance
Analysis of VarianceAnalysis of Variance
Analysis of Variance
Ā 
ANCOVA in R
ANCOVA in RANCOVA in R
ANCOVA in R
Ā 
Linear regression analysis
Linear regression analysisLinear regression analysis
Linear regression analysis
Ā 
2.0.statistical methods and determination of sample size
2.0.statistical methods and determination of sample size2.0.statistical methods and determination of sample size
2.0.statistical methods and determination of sample size
Ā 
Multiple regression
Multiple regressionMultiple regression
Multiple regression
Ā 
lecture-2.ppt
lecture-2.pptlecture-2.ppt
lecture-2.ppt
Ā 
Design of experiments(
Design of experiments(Design of experiments(
Design of experiments(
Ā 

More from richardchandler

Model Selection and Multi-model Inference
Model Selection and Multi-model InferenceModel Selection and Multi-model Inference
Model Selection and Multi-model Inferencerichardchandler
Ā 
Introduction to Generalized Linear Models
Introduction to Generalized Linear ModelsIntroduction to Generalized Linear Models
Introduction to Generalized Linear Modelsrichardchandler
Ā 
Introduction to statistical modeling in R
Introduction to statistical modeling in RIntroduction to statistical modeling in R
Introduction to statistical modeling in Rrichardchandler
Ā 
Split-plot Designs
Split-plot DesignsSplit-plot Designs
Split-plot Designsrichardchandler
Ā 
Lab on contrasts, estimation, and power
Lab on contrasts, estimation, and powerLab on contrasts, estimation, and power
Lab on contrasts, estimation, and powerrichardchandler
Ā 
t-tests in R - Lab slides for UGA course FANR 6750
t-tests in R - Lab slides for UGA course FANR 6750t-tests in R - Lab slides for UGA course FANR 6750
t-tests in R - Lab slides for UGA course FANR 6750richardchandler
Ā 
Introduction to R - Lab slides for UGA course FANR 6750
Introduction to R - Lab slides for UGA course FANR 6750Introduction to R - Lab slides for UGA course FANR 6750
Introduction to R - Lab slides for UGA course FANR 6750richardchandler
Ā 
Hierarchichal species distributions model and Maxent
Hierarchichal species distributions model and MaxentHierarchichal species distributions model and Maxent
Hierarchichal species distributions model and Maxentrichardchandler
Ā 
Slides from ESA 2015
Slides from ESA 2015Slides from ESA 2015
Slides from ESA 2015richardchandler
Ā 
The role of spatial models in applied ecological research
The role of spatial models in applied ecological researchThe role of spatial models in applied ecological research
The role of spatial models in applied ecological researchrichardchandler
Ā 

More from richardchandler (15)

Model Selection and Multi-model Inference
Model Selection and Multi-model InferenceModel Selection and Multi-model Inference
Model Selection and Multi-model Inference
Ā 
Introduction to Generalized Linear Models
Introduction to Generalized Linear ModelsIntroduction to Generalized Linear Models
Introduction to Generalized Linear Models
Ā 
Introduction to statistical modeling in R
Introduction to statistical modeling in RIntroduction to statistical modeling in R
Introduction to statistical modeling in R
Ā 
Split-plot Designs
Split-plot DesignsSplit-plot Designs
Split-plot Designs
Ā 
Nested Designs
Nested DesignsNested Designs
Nested Designs
Ā 
Factorial designs
Factorial designsFactorial designs
Factorial designs
Ā 
Blocking lab
Blocking labBlocking lab
Blocking lab
Ā 
Lab on contrasts, estimation, and power
Lab on contrasts, estimation, and powerLab on contrasts, estimation, and power
Lab on contrasts, estimation, and power
Ā 
One-way ANOVA
One-way ANOVAOne-way ANOVA
One-way ANOVA
Ā 
t-tests in R - Lab slides for UGA course FANR 6750
t-tests in R - Lab slides for UGA course FANR 6750t-tests in R - Lab slides for UGA course FANR 6750
t-tests in R - Lab slides for UGA course FANR 6750
Ā 
Introduction to R - Lab slides for UGA course FANR 6750
Introduction to R - Lab slides for UGA course FANR 6750Introduction to R - Lab slides for UGA course FANR 6750
Introduction to R - Lab slides for UGA course FANR 6750
Ā 
Hierarchichal species distributions model and Maxent
Hierarchichal species distributions model and MaxentHierarchichal species distributions model and Maxent
Hierarchichal species distributions model and Maxent
Ā 
Slides from ESA 2015
Slides from ESA 2015Slides from ESA 2015
Slides from ESA 2015
Ā 
The role of spatial models in applied ecological research
The role of spatial models in applied ecological researchThe role of spatial models in applied ecological research
The role of spatial models in applied ecological research
Ā 
2014 ISEC slides
2014 ISEC slides2014 ISEC slides
2014 ISEC slides
Ā 

Recently uploaded

Environmental Biotechnology Topic:- Microbial Biosensor
Environmental Biotechnology Topic:- Microbial BiosensorEnvironmental Biotechnology Topic:- Microbial Biosensor
Environmental Biotechnology Topic:- Microbial Biosensorsonawaneprad
Ā 
TOPIC 8 Temperature and Heat.pdf physics
TOPIC 8 Temperature and Heat.pdf physicsTOPIC 8 Temperature and Heat.pdf physics
TOPIC 8 Temperature and Heat.pdf physicsssuserddc89b
Ā 
FREE NURSING BUNDLE FOR NURSES.PDF by na
FREE NURSING BUNDLE FOR NURSES.PDF by naFREE NURSING BUNDLE FOR NURSES.PDF by na
FREE NURSING BUNDLE FOR NURSES.PDF by naJASISJULIANOELYNV
Ā 
Pests of castor_Binomics_Identification_Dr.UPR.pdf
Pests of castor_Binomics_Identification_Dr.UPR.pdfPests of castor_Binomics_Identification_Dr.UPR.pdf
Pests of castor_Binomics_Identification_Dr.UPR.pdfPirithiRaju
Ā 
Call Girls in Munirka Delhi šŸ’ÆCall Us šŸ”8264348440šŸ”
Call Girls in Munirka Delhi šŸ’ÆCall Us šŸ”8264348440šŸ”Call Girls in Munirka Delhi šŸ’ÆCall Us šŸ”8264348440šŸ”
Call Girls in Munirka Delhi šŸ’ÆCall Us šŸ”8264348440šŸ”soniya singh
Ā 
User Guide: Magellan MXā„¢ Weather Station
User Guide: Magellan MXā„¢ Weather StationUser Guide: Magellan MXā„¢ Weather Station
User Guide: Magellan MXā„¢ Weather StationColumbia Weather Systems
Ā 
Microteaching on terms used in filtration .Pharmaceutical Engineering
Microteaching on terms used in filtration .Pharmaceutical EngineeringMicroteaching on terms used in filtration .Pharmaceutical Engineering
Microteaching on terms used in filtration .Pharmaceutical EngineeringPrajakta Shinde
Ā 
LIGHT-PHENOMENA-BY-CABUALDIONALDOPANOGANCADIENTE-CONDEZA (1).pptx
LIGHT-PHENOMENA-BY-CABUALDIONALDOPANOGANCADIENTE-CONDEZA (1).pptxLIGHT-PHENOMENA-BY-CABUALDIONALDOPANOGANCADIENTE-CONDEZA (1).pptx
LIGHT-PHENOMENA-BY-CABUALDIONALDOPANOGANCADIENTE-CONDEZA (1).pptxmalonesandreagweneth
Ā 
Citronella presentation SlideShare mani upadhyay
Citronella presentation SlideShare mani upadhyayCitronella presentation SlideShare mani upadhyay
Citronella presentation SlideShare mani upadhyayupadhyaymani499
Ā 
The dark energy paradox leads to a new structure of spacetime.pptx
The dark energy paradox leads to a new structure of spacetime.pptxThe dark energy paradox leads to a new structure of spacetime.pptx
The dark energy paradox leads to a new structure of spacetime.pptxEran Akiva Sinbar
Ā 
Pests of Blackgram, greengram, cowpea_Dr.UPR.pdf
Pests of Blackgram, greengram, cowpea_Dr.UPR.pdfPests of Blackgram, greengram, cowpea_Dr.UPR.pdf
Pests of Blackgram, greengram, cowpea_Dr.UPR.pdfPirithiRaju
Ā 
RESPIRATORY ADAPTATIONS TO HYPOXIA IN HUMNAS.pptx
RESPIRATORY ADAPTATIONS TO HYPOXIA IN HUMNAS.pptxRESPIRATORY ADAPTATIONS TO HYPOXIA IN HUMNAS.pptx
RESPIRATORY ADAPTATIONS TO HYPOXIA IN HUMNAS.pptxFarihaAbdulRasheed
Ā 
Call Girls in Majnu Ka Tilla Delhi šŸ”9711014705šŸ” Genuine
Call Girls in Majnu Ka Tilla Delhi šŸ”9711014705šŸ” GenuineCall Girls in Majnu Ka Tilla Delhi šŸ”9711014705šŸ” Genuine
Call Girls in Majnu Ka Tilla Delhi šŸ”9711014705šŸ” Genuinethapagita
Ā 
User Guide: Capricorn FLXā„¢ Weather Station
User Guide: Capricorn FLXā„¢ Weather StationUser Guide: Capricorn FLXā„¢ Weather Station
User Guide: Capricorn FLXā„¢ Weather StationColumbia Weather Systems
Ā 
preservation, maintanence and improvement of industrial organism.pptx
preservation, maintanence and improvement of industrial organism.pptxpreservation, maintanence and improvement of industrial organism.pptx
preservation, maintanence and improvement of industrial organism.pptxnoordubaliya2003
Ā 
Harmful and Useful Microorganisms Presentation
Harmful and Useful Microorganisms PresentationHarmful and Useful Microorganisms Presentation
Harmful and Useful Microorganisms Presentationtahreemzahra82
Ā 
STOPPED FLOW METHOD & APPLICATION MURUGAVENI B.pptx
STOPPED FLOW METHOD & APPLICATION MURUGAVENI B.pptxSTOPPED FLOW METHOD & APPLICATION MURUGAVENI B.pptx
STOPPED FLOW METHOD & APPLICATION MURUGAVENI B.pptxMurugaveni B
Ā 
Scheme-of-Work-Science-Stage-4 cambridge science.docx
Scheme-of-Work-Science-Stage-4 cambridge science.docxScheme-of-Work-Science-Stage-4 cambridge science.docx
Scheme-of-Work-Science-Stage-4 cambridge science.docxyaramohamed343013
Ā 
Pests of jatropha_Bionomics_identification_Dr.UPR.pdf
Pests of jatropha_Bionomics_identification_Dr.UPR.pdfPests of jatropha_Bionomics_identification_Dr.UPR.pdf
Pests of jatropha_Bionomics_identification_Dr.UPR.pdfPirithiRaju
Ā 
Vision and reflection on Mining Software Repositories research in 2024
Vision and reflection on Mining Software Repositories research in 2024Vision and reflection on Mining Software Repositories research in 2024
Vision and reflection on Mining Software Repositories research in 2024AyushiRastogi48
Ā 

Recently uploaded (20)

Environmental Biotechnology Topic:- Microbial Biosensor
Environmental Biotechnology Topic:- Microbial BiosensorEnvironmental Biotechnology Topic:- Microbial Biosensor
Environmental Biotechnology Topic:- Microbial Biosensor
Ā 
TOPIC 8 Temperature and Heat.pdf physics
TOPIC 8 Temperature and Heat.pdf physicsTOPIC 8 Temperature and Heat.pdf physics
TOPIC 8 Temperature and Heat.pdf physics
Ā 
FREE NURSING BUNDLE FOR NURSES.PDF by na
FREE NURSING BUNDLE FOR NURSES.PDF by naFREE NURSING BUNDLE FOR NURSES.PDF by na
FREE NURSING BUNDLE FOR NURSES.PDF by na
Ā 
Pests of castor_Binomics_Identification_Dr.UPR.pdf
Pests of castor_Binomics_Identification_Dr.UPR.pdfPests of castor_Binomics_Identification_Dr.UPR.pdf
Pests of castor_Binomics_Identification_Dr.UPR.pdf
Ā 
Call Girls in Munirka Delhi šŸ’ÆCall Us šŸ”8264348440šŸ”
Call Girls in Munirka Delhi šŸ’ÆCall Us šŸ”8264348440šŸ”Call Girls in Munirka Delhi šŸ’ÆCall Us šŸ”8264348440šŸ”
Call Girls in Munirka Delhi šŸ’ÆCall Us šŸ”8264348440šŸ”
Ā 
User Guide: Magellan MXā„¢ Weather Station
User Guide: Magellan MXā„¢ Weather StationUser Guide: Magellan MXā„¢ Weather Station
User Guide: Magellan MXā„¢ Weather Station
Ā 
Microteaching on terms used in filtration .Pharmaceutical Engineering
Microteaching on terms used in filtration .Pharmaceutical EngineeringMicroteaching on terms used in filtration .Pharmaceutical Engineering
Microteaching on terms used in filtration .Pharmaceutical Engineering
Ā 
LIGHT-PHENOMENA-BY-CABUALDIONALDOPANOGANCADIENTE-CONDEZA (1).pptx
LIGHT-PHENOMENA-BY-CABUALDIONALDOPANOGANCADIENTE-CONDEZA (1).pptxLIGHT-PHENOMENA-BY-CABUALDIONALDOPANOGANCADIENTE-CONDEZA (1).pptx
LIGHT-PHENOMENA-BY-CABUALDIONALDOPANOGANCADIENTE-CONDEZA (1).pptx
Ā 
Citronella presentation SlideShare mani upadhyay
Citronella presentation SlideShare mani upadhyayCitronella presentation SlideShare mani upadhyay
Citronella presentation SlideShare mani upadhyay
Ā 
The dark energy paradox leads to a new structure of spacetime.pptx
The dark energy paradox leads to a new structure of spacetime.pptxThe dark energy paradox leads to a new structure of spacetime.pptx
The dark energy paradox leads to a new structure of spacetime.pptx
Ā 
Pests of Blackgram, greengram, cowpea_Dr.UPR.pdf
Pests of Blackgram, greengram, cowpea_Dr.UPR.pdfPests of Blackgram, greengram, cowpea_Dr.UPR.pdf
Pests of Blackgram, greengram, cowpea_Dr.UPR.pdf
Ā 
RESPIRATORY ADAPTATIONS TO HYPOXIA IN HUMNAS.pptx
RESPIRATORY ADAPTATIONS TO HYPOXIA IN HUMNAS.pptxRESPIRATORY ADAPTATIONS TO HYPOXIA IN HUMNAS.pptx
RESPIRATORY ADAPTATIONS TO HYPOXIA IN HUMNAS.pptx
Ā 
Call Girls in Majnu Ka Tilla Delhi šŸ”9711014705šŸ” Genuine
Call Girls in Majnu Ka Tilla Delhi šŸ”9711014705šŸ” GenuineCall Girls in Majnu Ka Tilla Delhi šŸ”9711014705šŸ” Genuine
Call Girls in Majnu Ka Tilla Delhi šŸ”9711014705šŸ” Genuine
Ā 
User Guide: Capricorn FLXā„¢ Weather Station
User Guide: Capricorn FLXā„¢ Weather StationUser Guide: Capricorn FLXā„¢ Weather Station
User Guide: Capricorn FLXā„¢ Weather Station
Ā 
preservation, maintanence and improvement of industrial organism.pptx
preservation, maintanence and improvement of industrial organism.pptxpreservation, maintanence and improvement of industrial organism.pptx
preservation, maintanence and improvement of industrial organism.pptx
Ā 
Harmful and Useful Microorganisms Presentation
Harmful and Useful Microorganisms PresentationHarmful and Useful Microorganisms Presentation
Harmful and Useful Microorganisms Presentation
Ā 
STOPPED FLOW METHOD & APPLICATION MURUGAVENI B.pptx
STOPPED FLOW METHOD & APPLICATION MURUGAVENI B.pptxSTOPPED FLOW METHOD & APPLICATION MURUGAVENI B.pptx
STOPPED FLOW METHOD & APPLICATION MURUGAVENI B.pptx
Ā 
Scheme-of-Work-Science-Stage-4 cambridge science.docx
Scheme-of-Work-Science-Stage-4 cambridge science.docxScheme-of-Work-Science-Stage-4 cambridge science.docx
Scheme-of-Work-Science-Stage-4 cambridge science.docx
Ā 
Pests of jatropha_Bionomics_identification_Dr.UPR.pdf
Pests of jatropha_Bionomics_identification_Dr.UPR.pdfPests of jatropha_Bionomics_identification_Dr.UPR.pdf
Pests of jatropha_Bionomics_identification_Dr.UPR.pdf
Ā 
Vision and reflection on Mining Software Repositories research in 2024
Vision and reflection on Mining Software Repositories research in 2024Vision and reflection on Mining Software Repositories research in 2024
Vision and reflection on Mining Software Repositories research in 2024
Ā 

Assumptions of ANOVA

  • 1. Lab 5 ā€“ Assumptions of ANOVA September 17 & 18, 2018 FANR 6750 Richard Chandler and Bob Cooper
  • 2. Todayā€™s Topics 1 Assumptions of ANOVA 2 Transformations 3 Non-parametrics
  • 3. Assumptions of ANOVA A common misconception is that the response variable must be normally distributed when conducting an ANOVA. Assumptions of ANOVA Transformations Non-parametrics 3 / 16
  • 4. Assumptions of ANOVA A common misconception is that the response variable must be normally distributed when conducting an ANOVA. This is incorrect because the normality assumptions pertain to the residuals, not the response variable. The key assumption of ANOVA is that the residuals are independent and come from a normal distribution with mean 0 and variance Ļƒ2. Assumptions of ANOVA Transformations Non-parametrics 3 / 16
  • 5. Assumptions of ANOVA A common misconception is that the response variable must be normally distributed when conducting an ANOVA. This is incorrect because the normality assumptions pertain to the residuals, not the response variable. The key assumption of ANOVA is that the residuals are independent and come from a normal distribution with mean 0 and variance Ļƒ2. yij = Āµ + Ī±i + Īµij Īµij āˆ¼ Normal(0, Ļƒ2 ) Assumptions of ANOVA Transformations Non-parametrics 3 / 16
  • 6. Assumptions of ANOVA A common misconception is that the response variable must be normally distributed when conducting an ANOVA. This is incorrect because the normality assumptions pertain to the residuals, not the response variable. The key assumption of ANOVA is that the residuals are independent and come from a normal distribution with mean 0 and variance Ļƒ2. yij = Āµ + Ī±i + Īµij Īµij āˆ¼ Normal(0, Ļƒ2 ) We can assess this assumption by looking at the residuals themselves or the data within each treatment Assumptions of ANOVA Transformations Non-parametrics 3 / 16
  • 7. Normality diagnostics Consider the data: infectionRates <- read.csv("infectionRates.csv") str(infectionRates) ## 'data.frame': 90 obs. of 2 variables: ## $ percentInfected: num 0.21 0.25 0.17 0.26 0.21 0.21 0.22 0.27 0.23 0.14 ... ## $ landscape : Factor w/ 3 levels "Park","Suburban",..: 1 1 1 1 1 1 1 1 1 1 ... summary(infectionRates) ## percentInfected landscape ## Min. :0.010 Park :30 ## 1st Qu.:0.040 Suburban:30 ## Median :0.090 Urban :30 ## Mean :0.121 ## 3rd Qu.:0.210 ## Max. :0.330 These data are made-up, but imagine they come from a study in which 100 crows are placed in n = 30 enclosures in each of 3 landscapes. The response variable is the proportion of crows infected with West Nile virus at the end of the study. Assumptions of ANOVA Transformations Non-parametrics 4 / 16
  • 8. ANOVA diagnostics anova1 <- aov(percentInfected ~ landscape, data=infectionRates) summary(anova1) ## Df Sum Sq Mean Sq F value Pr(>F) ## landscape 2 0.6384 0.3192 306 <2e-16 *** ## Residuals 87 0.0908 0.0010 ## --- ## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Assumptions of ANOVA Transformations Non-parametrics 5 / 16
  • 9. ANOVA diagnostics anova1 <- aov(percentInfected ~ landscape, data=infectionRates) summary(anova1) ## Df Sum Sq Mean Sq F value Pr(>F) ## landscape 2 0.6384 0.3192 306 <2e-16 *** ## Residuals 87 0.0908 0.0010 ## --- ## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Signiļ¬cant, but did we meet the assumptions? Assumptions of ANOVA Transformations Non-parametrics 5 / 16
  • 10. Boxplots boxplot(percentInfected~landscape, infectionRates, col="lightgreen", cex.lab=1.5, cex.axis=1.3, ylab="Percent forest cover") Park Suburban Urban 0.000.050.100.150.200.250.30 Percentforestcover Assumptions of ANOVA Transformations Non-parametrics 6 / 16
  • 11. Are group variances equal? bartlett.test(percentInfected~landscape, data=infectionRates) ## ## Bartlett test of homogeneity of variances ## ## data: percentInfected by landscape ## Bartlett's K-squared = 42.926, df = 2, p-value = 4.773e-10 We reject the null hypothesis that the group variances are equal Assumptions of ANOVA Transformations Non-parametrics 7 / 16
  • 12. Histogram of residuals resids <- resid(anova1) hist(resids, col="turquoise", breaks=10, xlab="Residuals") Histogram of resids Residuals Frequency āˆ’0.10 āˆ’0.05 0.00 0.05 0.10 051015202530 Assumptions of ANOVA Transformations Non-parametrics 8 / 16
  • 13. Normality test on residuals shapiro.test(resids) ## ## Shapiro-Wilk normality test ## ## data: resids ## W = 0.95528, p-value = 0.003596 Assumptions of ANOVA Transformations Non-parametrics 9 / 16
  • 14. Normality test on residuals shapiro.test(resids) ## ## Shapiro-Wilk normality test ## ## data: resids ## W = 0.95528, p-value = 0.003596 We reject the null hypothesis that the residuals come from a normal distribution. Time to consider transformations and/or nonparametric tests. Assumptions of ANOVA Transformations Non-parametrics 9 / 16
  • 15. Logarithmic Transformation y = log(u + C) ā€¢ The constant C is often 1, or 0 if there are no zeros in the data (u) ā€¢ Useful when group variances are proportional to the means Assumptions of ANOVA Transformations Non-parametrics 10 / 16
  • 16. Square Root Transformation y = āˆš u + C ā€¢ C is often 0.5 or some other small number ā€¢ Useful when group variances are proportional to the means Assumptions of ANOVA Transformations Non-parametrics 11 / 16
  • 17. Arcsine-square root Transformation y = arcsin( āˆš u) ā€¢ Used on proportions. ā€¢ logit transformation is an alternative: y = log( u 1āˆ’u ) Assumptions of ANOVA Transformations Non-parametrics 12 / 16
  • 18. Reciprocal Transformation y = 1 u + C ā€¢ C is often 1 but could be 0 if there are no zeros in u ā€¢ Useful when group SDs are proportional to the squared group means Assumptions of ANOVA Transformations Non-parametrics 13 / 16
  • 19. ANOVA on transformed data Tranformation can be done in the aov formula anova2 <- aov(log(percentInfected)~landscape, data=infectionRates) summary(anova2) ## Df Sum Sq Mean Sq F value Pr(>F) ## landscape 2 60.93 30.46 303.5 <2e-16 *** ## Residuals 87 8.73 0.10 ## --- ## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Assumptions of ANOVA Transformations Non-parametrics 14 / 16
  • 20. ANOVA on transformed data Tranformation can be done in the aov formula anova2 <- aov(log(percentInfected)~landscape, data=infectionRates) summary(anova2) ## Df Sum Sq Mean Sq F value Pr(>F) ## landscape 2 60.93 30.46 303.5 <2e-16 *** ## Residuals 87 8.73 0.10 ## --- ## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Now we fail to reject the normality assumption ā€“ good news shapiro.test(resid(anova2)) ## ## Shapiro-Wilk normality test ## ## data: resid(anova2) ## W = 0.97092, p-value = 0.04106 Assumptions of ANOVA Transformations Non-parametrics 14 / 16
  • 21. Non-parametric Tests Wilcoxan rank sum test ā€¢ For 2 group comparisons ā€¢ a.k.a. the Mann-Whitney U test ā€¢ wilcox.test Assumptions of ANOVA Transformations Non-parametrics 15 / 16
  • 22. Non-parametric Tests Wilcoxan rank sum test ā€¢ For 2 group comparisons ā€¢ a.k.a. the Mann-Whitney U test ā€¢ wilcox.test Kruskal-Wallis One-Way ANOVA ā€¢ For testing diļ¬€erences in > 2 groups ā€¢ kruskal.test Assumptions of ANOVA Transformations Non-parametrics 15 / 16
  • 23. Non-parametric Tests Wilcoxan rank sum test ā€¢ For 2 group comparisons ā€¢ a.k.a. the Mann-Whitney U test ā€¢ wilcox.test Kruskal-Wallis One-Way ANOVA ā€¢ For testing diļ¬€erences in > 2 groups ā€¢ kruskal.test These two functions can be used in almost the exact same way as t.test and aov , respectively. Assumptions of ANOVA Transformations Non-parametrics 15 / 16
  • 24. Assignment (1) Decide which transformation is best for the infectionRates data by conducting an ANOVA on the untransformed and transformed data. Use graphical assessments, Bartlettā€™s test, and Shapiroā€™s test to evaluate each of the following tranformations: log square-root acrsine square-root reciprocal (2) Does transformation alter the conclusion about the null hypothesis of no diļ¬€erence in means? If not, were the transformations necessary? (3) Test the hypothesis that infection rates are equal between suburban and urban landscapes using a Wilcoxan rank sum test. What is the conclusion? (4) Conduct a Kruskal-Wallis test on the data. What is the conclusion? Use comments in your R script to explain your answers. Upload your results to ELC at least one day before your next lab. Assumptions of ANOVA Transformations Non-parametrics 16 / 16