slowkow / CENTIPEDE.tutorial

:bug: How to use CENTIPEDE to determine if a transcription factor is bound.
https://slowkow.github.io/CENTIPEDE.tutorial
25 stars 13 forks source link

error if needed with Mca and categorical variables #18

Closed FedericaPhd closed 1 year ago

FedericaPhd commented 1 year ago

Hello!

I'm running an MCA with categorical variables ( transformed in factors) there are no missing values but I got this error:

# Error in if (sum(tabF[, 2] <= proba) > 0) resF <- tabF[tabF[, 2] <= proba,  : 
  missing value where TRUE/FALSE needed

Here is the script that I am using

col_names<- names (sololikert1)
sololikert1[,col_names] <- lapply(sololikert1[,c(col_names)], as.factor)
str(sololikert1[,col_names])
str(sololikert1)  
summary(sololikert1)
library(FactoMineR)
res.mca = MCA(sololikert1, quali.sup=c(5:13))
res = dimdesc(res.mca, axes=1:2, proba=0.05)

Here you have little more details:

tibble [304 × 13] (S3: tbl_df/tbl/data.frame)
 $ id                   : Factor w/ 304 levels "1","2","3","4",..: 1 2 3 4 5 6 7 8 9 10 ...
 $ 23-Valle di residenza: Factor w/ 5 levels "1","2","3","4",..: 3 4 3 5 3 2 2 2 3 2 ...
 $ 17-Sesso             : Factor w/ 2 levels "1","2": 2 1 1 2 1 2 1 1 2 1 ...
 $ 18-Fascia d'età      : Factor w/ 4 levels "1","2","3","4": 1 2 1 4 2 2 4 2 4 4 ...
 $ 8.4-                 : Factor w/ 5 levels "1","2","3","4",..: 4 3 5 5 1 3 5 3 3 4 ...
 $ 8.5-                 : Factor w/ 5 levels "1","2","3","4",..: 3 4 3 4 1 3 5 3 2 4 ...
 $ 8.6-                 : Factor w/ 5 levels "1","2","3","4",..: 4 4 5 5 5 4 5 2 3 5 ...
 $ 8.7-                 : Factor w/ 5 levels "1","2","3","4",..: 4 4 5 5 5 4 5 2 4 5 ...
 $ 11.1-                : Factor w/ 5 levels "1","2","3","4",..: 3 1 3 4 1 2 3 1 1 1 ...
 $ 11.2-                : Factor w/ 5 levels "1","2","3","4",..: 2 4 3 5 1 3 4 1 1 1 ...
 $ 14.1-[               : Factor w/ 5 levels "1","2","3","4",..: 1 1 3 4 1 4 3 4 1 3 ...
 $ 14.2-[               : Factor w/ 5 levels "1","2","3","4",..: 1 1 4 5 1 3 5 4 1 3 ...
 $ 14.3-                : Factor w/ 5 levels "1","2","3","4",..: 1 3 2 5 1 5 5 4 4 4 ...
> str(sololikert1)  #ti dice quali sono le viariabili qualitat. e quantitaitve
tibble [304 × 13] (S3: tbl_df/tbl/data.frame)
 $ id                   : Factor w/ 304 levels "1","2","3","4",..: 1 2 3 4 5 6 7 8 9 10 ...
 $ 23-Valle di residenza: Factor w/ 5 levels "1","2","3","4",..: 3 4 3 5 3 2 2 2 3 2 ...
 $ 17-Sesso             : Factor w/ 2 levels "1","2": 2 1 1 2 1 2 1 1 2 1 ...
 $ 18-Fascia d'età      : Factor w/ 4 levels "1","2","3","4": 1 2 1 4 2 2 4 2 4 4 ...
 $ 8.4-                 : Factor w/ 5 levels "1","2","3","4",..: 4 3 5 5 1 3 5 3 3 4 ...
 $ 8.5-                 : Factor w/ 5 levels "1","2","3","4",..: 3 4 3 4 1 3 5 3 2 4 ...
 $ 8.6-                 : Factor w/ 5 levels "1","2","3","4",..: 4 4 5 5 5 4 5 2 3 5 ...
 $ 8.7-                 : Factor w/ 5 levels "1","2","3","4",..: 4 4 5 5 5 4 5 2 4 5 ...
 $ 11.1-                : Factor w/ 5 levels "1","2","3","4",..: 3 1 3 4 1 2 3 1 1 1 ...
 $ 11.2-                : Factor w/ 5 levels "1","2","3","4",..: 2 4 3 5 1 3 4 1 1 1 ...
 $ 14.1-[               : Factor w/ 5 levels "1","2","3","4",..: 1 1 3 4 1 4 3 4 1 3 ...
 $ 14.2-[               : Factor w/ 5 levels "1","2","3","4",..: 1 1 4 5 1 3 5 4 1 3 ...
 $ 14.3-                : Factor w/ 5 levels "1","2","3","4",..: 1 3 2 5 1 5 5 4 4 4 ...
> res.mca = MCA(sololikert1, quali.sup=c(5:13))
Warning message:
ggrepel: 9 unlabeled data points (too many overlaps). Consider increasing max.overlaps 
> res = dimdesc(res.mca, axes=1:2, proba=0.05)
Error in if (sum(tabF[, 2] <= proba) > 0) resF <- tabF[tabF[, 2] <= proba,  : 
  missing value where TRUE/FALSE needed
In addition: Warning messages:
1: ggrepel: 9 unlabeled data points (too many overlaps). Consider increasing max.overlaps 
2: ggrepel: 9 unlabeled data points (too many overlaps). Consider increasing max.overlaps 
> res = dimdesc(res.mca, axes=1:3, proba=0.05)
**Error in if (sum(tabF[, 2] <= proba) > 0) resF <- tabF[tabF[, 2] <= proba,  : 
  missing value where TRUE/FALSE needed**
slowkow commented 1 year ago

Sorry, but I'm not sure if this issue is related to the CENTIPEDE tutorial.

If you'd like to re-open this issue, could I please ask if you might be able to provide more information to help me to understand your situation?