library(multcomp)
View(cholesterol)
attach(cholesterol)
table(trt)
by(cholesterol,trt,mean)
aggregate(response,by=list(trt),mean)
aggregate(response,by=list(trt),sd)
fit <- aov(response ~ trt )
summary(fit)
library(gplots)
plotmeans(response~trt,xlab = "treatment",ylab = "response",
main="mean plot\nwith 95% CI")
aggregate(cholesterol$response,by=list(cholesterol$trt),FUN=mean)
detach(cholesterol)
TukeyHSD(fit)
par(las=2)
par(mar= c(5,8,4,2))
plot(TukeyHSD(fit))
library(multcomp)
par(mar=c(4,4,4,3))
tuk <- glht(fit,linfct=mcp(trt="Tukey"))
plot(cld(tuk,level = .05),col = "lightgrey")
library(car)
qqPlot(lm(response ~ trt , data = cholesterol),simulate = TRUE, main = "QQ plot",labels=f)
bartlett.test(response~ trt ,data =cholesterol)
library(car)
outlierTest(fit)
data(litter, package = 'multcomp')
attach(litter)
table(dose)
aggregate(weight,by= list(dose),mean)
fit <- aov(weight ~ gesttime+dose)
summary(fit)
library(multcomp)
contrast <- rbind("non drug vs. drug" = c(3,-1,-1,-1))
summary(glht(fit,linfct=mcp(dose=contrast)))
detach(litter)
fit <- aov(weight ~ gesttime*dose,data = litter)
summary(fit)
library(HH)
ancova(weight~gesttime+dose,data=litter)
attach(ToothGrowth)
table(supp,dose)
aggregate(len, by=list(supp,dose),FUN=mean)
len
aggregate(len,by=list(supp,dose),FUN=sd)
dose=factor(dose)
dose
fit <- aov(len ~ supp*dose)
summary(fit)
detach(ToothGrowth)
interaction.plot(dose,supp,len,type='b',
col=c('red','blue'),pch=c(16,18),
main='interaction betwwen dose and supplement type')
library(gplots)
plotmeans(len ~ interaction(supp, dose,sep = ' '),
connect = list(c(1,3,5),c(2,4,6)),
col=c('red','darkgreen'),
main='interaction plot eith 95% CIS',
xlab = 'treatment anf dose combination')
library(HH)
interaction2wt(len~supp*dose)
CO2$conc <- factor(CO2$conc)
W1b1 <- subset(CO2,Treatment=='chilled') #
fit <- aov(uptake~conc*Type + Error(Plant/(conc)),W1b1)
summary(fit)
par(las=2)
par(mar=c(10,4,4,2))
with(W1b1,interaction.plot(conc,Type,uptake,
type = 'b',col = c('red','blue'),pch=c(16,18),
main='interaction plot for plant type and concentration'))
boxplot(uptake~Type*conc,data=W1b1,col=(c('gold','green')),
main='chilled quebec and mississippi panlts',
ylab='carbon dioxide uptake rate (umol/m^2 sec)')
Valar morghulis
浙公网安备 33010602011771号