You should send this to r-help@stat.math.ethz.ch. On 03/09/2012 09:21 AM, Andrea Sica wrote:> Hello everybody, I'm looking for someone who is able with MCA and > would like to gives some help. > > If what I'm doing is not wrong, according to the purpose I have, I > need to understand how to create a dependence matrix, where I can > analyze the > dependence between all my variables. > Till now this is what I was able to do: > > /p <- length(spain)/ #this is the number of the variables (91) > > /chisquare <- matrix(spain, nrow=(p-1), ncol=p)/ #it creates a > squared-matrix with all the variables (if I'm not already wrong) > > /for(i in (1:(p-1))){/ > /chisquare[i, (1:(p-1))] <- chisq.test(spain[,i], spain[, i+1])$statistic/ > /chisquare[i, p] <- chisq.test(spain[,i], spain[, i+1])$p.value/ > /} /#it should have related the "p" variables to analyze whether in > pairs they are dependents, but it seems like it just related two of > them and repeated the relations for all the number of columns (since > it gives the same values in each cell by row) > > /chisquare/ #all the cells have the same values by row > > Anyway, I think is also the way I'm proceeding which is wrong, since I > want to relate all the variables in pairs thus to be able to calculate > the dependence between all of them. That's why I am going for a > dependence matrix. Where am I wrong? > > > After that I can proceed with the MCA. Of course, I would also > need help there. > > I used the following codes to do it: > > /spain.mca <- mjca(spain) /#it makes the mca for all the data > /spain.mca/ > /plot(spain.mca)/ #it shows the plot > > But the plot was overcrowded. Anyway, I must first complete the first > step, this was just to make some practice on it. > > As you can see, until now I didn't succeed. > > I hope someone will be so gentle to give it a try. Attached you are > the data-set > Thank you > > Best-- Kevin E. Thorpe Biostatistician/Trialist, Applied Health Research Centre (AHRC) Li Ka Shing Knowledge Institute of St. Michael's Assistant Professor, Dalla Lana School of Public Health University of Toronto email: kevin.thorpe@utoronto.ca Tel: 416.864.5776 Fax: 416.864.3016 [[alternative HTML version deleted]]
Hello everybody, I'm looking for someone who is able with MCA and would like to gives some help. If what I'm doing is not wrong, according to the purpose I have, I need to understand how to create a dependence matrix, where I can analyze the dependence between all my variables. Till now this is what I was able to do: *p <- length(spain)* #this is the number of the variables (91) *chisquare <- matrix(spain, nrow=(p-1), ncol=p)* #it creates a squared-matrix with all the variables (if I'm not already wrong) *for(i in (1:(p-1))){* *chisquare[i, (1:(p-1))] <- chisq.test(spain[,i], spain[, i+1])$statistic* *chisquare[i, p] <- chisq.test(spain[,i], spain[, i+1])$p.value* *} *#it should have related the "p" variables to analyze whether in pairs they are dependents, but it seems like it just related two of them and repeated the relations for all the number of columns (since it gives the same values in each cell by row) *chisquare* #all the cells have the same values by row Anyway, I think is also the way I'm proceeding which is wrong, since I want to relate all the variables in pairs thus to be able to calculate the dependence between all of them. That's why I am going for a dependence matrix. Where am I wrong? After that I can proceed with the MCA. Of course, I would also need help there. I used the following codes to do it: *spain.mca <- mjca(spain) *#it makes the mca for all the data *spain.mca* *plot(spain.mca)* #it shows the plot But the plot was overcrowded. Anyway, I must first complete the first step, this was just to make some practice on it. As you can see, until now I didn't succeed. I hope someone will be so gentle to give it a try. Attached you are the data-set Thank you Best -------------- next part -------------- A.1 A.2 A.3_1 A.3_2 A.3_3 A.3_4 A.3_5 A.3_6 A.3_7 A.3_8 A.3_9 A.3_10 A.3_11 A.3_12 A.4 A.4_1.1 A.4_1.2 A.4_1.3 A.4_1.4 A.4_1.5 A.4_1.6 A.4_1.7 A.4_1.8 A.4_2.1_1 A.4_2.1_2 A.4_2.1_3 A.4_2.2_1 A.4_2.2_2 A.4_2.2_3 A.5_1 A.5_2 A.5_3 A.5_4 A.5_5 A.5_6 A.5_7 A.5_8 A.5_9 A.5_10 A.5_11 A.5_12 A.6_1 A.6_2 A.6_3 A.6_4 A.6_5 A.6_6 A.6_7 A.6_8 A.6_9 A.6_10 A.6_11 A.6_12 A.6_13 A.6_14 A.6_15 A.6_16 A.6_17 A.6_18 A.6_19 A.6_20 A.6_21 A.6_22 A.6_23 A.7 A.8_1 A.8_2 A.8_3 A.8_4 A.8_5 B.1_1 B.1_2 B.1_3 B.1_4 B.1_5 B.2_1 B.2_2 B.2_3 B.3_1 B.3_2 B.3_3 B.3_4 B.3_5 B.3_6 B.3_7 B.3_8 C.1 C.3 C.4 C.5_1 C.5_2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 6 9 -1 -1 4 4 4 5 4 3 4 2 3 3 1 2 1 4 1 -1 2 2 2 6 7 3 2 2 6 2 4 3 7 2 2 -1 -1 -1 -1 -1 -1 -1 -1 1 1 1 -2 -2 -2 1 1 1 1 1 1 1 2 2 2 2 2 4 3 5 5 2 6 3 6 4 3 5 5 7 2 6 6 6 6 3 5 6 4 2 3 6 6 5 5 5 -2 -2 -2 -2 -2 3 3 5 7 7 3 2 1 4 -2 -2 1 2 5 5 -1 1 1 7 7 1 5 5 5 7 1 7 5 5 1 1 -2 -2 x x x -2 -2 -2 -1 -1 -1 -1 -1 -1 2 1 1 2 2 2 2 2 2 2 2 2 7 7 7 7 1 7 7 7 7 7 7 7 7 1 7 4 7 7 1 7 7 7 7 3 1 7 5 5 5 1 3 4 -1 -1 7 5 5 7 7 6 7 1 7 7 1 1 1 3 1 -1 2 1 7 4 5 7 1 6 6 1 4 1 7 1 1 x -2 -2 -2 -2 -2 -2 -2 -1 -1 -1 -1 -1 -1 2 2 2 2 1 1 1 1 2 1 1 1 6 6 3 6 1 5 6 6 6 1 7 7 5 1 7 1 5 7 1 2 7 5 7 2 5 7 5 7 7 1 -1 -1 -1 -1 1 1 1 7 7 5 7 1 4 1 1 1 2 5 1 -1 4 5 5 1 1 1 1 1 6 1 2 1 1 1 2 -1 -1 -1 -1 -1 -1 -1 -1 1 1 1 1 1 -2 1 1 1 1 1 2 1 1 1 1 1 1 2 2 2 2 4 2 2 2 2 2 7 7 7 4 4 6 4 6 3 2 6 6 2 2 1 1 2 1 2 1 3 4 6 8 2 2 2 6 6 1 6 1 4 2 1 2 2 5 4 -1
Reasonably Related Threads
- selection of character
- mca-graphics: all elements overlapping in the help-example for multiple correspondence analysis
- CORRESPONDENCE ANALYSIS
- How to use PC1 of PCA and dim1 of MCA as a predictor in logistic regression model for data reduction
- [ca package] access to any x/y in mjca function