我是R的新手,在阅读了几个搜索结果之后仍然无法弄清楚如何从R中的线性模型测试不同的假设。我从3个图(处理)中分别进行了3次重复。我想测试假设P2> (P1 + P3)/ 2,其中rep作为阻断因子(rcbd),没有rep作为阻断因子(crd)。
我认为线性模型可以通过rcbd拟合
lm(resp ~ factor(plot) + factor(rep), data=pheno)
crd
lm(resp ~ factor(plot), data=pheno)
如何测试假设P2> (P1 + P3)/ 2(P代表情节)?
pheno
rep plot resp
R1 P1 12.6
R2 P1 11.9
R3 P1 12.3
R1 P2 13.0
R2 P2 12.4
R3 P2 12.4
R1 P3 11.3
R2 P3 11.9
R3 P3 10.9
答案 0 :(得分:1)
您可以使用glht
包中的multcomp
。
我们有一个关于它的页面:http://www.ats.ucla.edu/stat/r/faq/testing_contrasts.htm