BIOL 458 BIOMETRY Lab 7 Multi-Factor ANOVA

Similar documents
One-Way Independent ANOVA

ANOVA in SPSS (Practical)

MULTIPLE LINEAR REGRESSION 24.1 INTRODUCTION AND OBJECTIVES OBJECTIVES

Two Factor Analysis of Variance

Two-Way Independent ANOVA

Bangor University Laboratory Exercise 1, June 2008

Psy201 Module 3 Study and Assignment Guide. Using Excel to Calculate Descriptive and Inferential Statistics

Two-Way Independent Samples ANOVA with SPSS

Lesson 9: Two Factor ANOVAS

LAB ASSIGNMENT 4 INFERENCES FOR NUMERICAL DATA. Comparison of Cancer Survival*

Preliminary Report on Simple Statistical Tests (t-tests and bivariate correlations)

Regression Including the Interaction Between Quantitative Variables

Section 6: Analysing Relationships Between Variables

1. To review research methods and the principles of experimental design that are typically used in an experiment.

Advanced ANOVA Procedures

Experimental Studies. Statistical techniques for Experimental Data. Experimental Designs can be grouped. Experimental Designs can be grouped

Statistics 2. RCBD Review. Agriculture Innovation Program

Hour 2: lm (regression), plot (scatterplots), cooks.distance and resid (diagnostics) Stat 302, Winter 2016 SFU, Week 3, Hour 1, Page 1

Biology 345: Biometry Fall 2005 SONOMA STATE UNIVERSITY Lab Exercise 8 One Way ANOVA and comparisons among means Introduction

Worksheet 6 - Multifactor ANOVA models

Multiple Linear Regression Analysis

Correlation and Regression

Linear Regression in SAS

One-Way ANOVAs t-test two statistically significant Type I error alpha null hypothesis dependant variable Independent variable three levels;

Intro to SPSS. Using SPSS through WebFAS

(C) Jamalludin Ab Rahman

9.0 L '- ---'- ---'- --' X

CHAPTER ONE CORRELATION

25. Two-way ANOVA. 25. Two-way ANOVA 371

Examining differences between two sets of scores

9 research designs likely for PSYC 2100

12.1 Inference for Linear Regression. Introduction

Chapter 5: Field experimental designs in agriculture

How to Conduct On-Farm Trials. Dr. Jim Walworth Dept. of Soil, Water & Environmental Sci. University of Arizona

Before we get started:

Chapter 13: Introduction to Analysis of Variance

Lab #7: Confidence Intervals-Hypothesis Testing (2)-T Test

Propensity Score Methods for Causal Inference with the PSMATCH Procedure

Testing Means. Related-Samples t Test With Confidence Intervals. 6. Compute a related-samples t test and interpret the results.

COMPUTER-BASED BIOMETRICS MANUAL

ANOVA. Thomas Elliott. January 29, 2013

List of Figures. List of Tables. Preface to the Second Edition. Preface to the First Edition

EXPERIMENTAL RESEARCH DESIGNS

CHAPTER TWO REGRESSION

Data and Statistics 101: Key Concepts in the Collection, Analysis, and Application of Child Welfare Data

Profile Analysis. Intro and Assumptions Psy 524 Andrew Ainsworth

Chapter 6 Analysis of variance and experimental designed

Problem #1 Neurological signs and symptoms of ciguatera poisoning as the start of treatment and 2.5 hours after treatment with mannitol.

3 CONCEPTUAL FOUNDATIONS OF STATISTICS

SPSS output for 420 midterm study

Binary Diagnostic Tests Two Independent Samples

11/18/2013. Correlational Research. Correlational Designs. Why Use a Correlational Design? CORRELATIONAL RESEARCH STUDIES

6. Unusual and Influential Data

Introduction to SPSS S0

SPSS output for 420 midterm study

SPSS Correlation/Regression

bivariate analysis: The statistical analysis of the relationship between two variables.

Doing Quantitative Research 26E02900, 6 ECTS Lecture 6: Structural Equations Modeling. Olli-Pekka Kauppila Daria Kautto

Regression models, R solution day7

Chapter 9. Factorial ANOVA with Two Between-Group Factors 10/22/ Factorial ANOVA with Two Between-Group Factors

Understandable Statistics

Applied Medical. Statistics Using SAS. Geoff Der. Brian S. Everitt. CRC Press. Taylor Si Francis Croup. Taylor & Francis Croup, an informa business

Creative Commons Attribution-NonCommercial-Share Alike License

Stat 13, Lab 11-12, Correlation and Regression Analysis

Stat Wk 9: Hypothesis Tests and Analysis

Part 8 Logistic Regression

USE AND MISUSE OF MIXED MODEL ANALYSIS VARIANCE IN ECOLOGICAL STUDIES1

Midterm STAT-UB.0003 Regression and Forecasting Models. I will not lie, cheat or steal to gain an academic advantage, or tolerate those who do.

Application of Local Control Strategy in analyses of the effects of Radon on Lung Cancer Mortality for 2,881 US Counties

Statistical Techniques. Meta-Stat provides a wealth of statistical tools to help you examine your data. Overview

Dr. Kelly Bradley Final Exam Summer {2 points} Name

THE STATSWHISPERER. Introduction to this Issue. Doing Your Data Analysis INSIDE THIS ISSUE

Lesson: A Ten Minute Course in Epidemiology

User Guide for Classification of Diabetes: A search tool for identifying miscoded, misclassified or misdiagnosed patients

Analysis of Environmental Data Conceptual Foundations: En viro n m e n tal Data

CHAPTER VI RESEARCH METHODOLOGY

Unit 1 Exploring and Understanding Data

Meta-analysis using RevMan. Yemisi Takwoingi October 2015

Binary Diagnostic Tests Paired Samples

Math 215, Lab 7: 5/23/2007

isc ove ring i Statistics sing SPSS

Research Methods in Forest Sciences: Learning Diary. Yoko Lu December Research process

Analysis of Variance: repeated measures

The SAGE Encyclopedia of Educational Research, Measurement, and Evaluation Multivariate Analysis of Variance

Review Questions in Introductory Knowledge... 37

Midterm Exam MMI 409 Spring 2009 Gordon Bleil

A SAS Macro for Adaptive Regression Modeling

Utilizing t-test and One-Way Analysis of Variance to Examine Group Differences August 31, 2016

SUMMER 2011 RE-EXAM PSYF11STAT - STATISTIK

Comparing Two Means using SPSS (T-Test)

Lecture 21. RNA-seq: Advanced analysis

CRITERIA FOR USE. A GRAPHICAL EXPLANATION OF BI-VARIATE (2 VARIABLE) REGRESSION ANALYSISSys

SAFETY & DISPOSAL onpg is a potential irritant. Be sure to wash your hands after the lab.

Chapter 3 Software Packages to Install How to Set Up Python Eclipse How to Set Up Eclipse... 42

Bayes Factors for t tests and one way Analysis of Variance; in R

MMI 409 Spring 2009 Final Examination Gordon Bleil. 1. Is there a difference in depression as a function of group and drug?

Using SPSS for Correlation

Biology 345: Biometry Fall 2005 SONOMA STATE UNIVERSITY Lab Exercise 5 Residuals and multiple regression Introduction

Chapter 1: Exploring Data

7. Bivariate Graphing

Transcription:

BIOL 458 BIOMETRY Lab 7 Multi-Factor ANOVA PART 1: Introduction to Factorial ANOVA ingle factor or One - Way Analysis of Variance can be used to test the null hypothesis that k or more treatment or group means are equal. Usually the k groups represent a series of related treatments. However, we may also be interested in partitioning the differences between group means into 2 or more sets of related treatments - factors. For instance, if we had measured the weights of several individuals of two species of rodents for both male and female animals, we could perform a one - way ANOVA with 4 treatment groups (species 1 - male, species 1 - female, species 2 - male, and species 2 - female). However, if we found a difference between group means how would we interpret the result? Differences between group means might indicate that the two species differ in weight, that the sexes (but not the species) differ in weight, or that both the species and the sexes differ in weight. Factorial ANOVA allows us to simplify such an analysis by defining two factors (species and sex) each of which had two levels. In this example, we have established two sets of related treatments (e.g., species and sex) each with two levels (e.g., species 1 and species 2, male and female, respectively). Each individual observation must be classified as to which combination of factor levels in which it occurs (each animal weighed had both a species designation and a sex), and each animal must only occur within one combination of factor levels (no animal was both a member of species 1 and species 2, or both male and female). Let's look at some possible factors and levels: FACTOR TATE TREE PECIE TREATMENT DEPTH LEVEL California, Nevada, Oregon, etc. Oak, Maple, Ash, Pine, etc. Burned, Un-Burned 0-20 cm, 21-30 cm, 31-40 cm Now that you have some idea as to the sort of differences between factors and levels, look at the list below and classify them as being either a factor or level. 1) Height 2) Male 3) pecies 4) Polluted 5) Island 6) Australia

(A good question to ask if you think you've found a factor is: "What are its possible levels?" if you cannot think of any, it is probably not a factor.) Now that we have a clear idea as to what constitutes a factor and what constitutes a factor level (in the question above, all the odd numbers were factors and the even, levels) it is time to learn how they are used. We will start with a simple example with 2 factors, (A and B) each with 2 levels (1 and 2), where µ i is the population mean for a particular combination of the levels of factor A and B (cell i). Factor A 1 2 Factor B 1 µ 1 µ 2 2 µ 3 µ 4 What hypotheses might we want to test? Different treatments in a plant growth experiment could be defined according to the amounts of fertilizer added (Factor A). Fertilizer treatment 1 might consist of 10 grams of N-P-K fertilizer added and treatment 2 of 20 grams added. The results from such a design could be analyzed with a One-Way ANOVA (or a t - test) since only a single factor (Fertilizer) differed between treatments. There are times when it is desirable to examine the action of 2 or more qualitatively distinct factors simultaneously. To continue our example, suppose we also wish to examine the effect of a second factor, amount of light (Factor B). In Light treatment 1, plants might receive 12 hours a day of light, while in treatment 2 they receive 18 hours a day. There are 3 sorts of questions we might want to ask from such a design: 1) Is there any difference in plant growth between fertilizer treatments averaged across light treatments (the main effect of factor A)? 2) Is there any difference in plant growth between light treatments averaged across fertilizer treatments (the main effect of factor B)? 3) Is the effect caused by differences in light different among fertilizer treatments? or, conversely, is fertilizer effectiveness different with different amounts of light (the interaction between factor A and B)?

MAIN EFFECT OF FACTOR A Do the group means differ among the levels of factor A, averaging over the levels of factor B: H 0 µ 1 + µ 3 µ 2 + µ = 2 2 : 4 More simply: H o: µ 1 + µ 3 - µ 2 - µ 4 = 0. This is called the main effect of factor A. MAIN EFFECT OF FACTOR B imilarly, the main effect of factor B would be: H o: µ 1 + µ 2 - µ 3 - µ 4 = 0, Do the group means differ across the levels of factor B, averaging over the levels of factor A? INTERACTION Besides the main effects of the factors, one could also ask if the effect of factor A differed among the levels of factor B. This kind of an effect is known as the interaction of factor A and factor B. A significant interaction effect would indicate that the independent effects of factors A and factor B are not additive. The effect of factor A on the group means depends on the effect of factor B on the group means. H o : (µ 1 - µ 2 ) - (µ 3 + µ 4 ) = 0 For example, the growth of plants in response to increasing amounts of water and fertilizer might show an interaction effect. Plants might be able to use more fertilizer and therefore grow more if provided more water, but not if water is limited. Hence, the effect of fertilizer on plant growth depends on the level of water they receive. Here are some numerical examples: (1) Factor A 1 2 Factor B 1 5 10 2 10 15 The numbers listed under each combination of factor levels represent the population means. The questions at hand are:

Is there a main effect of factor A? Is there a main effect of factor B? Is there an interaction between factor A and B? The test for the main effect of factor A would be: H o : (5+10) - (10+15) = 0. ince 15 25, there is probably a main effect of factor A. imilarly for factor B, Ho: (5+10) - (10+15) = 0, and 15 25 so a main effect of factor B is also present. The test for the interaction between factor A and B would be: Ho: (5+15) - (10+10) = 0. ince 20 = 20, there is no interaction. In other words, the difference between means among levels of factor A does not differ between levels of factor B (in this case the difference is always 5), or conversely, that the differences between the levels of B do not differ between levels of A. (2) What effects are present in this example? Factor A 1 2 Factor B 1 5 10 2 15 10 (3) What effects are present in this example? Factor A 1 2 Factor B 1 5 10 2 10 5 For (2) and (3), follow the procedure used above to determine what main effects and interactions exist. Based on these examples, would you say that the main effects of factor A and B are additive? Factorial ANOVA applies to the general case of 2 or more sets of related treatments. For example, one could have a 3-factor design in which light, water, and fertilizer are manipulated to determine their individual and interactive effects on plant growth. In this case we would have hypothesis tests on 3 - main effects, 3 two - way interactions, and

1 three - way interaction. Experimental designs with more factors would have an increasing number of main effects and interactions to estimate and test. PART 2: Balanced and Unbalanced Experimental Designs In a One - way ANOVA or in a Multi - Factor ANOVA with equal sample sizes under each combination of treatments, the main effects and interactions are orthogonal (independent) of each other - they are balanced. Therefore, the sums - of - squares ( calculated for each treatment effect can be uniquely attributed to that treatment). Experimental designs in which the different cells or treatment combinations have different numbers of observations associated with them are termed unbalanced. Experiments may be unbalanced by design, or become unbalanced because subjects are lost from an otherwise balanced design during the course of the experiment. In unbalanced designs, the main effects and interactions are not independent of one another. For example, part of the variation attributable to factor A could also be attributed to factor B. The sources of variation in the data are said to be confounded. The consequences of such confounding is that the results of a test for a given main effect or interaction may depend on the magnitude of other main effects or interactions. Clearly, this is not a desirable property in a statistical test. Fortunately, ways have been developed to deal with the problem. One approach to account for confounded sources of variation is to test each factor only after all variance that can be explained by other factors has been removed. This is referred to as the Unique or the Type III approach. This is the approach that should be used in most situations. The Type III only uses the variation that can be uniquely attributed to each effect. In a second approach, called the Hierarchical approach or Type II, when testing main effects, only the variation attributable to other main effects is removed prior to testing main effects. When testing 2-way interactions, the variance attributable to main effects and other 2-way interactions is removed prior to testing. When testing higher order interactions (3-way and higher), variance attributable to main effects, lower order interactions and interactions of the same order is removed prior to testing. In the final method, called the equential or Type I approach, the first main effect is tested without removing any of the variance attributable to other factors; the second main effect is tested with the variance attributable to the first removed and so forth until all effects have been tested. In P, one can perform Multi-factor ANOVA in the General Linear Model - Univariate command in the Analyze Menu. Click on the Model button to select the Type III, Type II, or Type 1. Part III: Fixed and Random Effects Factors Another complication arises in Multi-factor ANOVA as a result of the nature of the factor(s) included in a particular experiment. If for a particular factor, one includes all the relevant levels of that factor in the experiment, then the factor is said to be a fixed

effect factor. For example, for the factor sex, if both males and females are included in the experiment, then all the relevant levels have been included. Furthermore, for a factor such as water level, which could take on a wide range of values, if values are selected and included in an effort to represent the entire range of relevant levels, then such a factor is also considered a fixed effect factor. On the other hand, if the specific levels of a factor that are included in an experiment represent a random sample from a very large number of possible levels, then such a factor is called a random effects factor. An example of a random effects factor might be species or location, if the particular species or locations chosen and included in an experiment are chosen at random from a large list of possible species and locations. In experiments that include random effects factors, the effects of the factors are not independent of the particular randomly selected subset of factor levels included in the experiment so, the estimation of treatment effects and hypothesis tests differ from experimental designs with only fixed factors. However, for random effects factors one can make inferences to those levels of the factors not included in the experiment. In the example mentioned above, this would allow us to make inferences to species or sites that we did not sample, as long as they had been at equal risk of being included in the experiment. Further Instructions for Lab 7 In P, when performing any ANOVA that is more complicated than a One Way ANOVA, one selects the General Linear Model procedure from the Analyze Menu. From the submenu, choose Univariate whenever you are performing an ANOVA with all factors between-subject factors. The window for the Univariate General Linear Model will have a list of your variable on the left side of the window, and a series of boxes into which you insert your single response variable, and the names of each of the variables used to define your factors. As in an independent groups t-tests and a single factor ANOVA, factor levels must be defined by integer codes inserted into the data file. ince P does not handle Mixed models well, insert all your factor names into the box for Fixed factors. This means that you will have to choose the correct mean square for the denominators of the F-ratios and calculate them by hand if you have random factors in your ANOVA design. Ignore the Random Factors Box, The Covariate Box, and the WL Weight Box. Of the other buttons, I routinely use the Model, Plots and the Options button. The Model button is where you can specify something other than a full factorial model. For example, if you did not want to estimate the interaction effects. This is not something we will do this semester. However, under the Model button is also where you choose which type sum-of-squares you want to use. The Default is Type III which is what I recommend as well. However, to perform a Type I or Type II analysis you need to access this sub-window and make your selection. Under the Plots sub-window, you can get P to produce crude plots of the means of all the treatments. These are not great

graphs, but they are useful for interpreting the treatment effects, particularly the interaction. For a 2-Factor design decide which factor will have its means arrayed across the x-axis, and which will be displayed as separate lines. Then click over the factor names to the respective box. If you have a 3-factor design then the levels of the 3 rd factor need to be displayed in separate graphs. After clicking over the factor names you wish to graph, click the Add button. Click on Continue to return to the next higher sub-window. For the Options button, I usually request the descriptive statistics which will contain the treatments means and their standard errors. Click over the main effects (v1 and V2) and interactions (V1*V2) to get those treatment means. Click Continue return to the next higher submenu. Other buttons are not necessary for this lab, but feel free to check them out to see that they do. Click OK to run the analysis. Depending on which Options and Plots you selected you may get a variety of output. The first table should just summarize the factor levels and their respective sample sizes, the second table should be a table of descriptive statistics (if you asked for it), and the third table will be the ANOVA table. The key part of the output is the ANOVA Table which will appears in a pivot table titled Tests of Between-ubject Effects. This table will have the Means squares, df s, F s, and p values for all hypothesis tests involving the between subjects factors (in this case all the factors). Remember, if you have a Random factor in your design then you can use the Mean quares in the ANOVA Table, but you must recalculate some of the F- ratios and their significance levels by using the appropriate Mean quare in the denominator of the F- ratios. P only fits the full fixed effects model or the full random effects model (if you put your factors in the Random Effects Box when setting up the analysis). After the ANOVA table will appear a section call Profile Plots which will contain any plots of treatment means you requested. Interpretation of the output is relatively straightforward. LAB - 7 Assignment A) A data file on the plant growth experiment example above has been created called PLGR1 (plgr1.dat ). Each case has three variables: 1) The fertilizer treatment (1 through 3), 2) the light treatment (1 and 2), and 3) the dry weight of the plant after 10 weeks of growth. Use P to analyze the data. pecify: a) the hypotheses tested, b) the result of the hypothesis tests, and c) interpret the results with respect to the experiment. B) Graph the means for each treatment combination in the experiment. Does the graphical analysis corroborate the statistical analysis?

C) Repeat the analysis using either the Type I or the Type II approach. Report on any differences from A). D) Another researcher attempted to replicate the experiment. Unfortunately, during the final phase of the experiment a raccoon got into the plot and ate half the plants. The data from that experiment is on file PLGR2 (plgr2.dat). Analyze the results of this experiment using Type I, II and III. Compare the results to each other. E) Repeat D) reversing the order the factors appear in the factors window. Compare the results to those of D). Which method for dealing with unbalanced designs would be best? Which requires the largest number of arbitrary decisions? Lab 7 In R To perform a 2-factor between subjects ANOVA using Type I sums-of-squares () Using the data files plgr2.csv and 'plgr1.csv' which has integer codes for column 1 = fertilizer (3 levels) and column 2 = light (2 levels), and column 3 which is plant growth First coerce fertilizer and light to be factors f<-as.factor(fert) l<-as.factor(light) Then fit the ANOVA model and get a summary: summary(aov(growth~f*l) >summary(aov(growth~f+l+f*l)) Df um q Mean q F value Pr(>F) f 2 630.89 315.443 4.3449 0.02452 * l 1 59.46 59.463 0.8191 0.37445 f:l 2 574.99 287.497 3.9600 0.03264 * Residuals 24 1742.40 72.600 ignif.codes: 0 *** 0.001 ** 0.01 * 0.05. 0.1 1 Note that for Type I, the order the factors are entered in the model specification (f*l or l*f) will affect the outcome of the analysis when you have unequal sample sizes in the treatments. imilarly for an analysis using Type II, but not for a Type III analysis. To perform a 2-factor between subjects ANOVA using Type II or Type III sums-ofsquares () To obtain an analysis using either Type II or Type III, Google and download the CAR package (Companion to Applied Regression) and insert the folder in the Library folder in your installation of R.

Important Note: Before the CAR package can be used to perform type II and type III ANOVAs, the following code must be entered: options(contrasts=c( contrasts.helmert, contrasts.poly )) To activate CAR use: library(car) till using the data file plgr2.txt, create a linear model object (lm) and name it using: jj5<-lm(growth~f*l) And perform an Anova on jj5 Anova(jj5,type= II ) Note that the first letter of this form of Anova is capitalized in order to get the CAR function Anova rather than the R functionanova or aov. > jj5<-lm(growth~f*l) >Anova(jj5,type="II") Anova Table (Type II tests) Response: growth um q Df F value Pr(>F) f 679.70 2 4.6811 0.01921 * l 59.46 1 0.8191 0.37445 f:l 574.99 2 3.9600 0.03264 * Residuals 1742.40 24 To obtain Type III Anova(jj4,type= III ) >Anova(jj4,type="III") Anova Table (Type III tests) Response: growth um q Df F value Pr(>F) (Intercept) 26484.6 1 364.8025 5.08e-16 *** f 322.3 2 2.2197 0.13046 l 8.1 1 0.1121 0.74068 f:l 575.0 2 3.9600 0.03264 * Residuals 1742.4 24 To perform a univariate 2 factor Anova with one within and one between-subjects factor

Using the data file repdat.txt which has 4 columns, column 1 an integer code for subject called id, column 2 an integer code for the levels of the between-subjects factor called treat, column 3 an integer code for the within subjects factor called time, and column 4 animal density called den. Using an alternative means to coerce variable to be factors the syntax necessary after reading and attaching the data file is summary(aov(den~factor(treat)*factor(time)+error(factor(id)))) The error term could also be specified as Error(factor(id)/treat)) to more clearly indicate it is the subjects within treatment groups that will be the error term for the withinsubjects factors. Note that the syntax factor(variable name) is sufficient to coerce the input variable from numeric to factor levels. The presence of a single within subjects factor is established by specifying an Error term (note that the first letter in Error is capitalized) as Error (id) since id = subject. >summary(aov(den~factor(treat)*factor(time)+error(factor(id)))) Error: factor(id) Df um q Mean q F value Pr(>F) factor(treat) 1 13.709 13.7093 2.015 0.1935 Residuals 8 54.430 6.8038 Error: Within Df um q Mean q F value Pr(>F) factor(time) 2 82.18 41.090 4.7720 0.023694 * factor(treat):factor(time) 2 149.23 74.613 8.6654 0.002820 ** Residuals 16 137.77 8.611 --- ignif.codes: 0 *** 0.001 ** 0.01 * 0.05. 0.1 This analysis assumes that the var-cov matrix of the within subject factor is spherical, and provides no means to test for departure from this essential assumption of a univariate within-subjects ANOVA. Departures from sphericity lead a higher rate of rejecting the null hypothesis when true, so normally univariate tests are adjusted for departures from sphericity.