library(faraway)
data(composite)
summary(composite)
g <- lm(strength ~ laser + tape, composite)
with(composite,interaction.plot(laser,tape,strength,legend=F))
with(composite,interaction.plot(tape,laser,strength,legend=F))
coef(g)
lasercoefs <- rep(c(0,6.5733,12.2133),3)
tapecoefs <- rep(c(0,4.0367,-1.4800),each=3)
h <- update(g, . ~ . + I(lasercoefs*tapecoefs))
anova(h)
anova(g)
composite$laser <- as.ordered(composite$laser)
composite$tape <- as.ordered(composite$tape)
g <- lm(strength ~ laser + tape, composite)
summary(g)
contr.poly(3)
composite$Ntape <- rep(c(6.42,13,27),each=3)
composite$Nlaser <- rep(c(40,50,60),3)
gl <- lm(strength ~ Nlaser + poly(log(Ntape),2), composite)
summary(gl)
data(pvc)
attach(pvc)
stripchart(psize ~ resin,xlab="Particle size",ylab="Resin railcar")
stripchart(psize ~ operator,xlab="Particle size",ylab="Operator")
interaction.plot(operator,resin,psize)
interaction.plot(resin,operator,psize)
g <- lm(psize ~ operator*resin)
anova(g)
anova(lm(psize ~ operator + resin, pvc))
qqnorm(residuals(g))
qqline(residuals(g))
plot(fitted(g),residuals(g),xlab="Fitted",ylab="Residuals")
g <- lm(psize ~ operator+resin,subset=-45)
summary(g)
TukeyHSD(aov(psize ~ operator+resin,subset=-45))
data(speedo)
speedo
g <- lm(y ~ .,speedo)
summary(g)
model.matrix(g)
qqnorm(coef(g)[-1],pch=names(coef(g)[-1]))
halfnorm(coef(g)[-1],labs=names(coef(g)[-1]))
