MFA - error: not a convenient group definition

3 531 vues
Accéder directement au premier message non lu

Katsu

non lue,
24 févr. 2013, 18:32:4424/02/2013
à factomin...@googlegroups.com
Hello,

I'm trying to carry out some multivariate analyses on my species morphological variation data which consists of both continuous (leaf length etc) and categorical (seed type etc) data types. I have imported my data which looks like this:


Leafindumentumdensity Auriclespresent Tubularstamencurve Centralfloretseedtype Raystamencurve Leaflength Cleftlength Leafwidth Headwidth Tubularfloretcorollalength Tubularfloretstamenlength Lengthofhighestbract Rayfloretlength Rayfloretlimbwidth Rayfloretlimblength Ray:stamenlength
FA295o1 dense No strong A strong 0.919078 0.20412 1.0086 0.681241 0.892095 0.041393 0.322219 0.880814 0.079181 0.740363 0.146128036
FA295o2 dense No strong A slight 1.033424 0.342423 0.94939 0.681241 0.863323 0 0.278754 0.94939 0.380211 0.755875 0.113943352
FA295o3 dense No strong A slight 0.939519 0.20412 1.0086 0.50515 0.857332 0.079181 0.146128 0.939519 0.322219 0.799341 0.079181246
FA296o1 dense Yes slight A slight 1.10721 0.462398 1.178977 0.612784 0.763428 0.041393 0.079181 0.770852 0.230449 0.623249 0.079181246

I have a total of 16 variables, the first 5 are categorical and final 11 are continuous.

I used the following to start with :

res=MFA(azoresall1,group=c(5,11,1),type=c(rep("n",5),rep("s",11)),ncp=5,name.group=c("cat","cont"))

And I receive this error message:

Error in MFA(azoresall1, group = c(5, 11), type = c(rep("n", 5), rep("s",  :
  not convenient group definition

I'm not sure what I need to do. I have also tried defining it as "c" but it does not work.
I have also tried to add supplementary information to this with an extra column of data (ssp.) and have tried:

res=MFA(azoresall1,group=c(5,11,1),type=c(rep("n",5),rep("c",11),"n"),ncp=5,name.group=c("cat","cont","ssp"),num.group.sup=17)
However, with this I receive the same error message.

Thank you for your help and sorry if this seems obvious, I'm new to R!

François Husson

non lue,
25 févr. 2013, 03:09:1425/02/2013
à factomin...@googlegroups.com
Hello,

In your example, there are only 2 groups, so you should write:
res=MFA(azoresall1,group=c(5,11),type=c(rep("n",1),rep("s",1)),ncp=5,name.group=c("cat","cont")) 

Since all the variables of a group are either categorical or continuous, it is just necessary to give the nature of the group.

FH

Katy Jones

non lue,
25 févr. 2013, 17:49:4525/02/2013
à factomin...@googlegroups.com
Hi,
ok thank you for your help and sorry it was so simple! KJ

--
Vous recevez ce message car vous êtes abonné à un sujet dans le groupe Google Groupes "FactoMineR users".
Pour vous désabonner de ce sujet, visitez le site https://groups.google.com/d/topic/factominer-users/YBXERUiJmTY/unsubscribe?hl=fr.
Pour vous désabonner de ce groupe et de tous ses sujets, envoyez un e-mail à l'adresse factominer-use...@googlegroups.com.

Pour plus d'options, visitez le site https://groups.google.com/groups/opt_out .
 
 

Marie TRAN

non lue,
25 juil. 2013, 06:38:4925/07/2013
à factomin...@googlegroups.com
Bonjour,

Je rencontre le même problème en réalisant mon AFM. Je dispose d'un jeu de données sur les pratiques d'une populations d'agriculteurs. J'ai 19 variables, 12 quantitatives et 7 qualitatives. Pour l'instant je souhaite étudier uniquement les 12 variables quantitatives et faire 3 groupes : 3 variables sur l'assolement (% d'herbe dans la SAU, % de maïs dans la surface fourragère..), 5 variables sur la fertilisation (ferti azotée totale, ferti minérale sur les prairies, etc.), et 3 variables sur les traitements phytos (dose de fongicide appliquée, dose d'herbicide appliquée sur les céréales etc).

Mes lignes de codes sont les suivantes
> hcm3 <- read.table("hcm2.csv", header=TRUE, sep=";", na.strings="NA", dec=",", row.names=1,  strip.white=TRUE)
> res = MFA(hcm3, group=c(3,5,3), type=c("s","s","s"), ncp=5, name.group=c("assol","ferti","phyto"))
Erreur dans MFA(hcm3, group = c(3, 5, 3), type = c("s", "s", "s"), ncp = 5,  :
  not convenient group definition

Et là je ne sais pas trop quel est le problème. Merci d'avance pour votre réponse à ma question un peu bête, je suis une novice en R ;)

Bien cordialement,

Marie

François Husson

non lue,
25 juil. 2013, 15:28:2525/07/2013
à factomin...@googlegroups.com
Bonjour,

Votre jeu de données une fois importé a des variables quantitatives et des variables qualitatives. La fonction ne peut pas savoir quelles variables vous voulez. Vous avez donc 2 possibilités :
1)  préciser que vous travailler sur le jeu de données avec les variables quantitatives uniquement en précisant que vous utilisez seulement les 19 premières variables :
res = MFA(hcm3[,1:19], group=c(3,5,3), type=c("s","s","s"), ncp=5, name.group=c("assol","ferti","phyto"))
2) Utiliser les variables qualitatives comme variables supplémentaires (ce que je vous conseille car cela peut toujours servir pour expliquer les axes) :
res = MFA(hcm3, group=c(3,5,3,7), type=c("s","s","s","n"), ncp=5, name.group=c("assol","ferti","phyto","qualitative"),num.group.sup = 4)

FH

eher...@ualberta.ca

non lue,
14 oct. 2013, 11:04:1114/10/2013
à factomin...@googlegroups.com
Hello there,

I have encountered the same problem with the MFA. I am working with a data set containing physical, chemical and microbiological continuous variables measured in tomato plants, taken from 2 different treatments and at 3 time points. I have accommodated my data in the following manner: 

row.names    Trt       Status Humidity pH Conductivity Nit.N   Ammonia.N P K Ca          Mg       S Sodium Chlorides Fe Mn Rhizobium Total.bacteria
GBA1 Organic H 87.22 5.44 837               436.18    3.8122       30.95 135 1287.5 367.5    705 92.5         15.1        1.5 1.1 0 7207207.207
GBB1 Organic H 80.30 5.94 867               433.92    2.6452        15.2  35 1427.5 575     924 170        11.1         2.2 0.55  0 5454545.455

I divided the variables in categorical (first 2), then the other 16 are continuous. However, I want to treat the 2 categorical variables separately. So I wrote the following code:

res <- MFA(Oliver, group=c(1,1,3,11,2), type=c("n", "n","s", "s","s"),ncp=5,name.group=c("Sub","Stat", "Phys", "Chem", "Microbial")) 

However, it doesn't seem to work. Hence, I tried the following:
res=MFA(Oliver,group=c(2,16),type=c(rep("n",1),rep("s",1)),ncp=5,name.group=c("cat","cont")) 

and this other:
res=MFA(Oliver,group=c(2, 3, 11, 2),type=c(rep("n",1),rep("s",3)),ncp=5,name.group=c("type","Phys", "Chem", "Microbial"))

But I kept having the same problem ("not convenient group definition"). Is there anything that I can do to keep the first 2 categorical groups separately? I would really appreciate your advice on how to properly run the model!

Best wishes,

Emma
         

Daniella Schweizer

non lue,
12 nov. 2015, 12:48:0212/11/2015
à FactoMineR users
Bonjour,
Mr François,
I am learning how to use your package FactoMineR using your example from http://factominer.free.fr/advanced-methods/multiple-factor-analysis.html but I am getting an error as I pasted below:

res = MFA(data, group=c(2,5,3,10,9,2), type=c("n",rep("s",5)), ncp=5, name.group=c("origin","odor","visual","odor.after.shaking", "taste","overall"), num.group.sup=c(1,6))
Error in MFA(data, group = c(2, 5, 3, 10, 9, 2), type = c("n", rep("s",  : 
  not convenient group definition

What might be wrong? as this is the example data "wine"

Thanks
Daniella
Répondre à tous
Répondre à l'auteur
Transférer
0 nouveau message