我有这个小数据框,我想在{。}}上进行TukeyHSD
测试
data.frame': 4 obs. of 4 variables:
$ Species : Factor w/ 4 levels "Anthoxanthum",..: 1 1 1 1
$ Harvest : Factor w/ 4 levels "b","c","d","e": 1 2 3 4
$ Total : num 0.2449 0.1248 0.0722 0.1025
我使用aov
执行方差分析:
anthox1 <- aov(Total ~ Harvest, data=anthox)
anthox.tukey <- TukeyHSD(anthox1, "Harvest", conf.level = 0.95)
但是当我运行TukeyHSD
时,我收到此消息:
警告讯息:
在qtukey(conf.level,length(means),x $ df.residual)中:生成NaNs
任何人都可以帮助我解决问题并解释为什么会这样。我觉得一切都写得正确(代码和数据),但由于某种原因,它不想工作。
答案 0 :(得分:1)
由于每组只有一个观察点,因此您可以完美契合:
Total <- c(0.2449, 0.1248, 0.0722, 0.1025)
Harvest <- c("b","c","d","e")
anthox1 <- aov(Total ~ Harvest)
summary.lm(anthox1)
#Call:
# aov(formula = Total ~ Harvest)
#
#Residuals:
# ALL 4 residuals are 0: no residual degrees of freedom!
#
# Coefficients:
# Estimate Std. Error t value Pr(>|t|)
#(Intercept) 0.2449 NA NA NA
#Harvestc -0.1201 NA NA NA
#Harvestd -0.1727 NA NA NA
#Harveste -0.1424 NA NA NA
#
#Residual standard error: NaN on 0 degrees of freedom
#Multiple R-squared: 1, Adjusted R-squared: NaN
#F-statistic: NaN on 3 and 0 DF, p-value: NA
这意味着Tukey测试(或任何统计数据)没有足够的剩余自由度。