0
我正在从biotools
R包中进行boxM测试来测试方差 - 协方差矩阵的同质性。我正在研究一个名为rattle
的r包中的“wine”数据集。 首先,我安装了library(car)
。然后,我对所有变量进行了以下转换,以便在Box's M测试后为LDA或QDA准备数据集。biofools R包中的boxM测试
wine1 <- data.frame(wine)
wine1$Type <- as.factor(wine1$Type)
wine1$Alcohol <- as.numeric(wine1$Alcohol) # I converted all other variables to "numeric" class.
当我跑boxM测试在RStudio [0.99.489版和Mozilla/5.0(Macintosh上;英特尔的Mac OS X 10_11_4)为AppleWebKit/601.5.17(KHTML,例如Gecko)]作为
boxM(wine2[,-c(4, 11, 12, 13)], wine2[,1]) # No physical factors
boxM(wine2[,-c(2, 3, 5, 6, 7, 8, 9, 10, 14)], wine2[,1]) # No chemical factor
它返回以下错误
Error: is.numeric(x) || is.logical(x) is not TRUE
您还没有定义'wine2' –