temp=rep(c(300,500,750,800),c(5,5,5,5))
rst=c(90,92,88,89,92,95,92,88,89,92,96,96,97,94,92,91,90,93,89,88)
temp_factor=factor(temp)
df=data.frame(rst,temp_factor)
aov(rst~temp_factor,df)
Call:
aov(formula = rst ~ temp_factor, data = df)
Terms:
temp_factor Residuals
Sum of Squares 78.15 74.40
Deg. of Freedom 3 16
这是正确的。而以下是错误的,这是为什么
temp=rep(c(300,500,750,800),c(5,5,5,5))
rst=c(90,92,88,89,92,95,92,88,89,92,96,96,97,94,92,91,90,93,89,88)
temp_factor=factor(temp)
df=data.frame(cbind(rst,temp_factor))
aov(rst~temp_factor,df)
为什么加上了一句,cbind之后就变成了。。
Call:
aov(formula = rst ~ temp_factor, data = df)
Terms:
temp_factor Residuals
Sum of Squares 3.61 148.94
Deg. of Freedom 1 18
Residual standard error: 2.876533