3

I have a problem when I use the function CA() in R.

My data is :

data

row.names   Conscient   NonConscient
MoinsSouvent    185 213
PlusieursfMois  98  56
PlusieursfSemaine   28  27
TLJ 5   8

but when I use CA(data), I have :

test <- CA(data) Error in res.ca$col$coord[, axes] : subscript out of bounds

Can someone help please ?

Niklas
  • 41
  • 3

2 Answers2

4

The problem is the due to the fact that in correspondance analysis with a conteingency table of size I x J the number of factorial axes is min{(I-1), (J-1)}. You have a 4 x 2 table so you can't have factorial plan but an axe (because dim = 1 = min(4-1, 2-1)).

One way to solve this problem is to use CA with the parameter graph set to FALSE.

require(FactoMineR)
data <- matrix(c(185, 213, 98, 56, 28, 27, 5, 8),
               ncol = 2, byrow  = TRUE)
dimnames(data) <- list(c("ms", "plfm", "plfs", "tlj"),
                       c("cs", "ncs"))
data <- as.table(data)
res <- CA(data, graph = FALSE)

You can also check the coordinates to see that plotting a plan here is not possible.

res$row$coord
##         ms       plfm       plfs        tlj 
## -0.0897234  0.2534199 -0.0011732 -0.2501709 

res$col$coord
##        [,1]
## cs   0.1469
## ncs -0.1527
dickoa
  • 18,217
  • 3
  • 36
  • 50
1

There is no point of doing a correspondence analysis on a 4*2 table. CA are made to reduce the dimensionality of large contingency table.

If your variables have so few possible values, you better just interpret the contingency table directly, using chisquare or fisher test if needed.

scoa
  • 19,359
  • 5
  • 65
  • 80