2015-12-17 65 views
0

我試圖用分類預測器繪製MCA中的95%置信度elipses時遇到了一些麻煩。以下是我的數據和代碼示例。如何繪製多元對應分析的二元(二元)預測變量的置信橢圓?

我不明白問題出在哪裏來自和我在(M)CA新:

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[, -c(1, 4, 9)], graph=FALSE) 
plot(ca.comp.prep, cex=0.7, col.var="black", col.ind="grey") 
ca.comp.prep1<-MCA(data.comp.prep[, -c(4, 9)], quali.sup=1, graph=FALSE) 
plot(ca.comp.prep1, invis="ind", col.var="darkgrey", col.quali.sup="black") 

的問題,當我爲繪製橢圓運行代碼出現。

回答

0

ca.comp.prep1是包含MCA結果的列表。你試圖索引它,就好像它是一個有兩個維度的data.frame。這裏的[,c(4,9)]是不合情理的。

然後,您試圖爲第一個變量ca.comp.prep1繪製省略號,它基本上是一個行ID(它對每個人都有不同的值)。沒有橢圓是可能的,因爲每個類別只有一個點。

我的建議是,你不應該在MCA中添加第一個變量;繼續學習ca.comp.prep,忘記ca.comp.prep1。然後繪製橢圓:

plotellipses(ca.comp.prep, keepvar=1, label="quali") 

如果您仍想上ca.comp.prep1完成後,嘗試另一個變量:

plotellipses(ca.comp.prep1, keepvar=2, label="quali")