#This opens up the library which enables using CA, download from CRAN 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 #As input we use the indicator matrix (text data in D:/...) either with passive variables issp <-read.table('D:/DATA/sagebuch/chapter 3/ISSP2003australia2.txt') #The last seven columns (variables) contain the passive ones, definiton of supplementary variables subisspsv <- c(57,58,59,60,61,62,63) # summary statistic for rows and columns with supplementary variables summary(ca(issp,nd=3,supcol=subisspsv)) # plot of all variables (active and passive) from indicator matrix plot(ca(issp),dim=c(1,2),what=c("none","all"),col=c("#000000"),pch=c(149,2,149,2)) # plot of respondents from indicator matrix plot(ca(issp),dim=c(1,2),what=c("all","none"),col=c("#000000"),pch=c(149,2,149,2)) # Definition of different subsets subissp1 <- c(1,5,9,13,17,21,25,29,33,37,41,45,49,53) subissp14 <- c(1,4,5,8,9,12,13,16,17,20,21,24,25,28,29,32,33,36,37,40,41,44,45,48,49,52,53,56) subissp23 <- c(2,3,6,7,10,11,14,15,18,19,22,23,26,27,30,31,34,35,38,39,42,43,46,47,50,51,54,55) subissp2 <- c(2,6,10,14,18,22,26,30,34,38,42,46,50,54) subissp3 <- c(3,7,11,15,19,23,27,31,35,39,43,47,51,55) subissp4 <- c(4,8,12,16,20,24,28,32,36,40,44,48,52,56) #summary statistics for Subset MCA summary(ca(issp,subsetcol=subissp2)) summary(ca(issp,subsetcol=subissp3)) summary(ca(issp,subsetcol=subissp4)) summary(ca(issp,subsetcol=subissp23)) summary(ca(issp,subsetcol=subissp1)) #plot of Subset MCA plot(ca(issp,subsetcol=subissp1),dim=c(1,-2),what=c("none","all")) plot(ca(issp,subsetcol=subissp4),dim=c(1,2),what=c("none","all"))