Anova with more experimental designs
This presentation is the property of its rightful owner.
Sponsored Links
1 / 13

ANOVA with more experimental designs PowerPoint PPT Presentation


  • 79 Views
  • Uploaded on
  • Presentation posted in: General

ANOVA with more experimental designs. Xuhua Xia [email protected] 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). WGFoodSex 71.1HFM 60.6LFM 67.9HFM 53.8LFM

Download Presentation

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.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -

Presentation Transcript


Anova with more experimental designs

ANOVA with more experimental designs

Xuhua Xia

[email protected]

http://dambe.bio.uottawa.ca


Two way experimental design

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)

WGFoodSex

71.1HFM

60.6LFM

67.9HFM

53.8LFM

69.9HFM

47.6LFM

65.7HFF

50.8LFF

59.4HFF

50.5LFF

67.7HFF

53.9LFF

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


What is interaction

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?


Two way experimental design1

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)

WGFoodSex

71.1HFM

60.6LFM

67.9HFM

53.8LFM

69.9HFM

47.6LFM

50.8 HFF

65.7 LFF

50.5 HFF

59.4 LFF

53.9 HFF

67.7 LFF

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?


Three way anova

Three-way ANOVA

RaceSexHFLF

Short-earMale

Female

Long-earMale

Female

Short-earMale65.2, 64.551.1, 52.0

Female61.0, 61.250.0, 50.1

Long-earMale70.0, 71.260.1, 58.8

Female65.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.


Model i and model ii anova

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

1213

2675

How can we optimize the experiment? More rabbits or more replicates?


Fixed and random effects

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.


Rcb and repeated measures anova

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)


Confusing terminology in anova

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


Lake biomass at north and south sides

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.


Typical data

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")


Twoway within subject anova

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).


Bartlett s test

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)


  • Login