运行此代码时,我在ANOVA表中得到了NAN值。我认为“ V3”列的因素未正确排序。那是问题吗?
我也在statsmodel中尝试了OLS库(用于python),但是我也遇到了有关NaN和无限值的错误。
data <- read.csv(file = 'dogs2.csv',header=FALSE, sep=",")
data
V1 V2 V3
0.28 Dog 1 Isofluorane
0.3 Dog 1 Halothane
1.07 Dog 1 Cyclopropane
0.51 Dog 2 Isofluorane
0.39 Dog 2 Halothane
1.35 Dog 2 Cyclopropane
1 Dog 3 Isofluorane
0.63 Dog 3 Halothane
0.69 Dog 3 Cyclopropane
0.39 Dog 4 Isofluorane
0.68 Dog 4 Halothane
0.28 Dog 4 Cyclopropane
0.29 Dog 5 Isofluorane
0.38 Dog 5 Halothane
1.24 Dog 5 Cyclopropane
0.36 Dog 6 Isofluorane
0.21 Dog 6 Halothane
1.53 Dog 6 Cyclopropane
0.32 Dog 7 Isofluorane
0.88 Dog 7 Halothane
0.49 Dog 7 Cyclopropane
0.69 Dog 8 Isofluorane
0.39 Dog 8 Halothane
0.56 Dog 8 Cyclopropane
0.17 Dog 9 Isofluorane
0.51 Dog 9 Halothane
1.02 Dog 9 Cyclopropane
0.33 Dog 10 Isofluorane
0.32 Dog 10 Halothane
0.3 Dog 10 Cyclopropane
anova(lm(as.numeric(data$V1) ~ as.factor(data$V2) * as.factor(data$V3), data))
Warning message in anova.lm(lm(as.numeric(data$V1) ~ as.factor(data$V2) * as.factor(data$V3), :
"ANOVA F-tests on an essentially perfect fit are unreliable"
Df Sum Sq Mean Sq F value Pr(>F)
as.factor(data$V2) 9 268.9667 29.88519 NaN NaN
as.factor(data$V3) 2 168.4667 84.23333 NaN NaN
as.factor(data 2):.( V3) 18 827.5333 45.97407 NaN NaN
Residuals 0 0.0000 NaN NA NA
我不确定为什么F统计量是NaN。
编辑:当我摆脱了与模型的交互并使用“ V2 + V3”而不是“ V2 * V3”时,方差分析表已完成。但是,我确定要测量这两个变量之间的相互作用。
答案 0 :(得分:0)
答案:
String format = "yyyy-MM-dd'T'HH:mm:ss.ssZ";
System.out.println(OffsetDateTime.now().format(DateTimeFormatter.ofPattern(format)));
System.out.println(ZonedDateTime.now().format(DateTimeFormatter.ofPattern(format)));
单向方差分析