0

我在 FactoMineR 中遇到了 MFA 问题。我正在处理一个数据集,其中包含在番茄植物中测量的物理、化学和微生物连续变量,这些变量取自 2 种不同的处理方法和 3 个时间点。我已经容纳了这样的数据:

structure(list(row.names = structure(c(1L, 4L, 7L, 10L, 13L, 
16L), .Label = c("GBA1", "GBA2", "GBA3", "GBB1", "GBB2", "GBB3", 
"GBC1", "GBC2", "GBC3", "GBD1", "GBD2", "GBD3", "GBE1", "GBE2", 
"GBE3", "RWA1", "RWA2", "RWA3", "RWB1", "RWB2", "RWB3", "RWC1", 
"RWC2", "RWC3", "RWD1", "RWD2", "RWD3", "RWE1", "RWE2", "RWE3", 
"RWF1", "RWF2", "RWF3", "RWG1", "RWG2", "RWG3", "RWH1", "RWH2", 
"RWH3", "RWI1", "RWI2", "RWI3", "RWJ1", "RWJ2", "RWJ3"), class = "factor"), 
    Trt = structure(c(2L, 2L, 2L, 2L, 2L, 1L), .Label = c("Mineral", 
    "Organic"), class = "factor"), Status = structure(c(1L, 1L, 
    1L, 1L, 1L, 1L), .Label = c("H", "S"), class = "factor"), 
    Humidity = c(87.21704394, 80.29885961, 65.68047337, 85.9775641, 
    83.33333333, 85.98568282), pH = c(5.44, 5.94, 6.64, 6.19, 
    6.13, 5.45), Conductivity = c(837L, 867L, 752L, 871L, 699L, 
    406L), Nit.N = c(436.18, 433.92, 418.1, 458.78, 411.32, 167.24
    ), Ammonia.N = c(3.8122, 2.6452, 1.945, 1.7116, 2.4896, 7.16
    ), P = c(30.95, 15.2, 20.15, 16.1, 18.35, 48.2), K = c(135, 
    35, 95, 40, 145, 275), Ca = c(1287.5, 1427.5, 1610, 1570, 
    1640, 130), Mg = c(367.5, 575, 537.5, 532.5, 590, 42.5), 
    S = c(705L, 924L, 603L, 962L, 626L, 111L), Sodium = c(92.5, 
    170, 135, 127.5, 137.5, 35), Chlorides = c(15.1, 11.1, 15.4, 
    13.2, 13.8, 10.8), Fe = c(1.5, 2.2, 1.7, 2, 2.1, 3.1), Mn = c(1.1, 
    0.55, 0.7, 0.4, 0.65, 1.9), Rhizobium = c(0, 0, 0, 0, 0, 
    0), Total.bacteria = c(7207207.207, 5454545.455, 22727272.73, 
    18918918.92, 30630630.63, 64864864.86)), .Names = c("row.names", 
"Trt", "Status", "Humidity", "pH", "Conductivity", "Nit.N", "Ammonia.N", 
"P", "K", "Ca", "Mg", "S", "Sodium", "Chlorides", "Fe", "Mn", 
"Rhizobium", "Total.bacteria"), row.names = c(NA, 6L), class = "data.frame")

我将变量分类(前 2 个),然后其他 16 个是连续的。但是,我想分别处理这 2 个分类变量。所以我写了以下代码:

>res <- MFA(Oliver, group=c(1,1,3,11,2), type=c("n", "n","s", "s","s"),ncp=5,name.group=c("Sub","Stat", "Phys", "Chem", "Microbial")) 

但是,它似乎不起作用。因此,我尝试了以下方法:

>res=MFA(Oliver,group=c(2,16),type=c(rep("n",1),rep("s",1)),ncp=5,name.group=c("cat","cont")) 

还有这个:

>res=MFA(Oliver,group=c(2, 3, 11,2),type=c(rep("n",1),rep("s",3)), ncp=5,name.group=c("type","Phys", "Chem", "Microbial"))

但我一直遇到同样的问题(“不方便的组定义”)。我可以做些什么来分别保留前 2 个分类组?我非常感谢您对如何正确运行模型的建议!

最好的祝愿,

艾玛

4

1 回答 1

0

我认为问题来自您的变量 Status,它不是变量,因为所有值都等于“H”。所以不用分析这个“变量”。您可以将其隐藏,此列中没有信息。然后,它应该可以工作。

弗朗索瓦

于 2014-04-09T14:36:31.200 回答