# This opens the CA/MCA library library(ca) # This opens up the library which enables reading an SPSS.sav file library(foreign) #Read SPSS data file and save it as an R object (there are various files to work with) poleff <-read.spss("D:/Data/sagebuch/polefffedlo.sav",use.value.labels=FALSE) # printing the data matrix poleff # mca based on indicator matrix of poleff data mjca(poleff,lambda="indicator") summary(mjca(poleff,lambda="indicator")) # mca plot based on Burt matrix of poleff data plot(mjca(poleff,lambda="Burt"),what=c("none","all")) # writing data into Burt table for running simple CA poleff.b <-mjca(poleff [1:9],lambda="Burt")$Burt poleff.b summary(ca(poleff.b)) # different plot options plot(ca(poleff.b)) plot(ca(poleff.b),dim=c(1,2),what=c("none","all"),col=c("#000000"),pch=c(16,2,20,2)) #adding subset variables, first dk, second neithernor, third dk and neithernor subpoleff <- c(6,12,18,24,30,36,42,48,54) subpoleff2 <- c(3,9,15,21,27,33,39,45,51) subpoleff3 <- c(3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,48,51,54) subpoleffmain <- c(1,2,4,5,7,8,10,11,13,14,16,17,19,20,22,23,25,26,28,29,31,32,34,35,37,38,40,41,43,44,46,47,49,50,52,53) subpoleffnodk <- c(1:5,7:11,13:17,19:23,25:29,31:35,37:41,43:47,49:53) sub1 <- c(1,7,13,19,25,31,37,47,53) sub2 <- c(2,8,14,20,26,32,38,46,52) sub3 <- c(3,9,15,21,27,33,39,45,51) sub4 <- c(4,10,16,22,28,34,40,44,50) sub5 <- c(5,11,17,23,29,35,41,43,49) sub9 <- c(6,12,18,24,30,36,42,48,54) summary(ca(poleff.b,nd=3)) summary(ca(poleff.b,subsetcol=sub1,subsetrow=sub1)) summary(ca(poleff.b,subsetcol=sub2,subsetrow=sub2)) summary(ca(poleff.b,subsetcol=sub3,subsetrow=sub3)) summary(ca(poleff.b,subsetcol=sub4,subsetrow=sub4)) summary(ca(poleff.b,subsetcol=sub5,subsetrow=sub5)) summary(ca(poleff.b,subsetcol=sub9,subsetrow=sub9)) summary(ca(poleff.b,subsetcol=subpoleffmain,subsetrow=subpoleffmain)) summary(ca(poleff.b,subsetcol=subpoleffnodk,subsetrow=sub9)) summary(ca(poleff.b,subsetcol=subpoleffnodk,subsetrow=subpoleffnodk,nd=3)) summary(ca(poleff.b,subsetcol=subpoleffmain,subsetrow=subpoleff3)) plot(ca(poleff.b,subsetcol=subpoleff,subsetrow=subpoleff),dim=c(1,2),what=c("none","all"),col=c("#000000"),pch=c(16,2,20,2)) plot(ca(poleff.b,subsetcol=subpoleff2,subsetrow=subpoleff2),dim=c(1,2),what=c("none","all"),col=c("#000000"),pch=c(16,2,20,2)) plot(ca(poleff.b,subsetcol=subpoleff3,subsetrow=subpoleff3),dim=c(1,2),what=c("none","all"),col=c("#000000"),pch=c(16,2,20,2)) plot(ca(poleff.b,subsetcol=subpoleffmain,subsetrow=subpoleffmain),dim=c(1,2),what=c("none","all"),col=c("#000000"),pch=c(16,2,20,2)) plot(ca(poleff.b,subsetcol=subpoleffnodk,subsetrow=subpoleffnodk),dim=c(1,2),what=c("none","all"),col=c("#000000"),pch=c(16,2,20,2)) plot(ca(poleff.b,subsetcol=subpoleffmain,subsetrow=subpoleff3),dim=c(1,2),what=c("all","all"),col=c("#000000"),pch=c(20,2,20,2)) plot(ca(poleff.b,subsetcol=sub1,subsetrow=sub1),dim=c(1,2),what=c("none","all"),col=c("#000000"),pch=c(16,2,20,2)) plot(ca(poleff.b,subsetcol=sub2,subsetrow=sub2),dim=c(1,2),what=c("none","all"),col=c("#000000"),pch=c(16,2,20,2)) plot(ca(poleff.b,subsetcol=sub4,subsetrow=sub4),dim=c(1,2),what=c("none","all"),col=c("#000000"),pch=c(16,2,20,2)) plot(ca(poleff.b,subsetcol=sub5,subsetrow=sub5),dim=c(1,2),what=c("none","all"),col=c("#000000"),pch=c(16,2,20,2))