如何使用二元(二分)预测变量的多重对应分析?

时间:2015-12-17 15:34:45

标签: r

我希望你能帮助我。我想用一个依赖的分类变量(构造)和9个二元(二分)预测变量来做数据框的MCA。这是数据。

CONSTRUCTION<-c("in plaats van", "ten opzichte van", "met behulp van", "ten koste van", "op grond van", "onder leiding van", "in tegenstelling tot", "op basis van")
IDIOSYNC<-c("no", "yes", "yes", "yes", "no", "no", "no", "no")
ARTICLE<-c("yes", "no", "no", "no", "no", "no", "no", "no")
PLURAL<-c("no", "no", "no", "no", "no", "no", "no", "no")
MODIF<-c("no", "no", "no", "no", "no", "yes", "yes", "no")
EXTRAPOS<-c("yes", "no", "no", "yes", "no", "yes", "yes", "no")
COMPLEM<-c("no", "no", "no", "no", "no", "yes", "no", "no")
P2OPTION<-c("no", "no", "no", "no", "no", "yes", "no", "no")
P1CHBL<-c("no", "no", "no", "no", "no", "no", "no", "no")
P2CHBL<-c("no", "no", "no", "no", "no", "no", "yes", "no")

data.comp.prep<-cbind(CONSTRUCTION, IDIOSYNC, ARTICLE, PLURAL, MODIF, EXTRAPOS, COMPLEM, P2OPTION, P1CHBL, P2CHBL)

ca.comp.prep<-MCA(data.comp.prep[, -1], graph=FALSE)
plot(ca.comp.prep, cex=0.7, col.var="black", col.ind="grey")

直到现在都没问题,但是当我想查看尺寸说明时,会出现以下情况:

dimdesc(ca.comp.prep)
Error in `contrasts<-`(`*tmp*`, value = contr.funs[1 + isOF[nn]]) : 
  contrasts can be applied only to factors with 2 or more levels

这些点被映射到二维图上,但我无法查看每个维的值的描述。这有什么问题?

我提前感谢你。

1 个答案:

答案 0 :(得分:0)

问题是你有两个只有一个值的变量(PLURAL和P1CHBL)。将它们添加到MCA没有意义......它会阻止您使用dimdesc。我建议你从分析中删除它们:

ca.comp.prep <- MCA(data.comp.prep[, -c(1,3,9)], graph=FALSE)
dimdesc(ca.comp.prep)