This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # | |
| # Start with Basic ANOVA | |
| # | |
| p16.7 <- read.table("CH16PR07.txt",col.names=c("improvement","rd","observation")) | |
| attach(p16.7) | |
| rdf <- factor(rd,levels=c(1:3),labels=c("Low","Moderate","High")) | |
| result <- lm(improvement~rdf) | |
| anova(result) | |
| boxplot(improvement~rdf) | |
| # |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # | |
| # Start with Basic ANOVA | |
| # | |
| p16.7 <- read.table("CH16PR07.txt",col.names=c("improvement","rd","observation")) | |
| attach(p16.7) | |
| rdf <- factor(rd,levels=c(1:3),labels=c("Low","Moderate","High")) | |
| result <- lm(improvement~rdf) | |
| anova(result) | |
| boxplot(improvement~rdf) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # | |
| # Start with Basic ANOVA | |
| # | |
| p16.7 <- read.table("CH16PR07.txt",col.names=c("improvement","rd","observation")) | |
| attach(p16.7) | |
| rdf <- factor(rd,levels=c(1:3),labels=c("Low","Moderate","High")) | |
| result <- lm(improvement~rdf) | |
| anova(result) | |
| boxplot(improvement~rdf) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # | |
| # Start with Basic ANOVA | |
| # | |
| data <- read.table("CH18TA05.txt",col.names=c("failure","loc","observation")) | |
| attach(data) | |
| locf <- factor(loc,levels=c(1:3),labels=c("Loc 1","Loc 2","Loc 3")) | |
| result <- lm(failure~locf) | |
| anova(result) | |
| boxplot(failure~locf) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 1/sqrt(2)*qtukey(.90,6,60-6) | |
| (S <- sqrt((6-1)*qf(.90,6-1,60-6))) | |
| g <- c(2,5,15) | |
| qt(1-.10/(2*g),60-6) | |
| 1/sqrt(2)*qtukey(.95,5,25-5) | |
| (S <- sqrt((5-1)*qf(.95,5-1,25-5))) | |
| g <- c(2,5,10) | |
| qt(1-.05/(2*g),25-5) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Example 1 | |
| data <- read.csv("chol_hair_music.csv") | |
| attach(data) | |
| head(data) | |
| # Box Plots | |
| boxplot(chol~hair) | |
| boxplot(chol~music) | |
| boxplot(chol~music:hair) | |
| # Balanced? | |
| table(music,hair) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # | |
| # Two Factor ANOVA | |
| # | |
| data <- read.csv("tomatoes.csv") | |
| attach(data) | |
| table(variety,density) | |
| boxplot(yield~variety:density) | |
| res1 <- lm(yield~variety*density) | |
| anova(res1) | |
| plot(res1,1) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| data <- read.table("Strawberry.txt",header=TRUE) | |
| attach(data) | |
| boxplot(Yield~Treatment) | |
| boxplot(Yield~Block) | |
| res <- lm(Yield~factor(Block)*Treatment) | |
| anova(res) | |
| res <- lm(Yield~factor(Block)+Treatment) | |
| anova(res) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # | |
| # Generate random beer data | |
| # | |
| set.seed(314159) | |
| ibv <- .5 # Inner Beer Variation | |
| mu.i <- rnorm(8,18,4) | |
| sodium <- rnorm(6*8,mu.i,ibv) | |
| beer <- rep(1:8,6) | |
| plot(sodium~beer) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Classic repeated measures example | |
| # Finding the results of a wine tasting | |
| # 3 wines, 22 judges. The judges are the repeated measure | |
| data <- read.csv("wine_taste.csv") | |
| attach(data) | |
| interaction.plot(Wine,Taster,Taste) | |
| # | |
| # Naive assumptions, no repeated measures | |
| # | |
| res <- lm(Taste~Wine) |