One-way ANOVA Model Assumptions

Similar documents
Outline. Topic 20 - Diagnostics and Remedies. Residuals. Overview. Diagnostics Plots Residual checks Formal Tests. STAT Fall 2013

Week 7.1--IES 612-STA STA doc

K. Model Diagnostics. residuals ˆɛ ij = Y ij ˆµ i N = Y ij Ȳ i semi-studentized residuals ω ij = ˆɛ ij. studentized deleted residuals ɛ ij =

One-way ANOVA (Single-Factor CRD)

ANALYSIS OF VARIANCE OF BALANCED DAIRY SCIENCE DATA USING SAS

Nonparametric Statistics. Leah Wright, Tyler Ross, Taylor Brown

The Model Building Process Part I: Checking Model Assumptions Best Practice

22s:152 Applied Linear Regression. Take random samples from each of m populations.

Lecture 4. Checking Model Adequacy

The Model Building Process Part I: Checking Model Assumptions Best Practice (Version 1.1)

22s:152 Applied Linear Regression. There are a couple commonly used models for a one-way ANOVA with m groups. Chapter 8: ANOVA

Topic 23: Diagnostics and Remedies

df=degrees of freedom = n - 1

Regression: Main Ideas Setting: Quantitative outcome with a quantitative explanatory variable. Example, cont.

STAT5044: Regression and Anova

36-309/749 Experimental Design for Behavioral and Social Sciences. Sep. 22, 2015 Lecture 4: Linear Regression

Exam details. Final Review Session. Things to Review

Non-parametric (Distribution-free) approaches p188 CN

SAS Procedures Inference about the Line ffl model statement in proc reg has many options ffl To construct confidence intervals use alpha=, clm, cli, c

IX. Complete Block Designs (CBD s)

SEVERAL μs AND MEDIANS: MORE ISSUES. Business Statistics

Hypothesis testing, part 2. With some material from Howard Seltman, Blase Ur, Bilge Mutlu, Vibha Sazawal

Nonparametric tests. Timothy Hanson. Department of Statistics, University of South Carolina. Stat 704: Data Analysis I

Lecture 3: Inference in SLR

Analysis of variance and regression. April 17, Contents Comparison of several groups One-way ANOVA. Two-way ANOVA Interaction Model checking

Introduction to Design and Analysis of Experiments with the SAS System (Stat 7010 Lecture Notes)

Chapter 16. Simple Linear Regression and Correlation

Introduction to Crossover Trials

Answer Keys to Homework#10

Confidence Intervals, Testing and ANOVA Summary

Diagnostics and Remedial Measures: An Overview

Analysis of variance. April 16, Contents Comparison of several groups

Lecture 7: Hypothesis Testing and ANOVA

Estimating σ 2. We can do simple prediction of Y and estimation of the mean of Y at any value of X.

Analysis of variance. April 16, 2009

Non-parametric tests, part A:

unadjusted model for baseline cholesterol 22:31 Monday, April 19,

Lectures on Simple Linear Regression Stat 431, Summer 2012

CHI SQUARE ANALYSIS 8/18/2011 HYPOTHESIS TESTS SO FAR PARAMETRIC VS. NON-PARAMETRIC

Stat 427/527: Advanced Data Analysis I

Keller: Stats for Mgmt & Econ, 7th Ed July 17, 2006

CHAPTER 17 CHI-SQUARE AND OTHER NONPARAMETRIC TESTS FROM: PAGANO, R. R. (2007)

Selection should be based on the desired biological interpretation!

4.1. Introduction: Comparing Means

Chapter 16. Simple Linear Regression and dcorrelation

STA 108 Applied Linear Models: Regression Analysis Spring Solution for Homework #6

Lecture 11: Simple Linear Regression

3. Nonparametric methods

Advanced Regression Topics: Violation of Assumptions

Tentative solutions TMA4255 Applied Statistics 16 May, 2015

Glossary. The ISI glossary of statistical terms provides definitions in a number of different languages:

Topic 2. Chapter 3: Diagnostics and Remedial Measures

Assignment 9 Answer Keys

22s:152 Applied Linear Regression. Chapter 8: 1-Way Analysis of Variance (ANOVA) 2-Way Analysis of Variance (ANOVA)

Statistics for exp. medical researchers Comparison of groups, T-tests and ANOVA

appstats27.notebook April 06, 2017

Assessing Model Adequacy

Inferences About the Difference Between Two Means

Model Checking and Improvement

Correlation and Regression

One-Way ANOVA Cohen Chapter 12 EDUC/PSY 6600

Diagnostics and Remedial Measures

Inferences for Regression

9 Correlation and Regression

LINEAR REGRESSION ANALYSIS. MODULE XVI Lecture Exercises

Parametric versus Nonparametric Statistics-when to use them and which is more powerful? Dr Mahmoud Alhussami

1. (Rao example 11.15) A study measures oxygen demand (y) (on a log scale) and five explanatory variables (see below). Data are available as

PLS205 Lab 2 January 15, Laboratory Topic 3

Unbalanced Data in Factorials Types I, II, III SS Part 1

z and t tests for the mean of a normal distribution Confidence intervals for the mean Binomial tests

Handling Categorical Predictors: ANOVA

sphericity, 5-29, 5-32 residuals, 7-1 spread and level, 2-17 t test, 1-13 transformations, 2-15 violations, 1-19

Types of Statistical Tests DR. MIKE MARRAPODI

Outline. Analysis of Variance. Acknowledgements. Comparison of 2 or more groups. Comparison of serveral groups

Lecture 3. Experiments with a Single Factor: ANOVA Montgomery 3-1 through 3-3

Degrees of freedom df=1. Limitations OR in SPSS LIM: Knowing σ and µ is unlikely in large

PLS205!! Lab 9!! March 6, Topic 13: Covariance Analysis

Chapter 15: Nonparametric Statistics Section 15.1: An Overview of Nonparametric Statistics

9. Linear Regression and Correlation

What is a Hypothesis?

Rank-Based Methods. Lukas Meier

An Analysis of College Algebra Exam Scores December 14, James D Jones Math Section 01

Lec 3: Model Adequacy Checking

Introduction and Descriptive Statistics p. 1 Introduction to Statistics p. 3 Statistics, Science, and Observations p. 5 Populations and Samples p.

Formal Statement of Simple Linear Regression Model

My data doesn t look like that..

STAT 135 Lab 9 Multiple Testing, One-Way ANOVA and Kruskal-Wallis

Outline. Analysis of Variance. Comparison of 2 or more groups. Acknowledgements. Comparison of serveral groups

Final Exam. Question 1 (20 points) 2 (25 points) 3 (30 points) 4 (25 points) 5 (10 points) 6 (40 points) Total (150 points) Bonus question (10)

Application of Variance Homogeneity Tests Under Violation of Normality Assumption

Lecture 2: Basic Concepts and Simple Comparative Experiments Montgomery: Chapter 2

Stat 500 Midterm 2 12 November 2009 page 0 of 11

Analysis of 2x2 Cross-Over Designs using T-Tests

Inference for Regression Inference about the Regression Model and Using the Regression Line

Analysis of Variance (ANOVA) Cancer Research UK 10 th of May 2018 D.-L. Couturier / R. Nicholls / M. Fernandes

Analysis of Variance

HYPOTHESIS TESTING II TESTS ON MEANS. Sorana D. Bolboacă

The ε ij (i.e. the errors or residuals) are normally distributed. This assumption has the least influence on the F test.

Example: Four levels of herbicide strength in an experiment on dry weight of treated plants.

PSY 307 Statistics for the Behavioral Sciences. Chapter 20 Tests for Ranked Data, Choosing Statistical Tests

Transcription:

One-way ANOVA Model Assumptions STAT:5201 Week 4: Lecture 1 1 / 31

One-way ANOVA: Model Assumptions Consider the single factor model: Y ij = µ + α }{{} i ij iid with ɛ ij N(0, σ 2 ) mean structure random Here, the assumptions are coming from the errors: 1 Normally distributed 2 Constant variance 3 Independent We will use the estimated errors ˆɛ ij = Y ij Ŷij or residuals from the model to check the assumptions. (Though internally studentized residuals or externally studentized residuals can also be used.) 4 Adequacy of the model is about the mean structure, and here, we are fitting the most complex mean structure for this single factor study, which is a separate mean for each group, so in the full model, this shouldn t be a concern. 2 / 31

One-way ANOVA: Model Assumptions Consider the single factor model: Y ij = µ + α }{{} i ij iid with ɛ ij N(0, σ 2 ) mean structure random If the model is correct, our inferences are good. If the assumptions are not true, our inferences may not be valid. Confidence intervals might not cover at the stated level. p-values are not necessarily valid. Type I error rates could be larger (or smaller) than stated. Assumptions need to be checked for the validity of the tests. 3 / 31

One-way ANOVA: Model Assumptions Consider the single factor model: Y ij = µ + α }{{} i ij iid with ɛ ij N(0, σ 2 ) mean structure random Some procedures work reasonably well even if some of the assumptions are violated (we ll explore this for the two-sample t-test in homework). This is called robustness of validity. More mild violations are of course better than more extreme violations, with respect to validity. 4 / 31

One-way C(.dl~ ANOVA: Checking Constant Variance c~ VfVt/ov~ Checking constant variance Plot residuals vs. fitted values PLo-/ 01- rm/~ V5, /I/J V~. 7f f'i1 ozid! OK I s.~ 5 /'a.d~ :;ea IIPi I/;:; If the model is OK for constant variance, then this plot should show a random 1jJN'ds scattering ~~ of points ~ above ~Iow andfk- belowvp[-/-'w the reference r~ line at a horizontal 0, as on the left below. The right one shows nonconstant variance. ;;~ a/~ a. hoy'" 2-crJd 0, r. e.. ~ d.,... " 0,, " #.. ' r:,. r ',, +;.\\--J v~ '" y LlVheJ ~ /J ~ pet 4~VY':'\ (=? v"" itl VIee Jl/2 f.v.d.s 6Yl ~ <'am ) Megaphone pattern violation (variance depends on mean) 5 / 31

One-way ANOVA: Checking Constant Variance There are some statistical tests that will perform a hypothesis test for the equality of variances across groups. H 0 : σ 2 i is equal for all i. Levene s Test Brown-Forsythe Test (a.k.a. modified Levene s test) Example (SAS: levene s test) proc glm data=upsit plots=diagnostics; class agegroup; model smell = agegroup; means agegroup / hovtest=levene; run; For the other homogeneity of variance (HOV) tests in SAS, just google SAS HOVTEST. You can use HOVTEST=BF for brown-forsythe test. 6 / 31

R-Square Coeff Var Root MSE smell Mean 0.275670 14.52664 0.179200 1.233594 One-way ANOVA: Checking Constant Variance Source DF Type I SS Mean Square F Value Pr > F agegroup 4 2.13878141 0.53469535 16.65 <.0001 Example Source (SAS: DF Type III SSlevene s Mean Square F Value Pr > test) F agegroup 4 2.13878141 0.53469535 16.65 <.0001 Distribution of smell 1.4 F 16.65 Prob > F <.0001 1.2 The SAS System 12:31 Thursda smell 1.0 The GLM Procedure 0.8 Levene's Test for Homogeneity of smell Variance ANOVAof Squared Deviations from Group Means 0.6 Source DF Sum of Squares Mean Square F Value Pr > F agegroup 4 0.0799 0.0200 6.35 <.0001 1 2 3 4 5 agegroup Error 175 0.5503 0.00314 The plot suggests we have nonconstant variance, and the null hypothesis of H 0 : σ 1 = σ 2 = σ 5 is strongly rejected by Levene s test. Oehlert has some issues with using statistical tests for nonconstant variance due to sensitivity to non-normality, but you may still be asked about these tests. 7 / 31

One-way ANOVA: Model Adequacy Plot residuals vs. fitted values The residuals vs. fitted plot can also give you some information about the adequacy of the model in a multi-factor ANOVA (we ll see this later in multi-factor factorials, plot shown below). For instance, if you are missing an important interaction term in the mean structure, then this plot will often display a curved trend. 8 / 31

One-way ANOVA: Dealing with Nonconstant Variance Dealing with nonconstant variance When the variance depends on the mean (like in the megaphone pattern), the usual approach is to apply a transformation to the response variable. These are called variance-stabilizing transformations. Suppose Var(y) mean or Var(y) µ I want a transformation of y, or function h(y), such that Var[h(y)]=constant. Consider a Taylor Series expansion of h around µ 9 / 31

One-way ANOVA: Dealing with Nonconstant Variance We now have the first-order approximation: Var[h(y)] Var[h(µ) + h (µ)(y µ)] = [h (µ)] 2 Var(y) = c 0 [h (µ)] 2 µ {as Var(y) µ} And we want Var[h(y)] to be a constant. So, set [h (µ)] 2 µ equal to a constant and solve for h. 10 / 31

One-way ANOVA: Dealing with Nonconstant Variance Setting equal to a constant and solving for the unknown h: [h (µ)] 2 µ =constant constant h (µ) = µ 1 h(µ) =c 1 dµ µ 1/2 h(µ) =c 2 µ So, if Var(y) µ, then use a square root transformation to achieve constant variance. 11 / 31

One-way ANOVA: Dealing with Nonconstant Variance This is built on the Delta Method. If Var(y) mean, use h(y) = y. If Var(y) mean 2, use h(y) = ln(y) Many times it s hard to tell from the data what the specific relationship between the variance and the mean is, so a trial-and-error process is applied. Other possibilities if the spread increases with µ: h(y) = 1 y. h(y) = log 10 (y) Other possibilities if the spread decreases with µ: h(y) = y 2. h(y) = y 1.5 12 / 31

One-way ANOVA: Dealing with Nonconstant Variance The Box-Cox procedure chooses a transformation based on the observed data. The λ parameter dictated the transformation. The following form for the transformation is suggested to create the new outcome variable y (λ) : y (λ) = { y λ 1 λ when λ 0 log(y) when λ = 0 Though λ is continuous, in practice we usually use a convenient λ that is near to the optimal, like 0.5 or 0, etc. 13 / 31

One-way ANOVA: Dealing with Nonconstant Variance Example (SAS: Box-Cox for 2-factor factorial, perceived as single factor or a superfactor. Weeks has 5 levels, Water has 2 levels.) proc transreg data=germ; model boxcox(germination)=class(superfactor); run; A transformation using λ = 0.25 is suggested, but the convenient λ = 0.5 looks to be in the confidence interval (we will check constant variance after the transformation). 14 / 31

One-way ANOVA: Dealing with Nonconstant Variance Example (R: Box-Cox for 2-factor factorial, perceived as single factor or a superfactor. Weeks has 5 levels, Water has 2 levels.) > library(mass) > bc.fit <- boxcox(germination as.factor(superfactor)) > bc.fit 15 / 31

One-way ANOVA: Dealing with Nonconstant Variance So, if we know the proportional relationship between the variance and the mean, then we can analytically find an appropriate transformation to achieve constant variance (or near constant variance). When we do not know the relationship, then we can apply the Box-Cox transformation to give us a suggestion of an appropriate transformation. In practice, if I observe a nonconstant variance that can be corrected through transformation (not all of them are), I mostly see variance increasing with the mean, and I just try a square-root or log transformation right away (or log(y + 1) if there are zeros.). REMINDER: In a two-sample t-test with nonconstant variance, we do have an availalbe method called Welch s Approximate t or or Welch-Satterthwaite t. 16 / 31

One-way ANOVA: Checking Normality Checking Normality This is usually done by plotting a normal probability plot or normal QQ-plot. If the data were generated from a normal distribution, then the normal probability plot will show the data points falling approximately along the diagonal reference line (this is not a best-fit line, it simply connects the 25th and 75th percentile points). 17 / 31

One-way ANOVA: Checking Normality Chi-squared, right-skewed Chi-squared (df=2) Normal Q-Q Plot Frequency 0 100 200 300 Sample Quantiles 0 2 4 6 8 10 0 5 10 15 rchisq(1000, 2) -3-2 -1 0 1 2 3 Theoretical Quantiles Uniform, thin tails Uniform(0,1) Normal Q-Q Plot Frequency 0 10 20 30 40 50 60 Sample Quantiles 0.0 0.2 0.4 0.6 0.8 1.0 0.0 0.2 0.4 0.6 0.8 1.0 y -3-2 -1 0 1 2 3 Theoretical Quantiles 18 / 31

One-way ANOVA: Checking Normality There are a number of statistical tests that test for non-normality: Anderson-Darling test Shapiro-Wilk test Many others One issue with normality tests is that as your N gets larger, you start to get a lot of power for detecting very small deviations from normality. In small samples, you ll probably never reject. In practice, I feel like the visual normal probability plot is most useful. But clients will commonly ask how to perform certain tests, such as these, in software. 19 / 31

One-way ANOVA: Dealing with Non-normality Dealing with Non-normality Try a transformation. If there s an outlier that a transformation does not fix, do a sensitivity analysis where you perform the analysis with and without the outlier. These can both be reported. If the important items do not change (e.g. significance) the outlier is perhaps not a big issue. DO NOT simply remove an outlier because it is unusual!! Not OK. (See link on webpage). And in fact, that data point could be telling you something very interesting. Try a non-parametric test: Randomization test (pretty general) Wicoxon rank-sum test/mann-whitney test (for 2-sample t-test) Wilcoxon signed-rank test (for paired t-test) Kruskal-Wallis test (for 1-way ANOVA, extends Mann-Whitney test) Freidman test (for RCBD) 20 / 31

One-way ANOVA: Checking Independence Checking Independence Many times, a client brings the data to you and you have to rely on their description of the data collection, and that independence holds. Ideally, it should be part of the design in terms of randomly assigning treatments to EUs and randomly assigning the order of the runs. If you happen to know the order in which data were collected, or the time the observations were collected, it s a good idea to check for correlation in the residuals with respect to order or time (e.g. plot resids vs. time and/or resids vs. order). 21 / 31

One-way ANOVA: Checking Independence If a pattern appears in the plots, then these items are sources of variation that can be added to the model (though it makes the model a bit more complex). Above we see sequential observations over time, and an observable trend. 22 / 31

One-way ANOVA: Checking Independence The Durbin-Watson test statistic can be used to check for time dependence or serial dependence. The residuals e i are used to calculate DW: DW = n 1 i (e i e i 1 ) 2 n i e 2 i Independent data tend to have DW around 2. A positive correlation makes DW smaller and negative correlation makes it bigger. If DW gets as low as 1.5 or as high as 2.5, you should start worrying about time correlation and it s affect on the inference. 23 / 31

One-way ANOVA: Checking Independence Example (Checking residuals for time correlation) The SAS data set diags contains a vector of residuals under the column name resid. Below, nothing is listed as a predictor in the model statement because only an intercept is used. proc reg data=diags; model resid= /DW; The SAS System 14:15 Thursday, February 1, 2018 2 run; The REG Procedure Model: MODEL1 Dependent Variable: Resid Residual Durbin-Watson D 1.319 Number of Observations 48 1st Order Autocorrelation 0.334 An approximate 95% CI for ρ is 0.334 ± 2 1 n or 0.334 ± 0.289, so there appears to be correlation in the residuals over time. 24 / 31

One-way ANOVA: Dealing with Dependence Another type of correlation is a spatial correlation, which could be checked using a variogram. If there is some kind of non-independence, we should incorporate this into our model. Perhaps there is time-correlation or spatial-correlation, and we have models that will incorporate this correlation structure. If there are repeated measures on a single subject, then this also represents correlation (within the observations on a person), and we can incorporate that into our model. If the residuals are non-independent because you were missing an important factor, then we can include that factor in the model. 25 / 31

Importance of Assumption Violations Biggest Issue: Non-independence Standard errors for treatments can be biased, and this can greatly affect the type I error rate of our test. Next Biggest Issue: Nonconstant variance If you have balanced data, then the affect on p-values is potentially small. For unbalanced data, the error rates can be greatly affected. Smallest Issue: Non-normality If you have moderate non-normality, the p-values are only slightly affected. If it s very non-normal, inference can be affected. Similarly, one very strong outlier can greatly affect the results. Again, this will have the least impact on error rates in balanced data. 26 / 31

Checking Assumptions: Example Example (Response time for circuit types) Returning to our previous 1-way ANOVA example to check assumptions... Three different types of circuit are investigated for response time in milliseconds. Fifteen are completed in a balanced CRD with the single factor of Type (1,2,3). Circuit Type Response Time 1 9 12 10 8 15 2 20 21 23 17 30 3 6 5 8 16 7 From D.C Montgomery (2005). Design and Analysis of Experiments. Wiley:USA 27 / 31

Checking Assumptions: Example Example (Response time for circuit types) Normality looks violated. 28 / 31

Checking Assumptions: Example Example (Response time for circuit types) We ll apply the natural log-transformation and perform the 1-way ANVOA on the transformed response. 29 / 31

Checking Assumptions: Example Example (Response time for circuit types) Constant variance seems to be worse here. We will go back and try a nonparametric test on the original data. 30 / 31

Checking Assumptions: Example Example (Response time for circuit types) Perform a 1-way ANOVA using a nonparametric test: Kruskal-Wallis. Kruskal-Wallis Test Chi-Square 10.3735 DF 2 Asymptotic Pr > Chi-Square 0.0056 Exact Pr >= Chi-Square 0.0005 Reject H 0 : α i = 0 for all i, where H A : at least one group different 31 / 31