Error in xj[i] : only 0's may be mixed with negative subscripts- Error in MCA

3,821 views
Skip to first unread message

eher...@ualberta.ca

unread,
Nov 26, 2013, 12:43:46 PM11/26/13
to factomin...@googlegroups.com
Thank you very much for taking your time to read my message. I was wondering if you could suggest me how to fix a problem I am having when running the MCA in FactoMineR. I have a database with data from high throughput sequencing and I have accommodated the data into proportions of bacterial genera, detected from the total number of OTUs. It looks like this:


Donor        Bifidob Coriob Bacteroides
D1_CT_day3BT 15.54 0.01 0.00
D1_low_day3BT 17.33 0.00 0.00
D1_high_day3BT 23.53 4.67 10.28


Some genera were not detected, therefore I have numerous columns with zeros. When I try to run the MCA code, I get this message:

Error in xj[i] : only 0's may be mixed with negative subscripts

I have loaded the package "MissMDA", along with FactoMineR but it does not seem to work. I have eliminated the columns with only zeros, but I still get the same response. I would really appreciate if you could provide me with any other small suggestion to solve my problem. I have worked with FactoMineR before and the graphics are incredibly helpful when you are dealing with large datasets and I would like to implement the same analysis for this data. Again, I thank you for your time and consideration.

Best regards,

Emma

Julie Josse

unread,
Nov 26, 2013, 1:03:51 PM11/26/13
to factomin...@googlegroups.com
Le 26/11/2013 18:43, eher...@ualberta.ca a écrit :
Thank you very much for taking your time to read my message. I was wondering if you could suggest me how to fix a problem I am having when running the MCA in FactoMineR. I have a database with data from high throughput sequencing and I have accommodated the data into proportions of bacterial genera, detected from the total number of OTUs. It looks like this:


Donor        Bifidob Coriob Bacteroides
D1_CT_day3BT 15.54 0.01 0.00
D1_low_day3BT 17.33 0.00 0.00
D1_high_day3BT 23.53 4.67 10.28


Some genera were not detected, therefore I have numerous columns with zeros. When I try to run the MCA code, I get this message:

Error in xj[i] : only 0's may be mixed with negative subscripts

I have loaded the package "MissMDA", along with FactoMineR but it does not seem to work. I have eliminated the columns with only zeros,
Yes, it is better to eliminate columns with only 0.

but I still get the same response. I would really appreciate if you could provide me with any other small suggestion to solve my problem. I have worked with FactoMineR before and the graphics are incredibly helpful when you are dealing with large datasets and I would like to implement the same analysis for this data. Again, I thank you for your time and consideration.
If you would like to use MCA, are you sure all the variables are considered as qualitative? you have NA's to use missMDA?
Best regards,
Julie.
Best regards,

Emma
--
Vous recevez ce message, car vous êtes abonné au groupe Google Groupes FactoMineR users.
Pour vous désabonner de ce groupe et ne plus recevoir d'e-mails le concernant, envoyez un e-mail à l'adresse factominer-use...@googlegroups.com.
Pour plus d'options, visitez le site https://groups.google.com/groups/opt_out .

Emma Hernandez-Sanabria

unread,
Nov 26, 2013, 1:08:38 PM11/26/13
to factomin...@googlegroups.com
Hello Julie,

Thank you very much for your kind reply. I eliminated some columns with only zeros; however, there are some cells with no bacteria detected and therefore, a "zero" value, and I cannot eliminate all of them. I have no missing values (NA), but I ran missMDA anyway, to see if (by using this package), the model could run. All my variables are numerical, is it possible to use MCA for them? Otherwise, will MFA be a better option?

Again, thank you for your time and advice.

Emma
--
Emma Hernandez Sanabria

Julie Josse

unread,
Nov 26, 2013, 2:09:17 PM11/26/13
to factomin...@googlegroups.com
Le 26/11/2013 19:08, Emma Hernandez-Sanabria a écrit :
Hello Julie,

Thank you very much for your kind reply. I eliminated some columns with only zeros; however, there are some cells with no bacteria detected and therefore, a "zero" value, and I cannot eliminate all of them. I have no missing values (NA), but I ran missMDA anyway,
yes, missMDA is for the NZ

to see if (by using this package), the model could run. All my variables are numerical, is it possible to use MCA for them?
MCA is dedicated to categorical variables, PCA to continuous ones

Otherwise, will MFA be a better option?
MFA to groups of variables...
Hope to help,
Julie

Emma Hernandez-Sanabria

unread,
Nov 27, 2013, 11:12:25 AM11/27/13
to factomin...@googlegroups.com
Hi Julie,

Thank you very much for your e-mail! I checked my source file and for some reason R was not reading all my numerical variables, but I fixed the problem and I used the CA function. Thank you for your kind help!

Best wishes,

Emma

Claire Duflos

unread,
Oct 6, 2014, 7:29:08 AM10/6/14
to factomin...@googlegroups.com
Hello,

même erreur, nouveau problème, utilisatrice bien moins expérimentée qu'Emma ...

Mes données sont dans un data.frame (tab.acm) contenant des vecteurs de caractères et un vecteur numérique (variable de comptage valant 1 à 3) ; 522 observations, 19 variables. Il n'y a aucune donnée manquante.

> str(tab.acm)
'data.frame':	522 obs. of  19 variables:
 $ patho        : chr  "06. Déficit moteur" "02. Déficits multiples dont tb neuro-psy" "01. Post-op anévrysme/hématome" "03. Déficit moteur et tb du langage" ...
 $ envir_gp     : chr  "08. Soins denses ou complexes" "07. Polypathologique" "04-05-11. Domicile impossible" "07. Polypathologique" ...
 $ objpec       : chr  "1. Rééducation simple" "3. PEC médicale lourde, orientation" "1. Rééducation simple" "2. Rééducation complexe" ...
 $ npspep       : int  1 1 1 1 1 2 1 1 1 1 ...
 $ orref        : chr  "SSR neuro" "SSR neuro" "SSR neuro" "SSR neuro" ...
 $ disc_nom_1   : chr  "NEUROLOGIE" "NEUROLOGIE" "NEUROLOGIE" "NEUROLOGIE" ...
 $ ad_dir       : chr  "Non" "Non" "Non" "Non" ...
 $ sexe         : chr  "F" "M" "F" "F" ...
 $ agecl        : chr  "60-74" "75-84" "75-84" "75-84" ...
 $ mutuelle     : chr  "Oui" "Oui" "Oui" "Non" ...
 $ seul         : chr  "Oui" "Non" "Non" "Non" ...
 $ voie         : chr  "pas.voie" "pas.voie" "pas.voie" "pas.voie" ...
 $ ventilation  : chr  "Non" "Non" "Non" "Non" ...
 $ cutane       : chr  "Non" "Non" "Non" "Non" ...
 $ bmr2         : chr  "6. Ref_Non recherché" "6. Ref_Non recherché" "6. Ref_Non recherché" "6. Ref_Non recherché" ...
 $ app          : chr  "Non" "Non" "Non" "Non" ...
 $ cap_fonc     : chr  "Oui" "Oui" "Oui" "Oui" ...
 $ communication: chr  "Non" "Non" "Non" "Non" ...
 $ neuropsy     : chr  "Non" "Oui" "Oui" "Non" ...

Quand j'essaie d'appliquer MCA(tab.acm), j'ai l'erreur en titre :
Error in xj[i] : only 0's may be mixed with negative subscripts

J'utilise RStudio. Avez-vous une idée de la façon d'explorer le pb ?

merci d'avance,
claire



josse

unread,
Oct 7, 2014, 5:08:58 AM10/7/14
to factomin...@googlegroups.com
Bonjour,
Pour faire une ACM, il faut que toutes les variables soient qualittatives (factor dans R), si vous avez des variables quanti et quali, vous pouvez regarder la fonction AFDM,
Bien cordialement,
JJ.

Le 06/10/14 13:29, Claire Duflos a écrit :
--
Vous recevez ce message, car vous êtes abonné au groupe Google Groupes "FactoMineR users".
Pour vous désabonner de ce groupe et ne plus recevoir d'e-mails le concernant, envoyez un e-mail à l'adresse factominer-use...@googlegroups.com.
Pour obtenir davantage d'options, consultez la page https://groups.google.com/d/optout.

Claire Duflos

unread,
Oct 13, 2014, 5:14:36 AM10/13/14
to factomin...@googlegroups.com
Merci, c'était effectivement le problème : mes variables quali étaient des vecteurs et non pas des facteurs.
Reply all
Reply to author
Forward
0 new messages