假設共有4組試驗, 其中F1(LA1312xLA1543)為對照組, 另有3 組實驗組(親本LA1312,LA1543,LA1589)。每組試驗各有5重複。
1.安裝package-> multcomp
#20個番茄果實長寬比的觀測值
>y=c(1.233754545,1.1738625,1.21531,1.3708,1.251022222,1.464914286,1.4413,1.266463636,1.492966667,1.30975,1.302936364,1.296875,1.2109,1.286966667,1.2878,1.013746667,0.986116667,1.008646154,1.0426,1.031922222)
#將其分為四組,共五重複
> trt=gl(4,5,label=c("F1","LA1312","LA1543","LA1589"))
#打開package,沒有打開就做不了,所以一定要用library打開。
> library(multcomp)
Loading required package: mvtnorm
Loading required package: survival
Loading required package: splines
#執行ANOVA,發現其有顯著差異,再利用Dunnett 去看是哪幾個跟對照組有差異。
> out=aov(y~trt)
> summary(out)
Df Sum Sq Mean Sq F value Pr(>F)
trt 3 0.3764 0.12548 28.75 1.11e-06 ***
Residuals 16 0.0698 0.00436
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
#glht 來做單一對比與直交對比
> glht(out,linfct=mcp(trt="Dunnett"))
General Linear Hypotheses
Multiple Comparisons of Means: Dunnett Contrasts
Linear Hypotheses:
Estimate
LA1312 - F1 == 0 0.14613
LA1543 - F1 == 0 0.02815
LA1589 - F1 == 0 -0.23234
> dunnett.out=glht(out,linfct=mcp(trt="Dunnett"))
> summary(dunnett.out)
Simultaneous Tests for General Linear Hypotheses
Multiple Comparisons of Means: Dunnett Contrasts
Fit: aov(formula = y ~ trt)
Linear Hypotheses:
Estimate Std. Error t value Pr(>|t|)
LA1312 - F1 == 0 0.14613 0.04178 3.497 0.00837 **
LA1543 - F1 == 0 0.02815 0.04178 0.674 0.84038
LA1589 - F1 == 0 -0.23234 0.04178 -5.561 < 0.001 ***
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
(Adjusted p values reported -- single-step method)
結論:可知F1(LA1543xLA1312)與LA1543形狀相似,但與LA1312和LA1589形狀有顯著不同。
沒有留言:
張貼留言