using MIFAMD in order to do MFA

87 views
Skip to first unread message

annemari...@gmail.com

unread,
Sep 28, 2020, 3:46:46 PM9/28/20
to FactoMineR users
Dear all, dear François & Julie,

I have a dataset with both quantitative (actually, they are counts, hence the integers) and categorical variables, on which I want to use MFA. However, there are NA's for both groups of variables, so I want to use MIFAMD to impute the missing datapoints. I add the summary below.

I can't get MIFAMD to work, this is what I have used so far:
MIFAMD_output <- MIFAMD(NC_coding4_sel, ncp = 1, maxiter = 999)
- whatever value I put for nap, I get (with variations):
"Error in Residu[, seq(ncol(Xquanti))] : incorrect number of dimensions"

Can you help me out to get MIFAMD working?

Many thanks!
Annemarie

How_many_SG_NCF How_many_PL_NCF  How_many_invariant_NCF How_many_paired_NCF
 Min.   : 1.00   Min.   : 1.000   Min.   :1.000          Min.   : 1.00      
 1st Qu.:11.00   1st Qu.: 6.000   1st Qu.:1.000          1st Qu.: 4.00      
 Median :12.00   Median : 7.000   Median :1.000          Median :13.00      
 Mean   :10.79   Mean   : 6.371   Mean   :2.058          Mean   :10.53      
 3rd Qu.:13.00   3rd Qu.: 7.000   3rd Qu.:3.000          3rd Qu.:16.00      
 Max.   :14.00   Max.   :10.000   Max.   :9.000          Max.   :17.00      
                                  NA's   :7              NA's   :1          
 How_many_Sg_Agr_CL How_many_PL_Agr_CL How_many_Invariant_Agr_CL
 Min.   : 1.00      Min.   : 1.000     Min.   :1.00             
 1st Qu.: 9.00      1st Qu.: 6.000     1st Qu.:1.00             
 Median :10.00      Median : 6.000     Median :1.00             
 Mean   : 8.93      Mean   : 6.035     Mean   :1.91             
 3rd Qu.:11.00      3rd Qu.: 7.000     3rd Qu.:3.00             
 Max.   :12.00      Max.   :10.000     Max.   :5.00             
 NA's   :6          NA's   :6          NA's   :12               
 How_many_paired_AGR_CL Gender_on_Attr_Adj Gender_on_Dem Gender_on_Num
 Min.   : 1.000             :  0               :  0          :  0     
 1st Qu.: 4.000         NA  :  0           NA  :  0      NA  :  0     
 Median :11.000         no  : 25           no  : 15      no  : 15     
 Mean   : 9.052         yes :129           yes :156      yes :147     
 3rd Qu.:13.000         NA's: 24           NA's:  7      NA's: 16     
 Max.   :14.000                                                       
 NA's   :24                                                           
 Gender_on_Quant Gender_on_Poss Gender_on_Wh_Words Gender_on_V Gender_on_Pred_Adj
     :  0            :  0           : 0                :  0        :  0          
 NA  :  0        NA  :  0       NA  : 0            NA  :  0    NA  :  0          
 no  : 20        no  : 20       no  :37            no  : 25    no  : 23          
 yes :119        yes :149       yes :94            yes :141    yes : 49          
 NA's: 39        NA's:  9       NA's:47            NA's: 12    NA's:106          
 
Gender_on_Cop Gender_on_Rel Gender_on_Ind_Pers_Pro Gender_on_Poss_Pro
     :  0          : 0           :  0                   :  0          
 NA  :  0      NA  : 0       NA  :  0               NA  :  0          
 no  : 25      no  :21       no  : 35               no  : 22          
 yes : 53      yes :99       yes :114               yes :142          
 NA's:100      NA's:58       NA's: 29               NA's: 14          
                                                                      
                                                                      
 Gender_on_Dem_Pro Gender_on_Refl_Pro Gender_on_Other AC_on_Attr_Adj AC_on_Dem 
     : 0               : 0                : 0             :  0           :  0  
 NA  : 0           NA  : 0            NA  : 0         NA  :  0       NA  :  0  
 no  :18           no  :67            no  :53         no  :107       no  :107  
 yes :82           yes :13            yes :26         yes : 12       yes : 10  
 NA's:78           NA's:98            NA's:99         NA's: 59       NA's: 61  
                                                                               
                                                                               
 AC_on_Num  AC_on_Quant AC_on_Poss AC_on_Wh_words AC_Sbj_Agr AC_Obj_Agr
     :  0       :  0        :  0       : 0            : 0        : 0   
 NA  :  0   NA  :  0    NA  :  0   NA  : 0        NA  : 0    NA  : 0   
 no  :108   no  :100    no  :107   no  :89        no  :92    no  :96   
 yes :  7   yes :  5    yes :  7   yes :15        yes :34    yes :18   
 NA's: 63   NA's: 73    NA's: 64   NA's:74        NA's:52    NA's:64   
                                                                       
                                                                       
 AC_on_Pred_Adj AC_on_Cop AC_on_Rel AC_on_Pers_Pro AC_on_Poss_Pro AC_on_Dem_Pro
     : 0            : 0       : 0       : 0            :  0           : 0      
 NA  : 0        NA  : 0   NA  : 0   NA  : 0        NA  :  0       NA  : 0      
 no  :76        no  :76   no  :91   no  :93        no  :107       no  :97      
 yes : 5        yes : 8   yes : 3   yes :16        yes : 10       yes : 4      
 NA's:97        NA's:94   NA's:84   NA's:69        NA's: 61       NA's:77      
                                                                               
                                                                               
 AC_on_Refl_Pro AC_on_Other AC_Obl_NP AC_Obl_Everywhere Only_Number_Agr
     : 0            : 0         : 0       :  0              :  0       
 NA  : 0        NA  : 0     NA  : 0   NA  :  0          NA  :  0       
 no  :88        no  :95     no  :97   no  :111          no  :129       
 yes : 1        yes : 2     yes :17   yes :  4          yes :  2       
 NA's:89        NA's:81     NA's:64   NA's: 63          NA's: 47  

Only_Number_NCF Animacy_Number_NFC Extra_NCF_Animacy Extra_NCF_Number
     :  0            :  0               :  0              :  0        
 NA  :  0        NA  :  0           NA  :  0          NA  :  0        
 no  :130        no  :125           no  :133          no  :130        
 yes :  3        yes :  8           yes :  2          yes :  3        
 NA's: 45        NA's: 45           NA's: 43          NA's: 45        
                                                                      
                                                                      
 Extra_NCF_Animacy.Number
     :  0                
 NA  :  0                
 no  :132                
 yes :  1                
 NA's: 45                                                                        

Francois Husson

unread,
Oct 3, 2020, 12:10:50 PM10/3/20
to factomin...@googlegroups.com
Dear AnnMarie,
Maybe the problem is due o the fact that some categorical variables have some categories with 0 individuals. So you first have to use the droplevels function to suppress these categories.
NC_coding4_sel <- droplevels(NC_coding4_sel)
FH
--
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.
Cette discussion peut être lue sur le Web à l'adresse https://groups.google.com/d/msgid/factominer-users/7f867231-3ba8-4bc4-be35-d57cfe975b45n%40googlegroups.com.

--
Francois Husson
Department Statistics & Computer science
AGROCAMPUS OUEST
65 rue de St-Brieuc - 35042 RENNES
Tel: +33 2 23 48 58 86
https://husson.github.io

annemari...@gmail.com

unread,
Oct 5, 2020, 8:40:45 AM10/5/20
to FactoMineR users
Dear François,
Yes, you were right! This actually results, depending on the subset of the dataset, in some categories have no variation, so I got some other error messages but I realised the problem and now all is good. I have output from MIFAMD - but which part of it do I feed into MFA()?

This is my call: 
mfa1 <- MFA(NC_coding5_sel, group = c(8, 39), type = c("c","n"), name.group = c("continuous","categorical"), tab.comp = ???, graph = F)

I have tried in the place of ??? MIFAMD_output$res.imputeFAMD$completeObs, MIFAMD_output$res.imputeFAMD, MIFAMD_output$res.MI, and all kinds of variation, without success.

Many thanks for all your help!
With best wishes,
Annemarie

Op zaterdag 3 oktober 2020 om 18:10:50 UTC+2 schreef François Husson:

annemari...@gmail.com

unread,
Oct 13, 2020, 8:30:33 AM10/13/20
to FactoMineR users
Please, does anybody have a solution regarding how to give MIFAMD output to MFA? (See above)

Many thanks,
Annemarie

Op maandag 5 oktober 2020 om 14:40:45 UTC+2 schreef annemari...@gmail.com:
Reply all
Reply to author
Forward
0 new messages