R语言中的含一个组间因子和一个组内因子的重复测量方差分析

来源:互联网 发布:淘宝店铺会员积分兑换 编辑:程序博客网 时间:2024/05/17 08:23
我们关注寒带植物。因变量是二氧化碳吸收量(uptake),单位为ml/L,自变量是植

物类型Type(魁北克VS密西西比州)和七种水平(95~1000 umol/m^2 sec)的二氧化碳浓度(conc)。另外,Type是组间因子,conc是组内因子

w1b1 <- subset(CO2, Treatment == "chilled")
fit <- aov(uptake ~ (conc * Type) + Error(Plant/(conc)), w1b1)
summary(fit)
Error: Plant
          Df Sum Sq Mean Sq F value  Pr(>F)   
Type       1 2667.2  2667.2   60.41 0.00148 **
Residuals  4  176.6    44.1                   
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1


Error: Plant:conc
          Df Sum Sq Mean Sq F value   Pr(>F)    
conc       1  888.6   888.6  215.46 0.000125 ***
conc:Type  1  239.2   239.2   58.01 0.001595 ** 
Residuals  4   16.5     4.1                     
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1


Error: Within
          Df Sum Sq Mean Sq F value Pr(>F)
Residuals 30    869   28.97  

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 Plants", ylab = "Carbon dioxide uptake rate (umol/m^2 sec)")


0 0