问题描述
如何使用方差分析研究主要因素对响应的影响?
解决方法
您可以很容易地计算 y 在 A、B 和 C 的不同水平上的平均值:
by( y,B,mean ) # mean of y at each level
diff( by( y,mean ) ) # the difference of the means at the two available levels of y
# same for A and C:
by( y,C,mean )
# etc.
我并没有真正看到您绘制的 newdata
变量,但假设它只是 data.frame(A,y)
,我的数字在预测变量的水平上与 y 的均值相匹配。虽然我的身材和你的略有不同。