Created
April 22, 2011 01:08
-
-
Save marutter/935816 to your computer and use it in GitHub Desktop.
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
# Bottling Plant Example | |
# Factor A: Machines - 3 levels | |
# Factor B: Operators nested withing machines - 4 each | |
# Response: Cases produced | |
data <- read.csv("nested.csv") | |
attach(data) | |
machf <- factor(machine) | |
operf <- factor(operator) | |
library(lattice) | |
xyplot(cases~operf|machf) | |
# | |
# Bad | |
# | |
res.1 <- lm(cases~machf) | |
anova(res.1) | |
res.2 <- lm(cases~machf*operf) | |
anova(res.2) | |
# | |
# Correct | |
# | |
res.n <- lm(cases~machf/operf) | |
anova(res.n) | |
# | |
TukeyHSD(aov(res.n),conf.leve=1-.05/2) # Both factors are significant | |
model.tables(aov(res.n),type="means") | |
# 4*3/2 comparions within each machine | |
# 3 machines | |
# 18 total | |
qt(1-.05/(2*18*2),48) # extra 2 since both factors are significant | |
qt(1-.05/(2*18*2),48)*sqrt(23.60) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment