I'm wondering how to proceed to perform Canonical Correspondence Analysis and Multiple Correspondence Analysis in R on the following three-way contingency table
Eco_region3 Eco_region4 Species Freq
A A1 S1 10
A A1 S2 12
A A1 S3 8
A A2 S1 10
A A2 S2 6
A A2 S3 11
A A3 S1 2
A A3 S2 9
A A3 S3 13
B B1 S1 13
B B1 S2 15
B B1 S3 7
B B2 S1 9
B B2 S2 8
B B2 S3 13
B B3 S1 15
B B3 S2 12
B B3 S3 13
C C1 S1 12
C C1 S2 18
C C1 S3 20
C C2 S1 12
C C2 S2 0
C C2 S3 11
C C3 S1 18
C C3 S2 10
C C3 S3 16
Eco_region4 is nested within Eco_region3.
Thanks
Best Answer
assuming your data are in a
data.frame
called dt, you can turn it into a table object usingxtabs
You can get a three dimensional table by adding Eco_region3 to the end of the formula, but then the correspondence analysis would fail because of the nested structure of your data.
You can perform correspondence analysis with the
ca
function from theca
package.