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
| # | |
| # 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
| # 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
| 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
| # | |
| # 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
| # | |
| # 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
| # | |
| # Built in ANOVA | |
| # | |
| p16.7 <- read.table("CH16PR07.txt") | |
| names(p16.7) <- c("improvement","rd","observation") | |
| result <- lm(improvement~rd,data=p16.7) | |
| anova(result) | |
| # | |
| result <- lm(improvement~factor(rd),data=p16.7) | |
| anova(result) |
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
| p16.7 <- read.table("CH16PR07.txt") | |
| p16.7 | |
| p16.7$V1 | |
| p16.7$V2 | |
| names(p16.7) <- c("improvement","rd","observation") | |
| p16.7$improvement | |
| p16.7$imp | |
| p16.7$rd | |
| boxplot(improvement~rd,data=p16.7) | |
| improvement |