1 / 13

ANOVA with more experimental designs

ANOVA with more experimental designs. Xuhua Xia xxia@uottawa.ca http:// dambe.bio.uottawa.ca. Two-way experimental design. Testing the effect of food (HF: high-fat) and LF: low-fat) and sex (M and F) on rabbit weight gain (WG). WG Food Sex 71.1 HF M 60.6 LF M 67.9 HF M 53.8 LF M

edan-buck
Télécharger la présentation

ANOVA with more experimental designs

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. ANOVA with more experimental designs Xuhua Xia xxia@uottawa.ca http://dambe.bio.uottawa.ca

  2. Two-way experimental design Testing the effect of food (HF: high-fat) and LF: low-fat) and sex (M and F) on rabbit weight gain (WG) WG Food Sex 71.1 HF M 60.6 LF M 67.9 HF M 53.8 LF M 69.9 HF M 47.6 LF M 65.7 HF F 50.8 LF F 59.4 HF F 50.5 LF F 67.7 HF F 53.9 LF F Full model: fit <- aov(WG ~ Food*Sex) summary(fit) print(model.tables(fit,"means"),digits=3) boxplot(WG~Food) boxplot(WG~Sex) boxplot(WG~Food+Sex) Save data to TwoWayANOVA.txt and retrieve into R to do analysis

  3. What is Interaction? When the effect of FOOD is independent of SEX, e.g., when HFfood leads to greater weight gain in both males and females to the same extent, then there is no interaction term. When the effect of FOOD depends on SEX, e.g., when males gain more weight than females with HF food but less weight than females with LF food, then there is an interaction effect. 160 160 LF 140 HF 120 120 HF 100 Weight gain Weight gain 80 80 LF 60 40 40 20 0 0 Male Female Male Female Sex Sex Why one should be cautious in interpreting the main effects when there is a significant interaction?

  4. Two-way experimental design Testing the effect of food (HF: high-fat) and LF: low-fat) and sex (M and F) on rabbit weight gain (WG) WG Food Sex 71.1 HF M 60.6 LF M 67.9 HF M 53.8 LF M 69.9 HF M 47.6 LF M 50.8 HF F 65.7 LF F 50.5 HF F 59.4 LF F 53.9 HF F 67.7 LF F Save data to TwoWayANOVAInteraction.txt and retrieve into R to do analysis Full model: fit <- aov(WG ~ Food*Sex) summary(fit) print(model.tables(fit,"means"),digits=3) boxplot(WG~Food) boxplot(WG~Sex) boxplot(WG~Food+Sex) Can one do a t-test when each group has only one observation? Can one test interaction when each combination has only one observation?

  5. Three-way ANOVA Race Sex HFLF Short-ear Male Female Long-ear Male Female Short-ear Male 65.2, 64.551.1, 52.0 Female 61.0, 61.250.0, 50.1 Long-ear Male 70.0, 71.260.1, 58.8 Female 65.0, 65.555.0, 54.6 Organize data into four columns (WtGain, Sex, Food and Race), save to file ThreeWayANOVA.txt, retrieve into R and do data analysis.

  6. Model I and Model II ANOVA • Model I ANOVA tests the differential effects of the fixed treatment.xij =  + i + ijwhere i stands for fixed treatment effects (e.g., between control and treatment, between male and female, etc.). • Model II ANOVA tests the differential effects of a random variable (mainly for facilitating experimental design).xij =  + Ai + ijwhere Ai stands for random treatment effects (e.g., between randomly sampled rabbits, trees, etc.). Metabolic rate in rabbit liver cells, taken for two samples of liver tissue Replicate 1 2 1 3 2 6 7 5 How can we optimize the experiment? More rabbits or more replicates?

  7. Fixed and random effects • An example from a previous lecture: • Fixed effect: Difference among drugs • Random effect: Difference among subjects • Mixed ANOVA. • Using test subjects as blocks is equivalent in design to repeated measures ANOVA or within-subject ANOVA (the last two being synonymous) • When analyzing the data using repeated measures ANOVA, one explicitly states that one is NOT interested in the random effects. That is, one is interested only in the fixed effect, i.e., the drug effect. • When analyzing the data using randomized complete block ANOVA, one's main interest is in the fixed effect, but one also wishes to know variations from the random effect, i.e., variation among the subjects. • The p value for the fixed effect is the same using either repeated measures ANOVA or randomized complete block ANOVA.

  8. RCB and repeated measures ANOVA Organize data into four columns (Efficacy, Subject, Drug), save to file RepeatedMeasure.txt, retrieve into R and do data analysis (Remember to use 'factor' if Drug and Subject are coded by numbers): Randomized complete block ANOVA> fit<-aov(Efficacy~Drug+Subject)> summary(fit)> model.tables(fit,"means") Repeated Measures ANOVA> fit<-aov(Efficacy~Drug+Error(Subject/Drug))> summary(fit)> model.tables(fit,"means") What is wrong if we use the following ANOVA specification to analyze the data?> fit<-aov(Efficacy~Drug*Subject)

  9. Confusing terminology in ANOVA • Within-subject ANOVA and repeated measure ANOVA are synonymous. • Randomized complete block design is equivalent in computation to one-way within-subject ANOVA • When the fixed effect has only two levels, RCB, one-way within-subject ANOVA and paired-sample t-test are all equivalent and will produce the same p value given the null hypothesis of equal means. • Ex: • Testing differences in the abundance of algal biomass between the northern and southern sides of lakes. Fifteen lakes were used and algal biomass is measured for the northern and southern sides in each lake • Testing differences in the expression of a gene between different organs, e.g., brain, liver, kidney. Ten female fish were used, and gene expression is measured for different tissues in each fish

  10. Lake Biomass at North and South Sides Fixed effect: Difference between North and South Random effect: Differences among lakes. Null hypothesis: No difference between North and South. Save the data to file LakeBiomass.txt and analyze the data in R. > myDat<- read.table("LakeBiomass.txt",header=TRUE) > attach(myDat) > Lake<- factor(Lake) > fit <- aov(Site~Tissue+Error(Fish/Tissue)) > summary(fit) > model.tables(fit,"means") In-classroom exercise: Do a randomized complete block ANOVA with Lake as blocks Do a paired sample t-test by either creating a data file, or by extracting data from myDat, e.g., > N<-subset(Biomass,Site=="North")> S<-subset(Biomass,Site=="South")> t.test(N,S,paired=T) Compare the p value from the three significance tests.

  11. Typical Data What are the fixed effect and random effect? Save the data in file OrganGeneExpression.txt and analyze in R. > myDat<- read.table("OrganGeneExpression.txt",header=TRUE) > attach(myDat) > Fish <- factor(Fish) > fit <- aov(Expr~Tissue+Error(Fish/Tissue), myDat) > summary(fit) > model.tables(fit,"means")

  12. Twoway within-subject ANOVA DV: Biomass IV: Iron application (Iron): fixed effect IV: Site (North and South): fixed effect IV: Lake: random effect Reorganizethe data into four columns (Biomass, Lake, Iron, and Site with North and South) and save the data in file LakeIronBiomass.txt and analyze in R: md<-read.table("LakeIronBiomass.txt",header=T) fit<-aov(Biomass~Iron*Site+Error(Lake/(Iron*Site)),md) Interpretation of results: Check if there is significant interaction between Iron and Site. If yes, interpret the effect of Iron at each level of Site (or the effect of Site at each level of iron) If no, then interpret significant main effects (Iron and Site).

  13. Bartlett’s Test The null hypothesis for the F-test (or variance ratio test): H0: v1 = v2. The null hypothesis for Bartlett’s or Levene test: H0: v1 = v2 = ... = vn. Save the data to a file, say, BartlettTest.txt, using "." for the missing value under Treat2. Read the data into R by using md<-read.table(…,na.strings=".") >bartlett.test(md) "Bc" in the table is "K-squared" in the output of bartlett.test. You may also organize the data into two columns, i.e., DV and IV, and then use >bartlett.test(DV~IV)

More Related