0
$\begingroup$

I have a dataset with 19 variables and 100k observations. All of my variables are categorical, some of them ordinal but I have not taken that into account here. To reduce its dimension, I performed a (actually two) multiple correspondence analysis but ended up having more dimensions that my initial variables and my new dimensions explain very little of my data in both cases. I would like to have some insight about what can be causing this and how to fix it.

The analysis I performed:

library(FactoMineR)
library(MASS)

# Read dataset
setwd('your_work_dir')
df <- read.csv('your_work_dir/dimredtest.csv')

# Factorize variables
fdf <- lapply(df[1:19], factor)
fdf <- data.frame(fdf)

# First mca (mass library)
dfmca1 <- mca(fdf, nf = 5)
print(dfmca1)


# I obtain these results
Call:
mca(df = fdf, nf = 5)

Multiple correspondence analysis of 100000 cases of 19 factors

Correlations 0.452 0.336 0.321 0.265 0.251  cumulative % explained 2.51 4.38 6.17 7.64 9.03 


# Second mca (factominer library)
dfmca2 <- MCA(fdf, ncp = 5)
print(dfmca2$eig)


# I obtain these results now
        eigenvalue percentage of variance cumulative percentage of variance
dim 1  0.204231522              9.7009973                          9.700997
dim 2  0.113216042              5.3777620                         15.078759
dim 3  0.103238296              4.9038191                         19.982578
dim 4  0.070254532              3.3370903                         23.319669
dim 5  0.063006468              2.9928072                         26.312476
dim 6  0.061177703              2.9059409                         29.218417
dim 7  0.058110105              2.7602300                         31.978647
dim 8  0.057359377              2.7245704                         34.703217
dim 9  0.056143371              2.6668101                         37.370027
dim 10 0.054090789              2.5693125                         39.939340
dim 11 0.054047535              2.5672579                         42.506598
dim 12 0.053660113              2.5488554                         45.055453
dim 13 0.053562437              2.5442157                         47.599669
dim 14 0.053289470              2.5312498                         50.130919
dim 15 0.053093397              2.5219363                         52.652855
dim 16 0.052852955              2.5105154                         55.163370
dim 17 0.052784701              2.5072733                         57.670644
dim 18 0.052400489              2.4890232                         60.159667
dim 19 0.052147643              2.4770130                         62.636680
dim 20 0.052112262              2.4753325                         65.112012
dim 21 0.051747465              2.4580046                         67.570017
dim 22 0.051279463              2.4357745                         70.005791
dim 23 0.050923005              2.4188427                         72.424634
dim 24 0.050510432              2.3992455                         74.823880
dim 25 0.049012027              2.3280713                         77.151951
dim 26 0.048353188              2.2967764                         79.448727
dim 27 0.047713121              2.2663732                         81.715101
dim 28 0.046850864              2.2254160                         83.940517
dim 29 0.045922134              2.1813014                         86.121818
dim 30 0.041301134              1.9618039                         88.083622
dim 31 0.040983417              1.9467123                         90.030334
dim 32 0.038268535              1.8177554                         91.848090
dim 33 0.034718438              1.6491258                         93.497215
dim 34 0.031743953              1.5078378                         95.005053
dim 35 0.030043374              1.4270603                         96.432113
dim 36 0.026663008              1.2664929                         97.698606
dim 37 0.022109605              1.0502062                         98.748813
dim 38 0.012494687              0.5934976                         99.342310
dim 39 0.008510974              0.4042712                         99.746581
dim 40 0.005335127              0.2534185                        100.000000

As you can see, not only I have a large number of dimensions, but they explain very little, up to the point it is more efficient to use our original variables in case we want to explain at least 70% of the data.

I case someone wants to replicate this, you can find the data I used here.

$\endgroup$
3
  • $\begingroup$ How many different levels do your factors have? I suspect several (at least) have more than two. The "effective dimensionality" of a factor can be found from its one-hot encoding, and is equal to the # of levels - 1. $\endgroup$
    – jbowman
    Commented Apr 25, 2022 at 16:50
  • $\begingroup$ Correct, many variables have around 5 to 7 levels. Should I keep my original variables then? $\endgroup$ Commented Apr 26, 2022 at 14:04
  • $\begingroup$ Your MDA should have resulted in fewer dimensions than the total "effective dimensionality" of the factors, so in that sense it worked. $\endgroup$
    – jbowman
    Commented Apr 26, 2022 at 14:08

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.