ACP sur R avec des NA + mettre couleurs

Postez ici vos questions, réponses, commentaires ou suggestions - Les sujets seront ultérieurement répartis dans les archives par les modérateurs

Modérateur : Groupe des modérateurs

margot julien
Messages : 46
Enregistré le : 28 Nov 2017, 12:10

ACP sur R avec des NA + mettre couleurs

Messagepar margot julien » 09 Juil 2019, 11:18

Bonjour,

j'aimerais représenter mes données sur une ACP.

Description de mon fichier: j'ai 3 variables mesurées:
- variable 1: la taille des racines (mm)
-variable 2: le poids des racines (g)
-variable 3: le poids des plantes (Kg)

et les variables qui peuvent influencer/expliquer ces mesures:
-variété (N=5) (= unité expérimentale)
-traitement (N=4) (3 traitements et un témoin non traité) (= grande parcelle)
-Field treatment (oui/non) (= petite parcelle)
-période d'observation dans le temps en mois (N=4) (une observation à 0 mois sur le control non traité puis des observations à 3,5 et 7 mois sur les plantes traitées avec différents produits (traitements) / l'échantillonnage est destructif)
-année de l'essai (N=3 pour variable 1 et 2 et N=2 pour variable 3) = répétitions / random factor

J'ai essayé avec le code ci-dessous mais ça ne fonctionne pas peut-être parce que j'ai des NA. Pouvez-vous m'aider s'il vous plait?

Lorsque je fais l'ACP sur les 3 variables mesurées j'ai le message suivant:

Warning in PCA(fi[, 6:7], scale.unit = TRUE, ncp = 5, graph = T) :
Missing values are imputed by the mean of the variable: you should use the imputePCA function of the missMDA package

Je me demandais aussi si il y avais un moyen d'ajouter les variables descriptives (variété, field-treatment, traitement, période d'observation, année) peut-être avec des couleurs ou formes différentes afin d'avoir une représentation des l'ensemble des données?

Je mets mon fichier en "quote" ci-dessous.

Merci par avance.
Salutations.

Code : Tout sélectionner

fi<-read.csv2("complete_file.csv", na.strings = "NA",header = TRUE)
str(fi)
head(fi)
dim(fi)
for (i in 6:ncol(fi)) {
  fi[, i] <- as.numeric(as.character(fi[, i]))
}
#ACP uniquement sur les variables actives????
#library pour ACP:
library(FactoMineR)
library(httpuv)
library(Factoshiny)
library(missMDA)
library(FactoInvestigate)
library(Rcmdr)
require(Factoshiny)
 
res.pca = PCA(fi[,6:8], scale.unit=TRUE, ncp=5, graph=T) #ici ne fonctionne pas, peut être parce que j'ai des "NA"?


Variete annee periode Traitement field.treatment poids_racines taille_racines poids_plantes
var1 an1 3months P1 No 1.96 4.73 NA
var2 an1 3months P1 No 0.11 0.71 NA
var3 an1 3months P1 No 16.09 16.82 NA
var4 an1 3months P1 No 0.25 1.4 NA
var5 an1 3months P1 No 0 0 NA
var1 an1 5months P1 No 13.77 11.53 NA
var2 an1 5months P1 No 5.22 3.13 NA
var3 an1 5months P1 No 30.92 19.96 NA
var4 an1 5months P1 No 0 0.53 NA
var5 an1 5months P1 No 0 0.51 NA
var1 an1 7months P1 No 66.82 24.16 NA
var2 an1 7months P1 No 0.01 0.51 NA
var3 an1 7months P1 No 41.77 20.44 NA
var4 an1 7months P1 No 0 0.53 NA
var5 an1 7months P1 No 0 0.47 NA
var1 an1 3months P1 Yes 4.29 7.96 NA
var2 an1 3months P1 Yes 0 0.87 NA
var3 an1 3months P1 Yes 20.06 16.58 NA
var4 an1 3months P1 Yes 6.3 11.58 NA
var5 an1 3months P1 Yes 0 0.02 NA
var1 an1 5months P1 Yes 28.61 19.69 NA
var2 an1 5months P1 Yes 4.14 1.27 NA
var3 an1 5months P1 Yes 32.25 16.93 NA
var4 an1 5months P1 Yes 22.19 16.02 NA
var5 an1 5months P1 Yes 0 0.56 NA
var1 an1 7months P1 Yes 71.97 21.78 NA
var2 an1 7months P1 Yes 15.72 6.51 NA
var3 an1 7months P1 Yes 55.02 17.51 NA
var4 an1 7months P1 Yes 65.17 23.71 NA
var5 an1 7months P1 Yes 26.84 3.51 NA
var1 an1 3months P2 No 0.02 0.53 NA
var2 an1 3months P2 No 0 0.33 NA
var3 an1 3months P2 No 0.42 2.07 NA
var4 an1 3months P2 No 0.1 0.87 NA
var5 an1 3months P2 No 0.03 0.56 NA
var1 an1 5months P2 No 0 0.56 NA
var2 an1 5months P2 No 0 0.31 NA
var3 an1 5months P2 No 0.27 2.33 NA
var4 an1 5months P2 No 0 0.42 NA
var5 an1 5months P2 No 0 0.33 NA
var1 an1 7months P2 No 0 0.53 NA
var2 an1 7months P2 No 0 0.44 NA
var3 an1 7months P2 No 0 0.47 NA
var4 an1 7months P2 No 0 0.49 NA
var5 an1 7months P2 No 0 0.44 NA
var1 an1 3months P2 Yes 1.09 1.89 NA
var2 an1 3months P2 Yes 0 0.51 NA
var3 an1 3months P2 Yes 0.18 1.29 NA
var4 an1 3months P2 Yes 0 0.44 NA
var5 an1 3months P2 Yes 0 0.38 NA
var1 an1 5months P2 Yes 0 0.44 NA
var2 an1 5months P2 Yes 0 0.38 NA
var2 an2 5months P2 Yes 0 0.51 NA
var3 an1 5months P2 Yes 0 0.49 NA
var4 an1 5months P2 Yes 0 0.56 NA
var5 an1 5months P2 Yes 0 0.53 NA
var1 an1 7months P2 Yes 0 0.49 NA
var2 an1 7months P2 Yes 0 0.49 NA
var3 an1 7months P2 Yes 0.51 0.64 NA
var4 an1 7months P2 Yes 0 0.53 NA
var5 an1 7months P2 Yes 0 0.49 NA
var1 an1 3months Control No 0.23 2.31 NA
var2 an1 3months Control No 10.19 11.8 NA
var3 an1 3months Control No 8.22 10.82 NA
var4 an1 3months Control No 10.33 14.89 NA
var5 an1 3months Control No 5.02 12.18 NA
var1 an1 5months Control No 8.2 16.07 NA
var2 an1 5months Control No 65.44 46.91 NA
var3 an1 5months Control No 17.19 13.58 NA
var4 an1 5months Control No 39.47 36.4 NA
var5 an1 5months Control No 26.96 27.87 NA
var1 an1 7months Control No 82.08 61.89 NA
var2 an1 7months Control No 211.31 122.53 NA
var3 an1 7months Control No 74.39 56.47 NA
var4 an1 7months Control No 101.41 96.31 NA
var5 an1 7months Control No 92.14 62.91 NA
var1 an1 3months Control Yes 0.04 0.38 NA
var2 an1 3months Control Yes 18.89 8.16 NA
var3 an1 3months Control Yes 12.06 17.18 NA
var4 an1 3months Control Yes 0.01 0.67 NA
var5 an1 3months Control Yes 0 0.4 NA
var1 an1 5months Control Yes 0.5 2.04 NA
var2 an1 5months Control Yes 21.67 17.82 NA
var3 an1 5months Control Yes 47.78 34.33 NA
var4 an1 5months Control Yes 0 0.56 NA
var5 an1 5months Control Yes 0 0.51 NA
var1 an1 7months Control Yes 0.41 0.78 NA
var2 an1 7months Control Yes 37.76 14.82 NA
var3 an1 7months Control Yes 132.51 74.04 NA
var4 an1 7months Control Yes 0.26 0.82 NA
var5 an1 7months Control Yes 0.23 0.79 NA
var1 an1 3months P3 No 0 0 NA
var2 an1 3months P3 No 5.16 7.91 NA
var3 an1 3months P3 No 2.42 3.51 NA
var4 an1 3months P3 No 0.46 2.11 NA
var5 an1 3months P3 No 0.28 3.02 NA
var1 an1 5months P3 No 0 0.4 NA
var2 an1 5months P3 No 27.95 14.38 NA
var3 an1 5months P3 No 4.32 3.16 NA
var4 an1 5months P3 No 1.73 3 NA
var5 an1 5months P3 No 3.06 6.69 NA
var1 an1 7months P3 No 3.44 3.49 NA
var2 an1 7months P3 No 120.72 60.78 NA
var3 an1 7months P3 No 1.56 1.49 NA
var4 an1 7months P3 No 39.11 27.56 NA
var5 an1 7months P3 No 45.44 28.56 NA
var1 an1 3months P3 Yes 0.06 0.09 NA
var2 an1 3months P3 Yes 2.22 4.89 NA
var3 an1 3months P3 Yes 1.28 2.07 NA
var4 an1 3months P3 Yes 0 0.02 NA
var5 an1 3months P3 Yes 0.31 0.84 NA
var1 an1 5months P3 Yes 2.2 1.38 NA
var2 an1 5months P3 Yes 20.44 12.38 NA
var3 an1 5months P3 Yes 1.32 2.29 NA
var4 an1 5months P3 Yes 0 0.44 NA
var5 an1 5months P3 Yes 1.7 1.69 NA
var1 an1 7months P3 Yes 3.17 2.22 NA
var2 an1 7months P3 Yes 32.94 18.22 NA
var3 an1 7months P3 Yes 6.56 3.2 NA
var4 an1 7months P3 Yes 0 0.56 NA
var5 an1 7months P3 Yes 0 7.49 NA
var1 an3 3months P2 No 0.08 0.63 2.47
var1 an3 7months P1 Yes 13.98 10.68 2.33
var1 an3 5months P3 No 0.36 1.18 2.29
var1 an3 3months P3 No 0.05 0.63 2.27
var1 an3 7months P2 No 0 0.56 2.11
var1 an3 5months P1 No 0.98 2.4 2.11
var1 an3 3months P1 Yes 0.28 1.86 2.1
var1 an3 5months Control No 8.26 11.83 2.08
var1 an3 3months Control No 0.52 3.5 2.07
var1 an3 3months P3 Yes 0.05 0.76 2.07
var1 an3 7months P3 Yes 1.69 4.26 2.05
var1 an3 3months P2 Yes 0.03 0.47 2.04
var1 an3 7months Control No 37.7 23.53 1.99
var1 an3 7months P1 No 8.3 8.82 1.97
var1 an3 3months Control Yes 0.04 0.6 1.95
var1 an3 5months P2 No 0 0.56 1.92
var1 an3 7months Control Yes 4.09 3.4 1.88
var1 an3 5months P2 Yes 0.02 0.63 1.78
var1 an3 5months Control Yes 1.38 2.7 1.76
var1 an3 5months P3 Yes 0 0.56 1.73
var4 an3 5months P3 No 0.01 0.64 1.73
var4 an3 3months P1 Yes 0.28 1.12 1.72
var4 an3 3months Control No 1.41 4.9 1.67
var1 an3 5months P1 Yes 0.78 2.49 1.66
var1 an3 7months P3 No 0.33 1.39 1.66
var2 an3 3months P1 Yes 0.24 0.79 1.63
var4 an3 7months P2 No 0 0.56 1.63
var4 an3 5months P3 Yes 0 0.56 1.63
var2 an3 3months P3 No 0.5 2.24 1.61
var2 an3 3months Control No 3.51 7.36 1.6
var4 an3 3months P3 Yes 0.05 0.64 1.6
var4 an3 3months P3 No 0.28 1.13 1.6
var1 an3 3months P1 No 0.12 1.46 1.6
var2 an3 7months P2 No 0 0.54 1.59
var2 an3 5months Control No 20.45 20.08 1.59
var4 an3 5months Control No 18.59 15.6 1.58
var4 an3 7months P1 Yes 3.07 3.28 1.56
var4 an3 3months P2 No 0.01 0.47 1.55
var4 an3 3months Control Yes 0.4 2.61 1.55
var2 an3 3months Control Yes 0.26 1.47 1.54
var2 an3 3months P1 No 3.25 7.13 1.54
var4 an3 3months P1 No 0.69 3.04 1.53
var4 an3 5months Control Yes 1.32 4.22 1.53
var2 an3 7months P1 Yes 0.41 1.48 1.53
var2 an3 5months P3 No 0.21 1.69 1.53
var4 an3 7months Control Yes 5.11 4.91 1.5
var1 an3 7months P2 Yes 0.01 0.57 1.5
var4 an3 7months P3 Yes 0.31 1.42 1.46
var2 an3 3months P2 Yes 0.03 0.57 1.45
var2 an3 3months P2 No 0.04 0.57 1.45
var2 an3 5months P2 No 0 0.56 1.43
var2 an3 3months P3 Yes 0.01 0.53 1.42
var2 an3 5months Control Yes 0.98 2.47 1.42
var5 an3 7months P1 Yes 0.14 0.83 1.41
var4 an3 7months P3 No 0.08 1.09 1.4
var2 an3 7months P3 Yes 0 0.56 1.4
var2 an3 7months Control Yes 2.29 2.63 1.39
var4 an3 5months P1 Yes 0.44 1.83 1.39
var5 an3 3months P3 Yes 0.05 0.81 1.38
var2 an3 7months P3 No 0.88 3.37 1.38
var2 an3 5months P1 No 5.86 8.07 1.37
var4 an3 3months P2 Yes 0.01 0.62 1.37
var2 an3 5months P2 Yes 0 0.56 1.34
var5 an3 3months P2 Yes 0.03 0.49 1.33
var4 an3 5months P2 Yes 0 0.57 1.32
var4 an3 5months P2 No 0 0.56 1.31
var2 an3 5months P3 Yes 0 0.56 1.31
var4 an3 7months Control No 33.18 23.38 1.28
var5 an3 5months P2 No 0 0.56 1.28
var2 an3 5months P1 Yes 0.23 1.59 1.27
var5 an3 5months P3 Yes 0 0.56 1.27
var2 an3 7months Control No 46.5 31.92 1.26
var5 an3 3months Control Yes 0.15 1.3 1.25
var4 an3 5months P1 No 2.94 5.36 1.25
var3 an3 3months P1 No 4.51 6.94 1.24
var4 an3 7months P2 Yes 0.03 0.67 1.22
var2 an3 7months P1 No 14.24 10.6 1.21
var3 an3 5months P1 No 5.88 7.2 1.21
var5 an3 3months P1 Yes 0.12 1.06 1.21
var3 an3 3months P3 No 0.5 1.46 1.2
var5 an3 5months Control Yes 0.84 2.51 1.2
var5 an3 5months P2 Yes 0.03 0.62 1.2
var3 an3 5months P2 No 0 0.56 1.19
var2 an3 7months P2 Yes 0 0.52 1.18
var3 an3 5months Control No 20.34 17.79 1.18
var5 an3 5months P3 No 0.18 2.04 1.18
var5 an3 3months P3 No 0.68 3.47 1.17
var5 an3 7months Control Yes 87.49 2.13 1.16
var3 an3 7months P1 No 9.66 8.36 1.15
var5 an3 3months Control No 3.06 8.34 1.14
var4 an3 7months P1 No 8.22 8.22 1.13
var5 an3 3months P1 No 1.98 5.46 1.12
var3 an3 3months Control No 7.61 13.78 1.11
var3 an3 3months P2 No 0.01 0.52 1.11
var5 an3 7months P2 No 0 0.56 1.1
var5 an3 3months P2 No 0.02 0.48 1.09
var3 an3 7months P3 No 0.36 1.97 1.09
var5 an3 7months P3 Yes 0 0.56 1.07
var5 an3 7months P1 No 5.22 6.57 1.07
var5 an3 5months P1 No 3.17 6.49 1.06
var5 an3 5months Control No 12.1 16.61 1.01
var3 an3 7months P2 No 0 0.38 0.99
var3 an3 3months P3 Yes 0 0.54 0.98
var3 an3 5months P1 Yes 0.97 2.61 0.97
var3 an3 5months P3 No 0.06 0.87 0.95
var3 an3 7months Control No 48.85 20.72 0.94
var3 an3 5months P3 Yes 0 0.56 0.93
var5 an3 7months P2 Yes 0 0.56 0.92
var5 an3 7months P3 No 0.08 1.26 0.92
var5 an3 7months Control No 20.54 17.17 0.9
var3 an3 3months P2 Yes 0.04 0.53 0.89
var3 an3 3months Control Yes 0.65 2.37 0.89
var5 an3 5months P1 Yes 0.41 2.38 0.88
var3 an3 7months P1 Yes 0.24 1.1 0.86
var3 an3 5months P2 Yes 0.02 0.64 0.84
var3 an3 5months Control Yes 1.7 2.88 0.83
var3 an3 3months P1 Yes 0.08 0.97 0.77
var3 an3 7months Control Yes 0.93 1.67 0.76
var3 an3 7months P2 Yes 0 0.49 0.71
var3 an3 7months P3 Yes 0 0.56 0.69
var1 an2 5months P3 No 4.14 7.49 2.77
var4 an2 5months P3 No 1.86 5.8 2.74
var1 an2 3months P1 Yes 0.28 0.47 2.67
var4 an2 7months Control Yes 11.37 6.22 2.38
var1 an2 7months P1 No 33.89 20.64 2.37
var1 an2 7months P2 No 0.04 1.49 2.34
var4 an2 3months P1 Yes 0.54 3.47 2.33
var1 an2 5months Control No 26.5 16.93 2.33
var4 an2 7months Control No 105.72 53.18 2.3
var1 an2 5months P1 Yes 1.22 2.02 2.29
var1 an2 7months Control Yes 1.44 1.78 2.29
var4 an2 3months P2 Yes 0.01 0.62 2.21
var1 an2 7months Control No 69.57 26.29 2.21
var1 an2 3months P2 No 0.08 0.78 2.2
var1 an2 3months P1 No 0.72 3.64 2.18
var1 an2 5months P2 No 0.5 2.4 2.16
var1 an2 3months P2 Yes 0 0.2 2.16
var4 an2 3months P3 No 1.57 5.87 2.11
var1 an2 7months P1 Yes 2.72 2.87 2.1
var4 an2 3months Control No 3.73 9 2.07
var4 an2 5months P1 Yes 3.33 4.33 2.06
var4 an2 7months P1 No 97.78 33.42 2.05
var4 an2 7months P1 Yes 36.89 12.6 2.02
var1 an2 3months Control No 2.23 1.67 2.02
var1 an2 5months P2 Yes 0 0.42 2.01
var2 an2 3months Control No 4.21 14 1.99
var1 an2 3months P3 No 0.89 2.73 1.97
var2 an2 3months P1 Yes 0 0.56 1.93
var4 an2 5months P2 No 0.16 0.84 1.9
var4 an2 5months P1 No 4.49 5.44 1.89
var1 an2 3months Control Yes 0.14 0.84 1.88
var1 an2 5months P1 No 5.69 7.87 1.87
var2 an2 3months P2 No 0 0.56 1.84
var4 an2 3months P1 No 1.29 4.67 1.83
var1 an2 3months P3 Yes 0 0.44 1.82
var2 an2 5months P2 No 0.09 0.56 1.81
var4 an2 3months P3 Yes 0.02 0.73 1.81
var2 an2 5months Control No 77.22 39.04 1.78
var3 an2 3months P1 No 3.06 7.71 1.76
var4 an2 5months Control No 34.17 20.38 1.76
var2 an2 3months P2 Yes 0 0.49 1.74
var1 an2 7months P2 Yes 0 1.6 1.72
var4 an2 3months Control Yes 0.22 2.76 1.72
var2 an2 5months P3 No 26.81 19.47 1.71
var5 an2 3months Control No 3.26 10.09 1.69
var4 an2 3months P2 No 0 0.51 1.67
var2 an2 7months Control Yes 2.69 1.93 1.67
var5 an2 3months P1 Yes 0.01 0.62 1.64
var2 an2 3months P3 No 4.08 10.82 1.64
var2 an2 3months P3 Yes 0.01 0.6 1.62
var2 an2 5months P1 Yes 0.11 0.6 1.61
var3 an2 3months P2 No 0 0.58 1.61
var3 an2 3months P3 No 4.71 9.38 1.61
var4 an2 7months P2 Yes 0 0.96 1.6
var2 an2 3months P1 No 2.1 6.58 1.59
var3 an2 3months P1 Yes 0.03 0.64 1.59
var5 an2 3months P2 No 0 0.53 1.59
var4 an2 7months P2 No 0 1.11 1.59
var2 an2 7months P1 No 111.28 35.62 1.58
var2 an2 7months P2 Yes 0 0.4 1.56
var2 an2 7months P1 Yes 0.94 0.98 1.55
var2 an2 7months P2 No 0 0.56 1.53
var1 an2 7months P3 Yes 4.34 1.96 1.53
var3 an2 3months Control No 4.63 9.67 1.53
var3 an2 5months P3 No 15 10.4 1.52
var2 an2 5months P1 No 20.21 12.04 1.52
var1 an2 5months P3 Yes 0.28 1.29 1.52
var4 an2 7months P3 Yes 2.01 1.56 1.49
var3 an2 7months P2 No 0 1.07 1.48
var4 an2 5months P2 Yes 0 0.53 1.44
var1 an2 7months P3 No 8.24 12.2 1.43
var5 an2 3months P1 No 0.79 3.58 1.41
var2 an2 7months P3 No 79.03 25.2 1.4
var2 an2 3months Control Yes 0.18 1.13 1.39
var5 an2 3months P2 Yes 0 0.33 1.37
var3 an2 3months P2 Yes 0 0.33 1.37
var2 an2 5months P3 Yes 0 0.56 1.37
var1 an2 5months Control Yes 3.81 5.29 1.35
var5 an2 5months P3 No 12.94 11.36 1.35
var4 an2 5months P3 Yes 0.38 1.4 1.34
var3 an2 5months P2 No 0.21 1.51 1.32
var2 an2 7months Control No 175.39 67.44 1.32
var5 an2 3months P3 No 2.04 8.87 1.3
var3 an2 7months P3 Yes 1.08 0.91 1.27
var5 an2 5months P2 No 0.16 0.71 1.26
var5 an2 7months Control Yes 1.48 0.96 1.26
var4 an2 5months Control Yes 8.33 8.44 1.25
var5 an2 3months P3 Yes 0.12 2.31 1.25
var3 an2 7months P1 No 67.64 20.58 1.23
var3 an2 7months P1 Yes 0.89 1.09 1.2
var5 an2 5months Control No 32.06 26.62 1.2
var5 an2 5months P1 Yes 0.06 0.87 1.19
var3 an2 5months Control No 32.22 16.84 1.19
var3 an2 7months Control Yes 1.46 0.93 1.19
var3 an2 3months Control Yes 0.17 2.18 1.19
var5 an2 7months P1 Yes 0.8 1.07 1.17
var4 an2 7months P3 No 8.22 12.11 1.17
var5 an2 7months P2 No 0 0.56 1.16
var5 an2 5months P3 Yes 1.29 1.51 1.16
var3 an2 3months P3 Yes 0.01 0.29 1.13
var2 an2 7months P3 Yes 0 0.53 1.13
var5 an2 3months Control Yes 0.37 2.24 1.12
var3 an2 5months Control Yes 1.25 1.98 1.12
var2 an2 5months Control Yes 1.14 2.71 1.12
var3 an2 5months P1 Yes 0.06 0.69 1.09
var3 an2 7months P2 Yes 0 0.56 1.08
var5 an2 5months Control Yes 1.28 3.82 1.08
var3 an2 5months P2 Yes 0 0.51 1.07
var3 an2 5months P1 No 9.23 10.29 1.06
var3 an2 7months P3 No 31.81 11.31 1.04
var5 an2 7months Control No 79.76 26.64 1.03
var3 an2 5months P3 Yes 0.1 0.78 1.02
var3 an2 7months Control No 55.64 25 1
var5 an2 7months P3 Yes 1.97 1.93 1
var5 an2 5months P2 Yes 0 0.53 0.99
var5 an2 7months P1 No 52.54 22.82 0.99
var5 an2 7months P2 Yes 0 0.89 0.99
var5 an2 5months P1 No 2.27 4.73 0.96
var5 an2 7months P3 No 23.59 14.84 0.77
var1 an3 0month Control No 0.04 0.11 1.99
var1 an3 0month Control Yes 0 0 1.96
var2 an3 0month Control No 0 0.09 1.54
var2 an3 0month Control Yes 0 0.27 1.38
var3 an3 0month Control No 0.61 1.57 1.15
var3 an3 0month Control Yes 0 0.43 1.06
var4 an3 0month Control No 0 0.01 1.68
var4 an3 0month Control Yes 0 0.1 1.39
var5 an3 0month Control No 0 0.31 1.35
var5 an3 0month Control Yes 0 0.1 1.29
var1 an2 0month Control No NA 0.42 NA
var1 an2 0month Control Yes NA 0.18 NA
var2 an2 0month Control No NA 0.07 NA
var2 an2 0month Control Yes NA 0.49 NA
var3 an2 0month Control No NA 2.47 NA
var3 an2 0month Control Yes NA 0.44 NA
var4 an2 0month Control No NA 1.73 NA
var4 an2 0month Control Yes NA 0.27 NA
var5 an2 0month Control No NA 0.22 NA
var5 an2 0month Control Yes NA 0.44 NA
var1 an1 0month Control No NA NA NA
var1 an1 0month Control Yes NA NA NA
var2 an1 0month Control No NA NA NA
var2 an1 0month Control Yes NA NA NA
var3 an1 0month Control No NA NA NA
var3 an1 0month Control Yes NA NA NA
var4 an1 0month Control No NA NA NA
var4 an1 0month Control Yes NA NA NA
var5 an1 0month Control No NA NA NA
var5 an1 0month Control Yes NA NA NA

Jean-Emmanuel Longueville
Messages : 310
Enregistré le : 23 Fév 2011, 08:03

Re: ACP sur R avec des NA + mettre couleurs

Messagepar Jean-Emmanuel Longueville » 09 Juil 2019, 13:12

En effet l'acp ne fonctionne pas en présence de NA à vous de choisir si vous supprimer :

- toutes les lignes contenant des NA
- ou seulement la variable qui en contient le plus puis les lignes qui en ont encore.

Une piste pour la suppression des NA est : na.omit
Jean-Emmanuel
Ingénieur d'étude LNEC

margot julien
Messages : 46
Enregistré le : 28 Nov 2017, 12:10

Re: ACP sur R avec des NA + mettre couleurs

Messagepar margot julien » 09 Juil 2019, 13:56

Merci pour le retour.
J'ai utilisé la fonction na.omit comme conseillé pour retirer toutes les lignes avec NA et j'ai aussi retiré une colonne qui en contenait trop comme ceci:

Code : Tout sélectionner

fi_ACP<-subset(fi, select= c (Variete, annee, periode, Traitement, field.treatment, poids_racines, taille_racines))
dim(fi_ACP)
str(fi_ACP)
na.omit_fi_ACP<- na.omit(fi_ACP)
dim(na.omit_fi_ACP)
head(na.omit_fi_ACP)
str(na.omit_fi_ACP)


Maintenant (avec uniquement mes 2 variables mesurées et sans NA) l'ACP fonctionne:

Code : Tout sélectionner

res.pca = PCA(na.omit_fi_ACP[,6:7], scale.unit=TRUE, ncp=5, graph=T)


Savez-vous si il y a un moyen d'ajouter les variables descriptives (variété, field-treatment, traitement, période d'observation, année) peut-être avec des couleurs ou formes différentes afin d'avoir une représentation plus claire de l'ensemble des données?

Merci par avance.

Voici mon fichier au format code (sans les NA):

Code : Tout sélectionner

> dput(na.omit_fi_ACP)
structure(list(Variete = structure(c(1L, 2L, 3L, 4L, 5L, 1L,
2L, 3L, 4L, 5L, 1L, 2L, 3L, 4L, 5L, 1L, 2L, 3L, 4L, 5L, 1L, 2L,
3L, 4L, 5L, 1L, 2L, 3L, 4L, 5L, 1L, 2L, 3L, 4L, 5L, 1L, 2L, 3L,
4L, 5L, 1L, 2L, 3L, 4L, 5L, 1L, 2L, 3L, 4L, 5L, 1L, 2L, 2L, 3L,
4L, 5L, 1L, 2L, 3L, 4L, 5L, 1L, 2L, 3L, 4L, 5L, 1L, 2L, 3L, 4L,
5L, 1L, 2L, 3L, 4L, 5L, 1L, 2L, 3L, 4L, 5L, 1L, 2L, 3L, 4L, 5L,
1L, 2L, 3L, 4L, 5L, 1L, 2L, 3L, 4L, 5L, 1L, 2L, 3L, 4L, 5L, 1L,
2L, 3L, 4L, 5L, 1L, 2L, 3L, 4L, 5L, 1L, 2L, 3L, 4L, 5L, 1L, 2L,
3L, 4L, 5L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 4L, 4L, 4L, 1L, 1L, 2L, 4L, 4L, 2L,
2L, 4L, 4L, 1L, 2L, 2L, 4L, 4L, 4L, 4L, 2L, 2L, 4L, 4L, 2L, 2L,
4L, 1L, 4L, 2L, 2L, 2L, 2L, 2L, 5L, 4L, 2L, 2L, 4L, 5L, 2L, 2L,
4L, 2L, 5L, 4L, 4L, 2L, 4L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, 1L, 1L, 2L, 1L, 2L,
    2L, 1L, 2L, 1L, 1L, 1L, 2L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
    1L, 2L, 1L, 1L, 1L, 1L, 2L, 2L, 1L, 1L, 2L, 2L, 1L, 1L, 2L,
    2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 1L, 1L, 2L, 2L, 1L, 1L,
    2L, 1L, 1L, 2L, 2L, 2L, 1L, 1L, 1L, 1L, 2L, 1L, 2L, 1L, 2L,
    1L, 2L, 1L, 2L, 1L, 1L, 2L, 1L, 1L, 2L, 1L, 1L, 1L, 2L, 1L,
    2L, 1L, 1L, 1L, 2L, 2L, 2L, 1L, 1L, 1L, 2L, 2L, 1L, 2L, 2L,
    1L, 1L, 2L, 1L, 2L, 1L, 1L, 1L, 2L, 2L, 1L, 2L, 1L, 1L, 1L,
    2L, 2L, 1L, 2L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 2L, 1L, 2L, 1L,
    1L, 1L, 2L, 1L, 2L, 2L, 2L, 1L, 2L, 1L, 2L, 1L, 2L, 2L, 2L,
    1L, 1L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 1L, 1L, 1L,
    2L, 1L, 2L, 2L, 1L, 2L, 1L, 1L, 1L, 2L, 1L, 2L, 1L, 2L, 1L,
    2L, 1L, 2L), .Label = c("No", "Yes"), class = "factor"),
    poids_racines = c(1.96, 0.11, 16.09, 0.25, 0, 13.77, 5.22,
    30.92, 0, 0, 66.82, 0.01, 41.77, 0, 0, 4.29, 0, 20.06, 6.3,
    0, 28.61, 4.14, 32.25, 22.19, 0, 71.97, 15.72, 55.02, 65.17,
    26.84, 0.02, 0, 0.42, 0.1, 0.03, 0, 0, 0.27, 0, 0, 0, 0,
    0, 0, 0, 1.09, 0, 0.18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.51,
    0, 0, 0.23, 10.19, 8.22, 10.33, 5.02, 8.2, 65.44, 17.19,
    39.47, 26.96, 82.08, 211.31, 74.39, 101.41, 92.14, 0.04,
    18.89, 12.06, 0.01, 0, 0.5, 21.67, 47.78, 0, 0, 0.41, 37.76,
    132.51, 0.26, 0.23, 0, 5.16, 2.42, 0.46, 0.28, 0, 27.95,
    4.32, 1.73, 3.06, 3.44, 120.72, 1.56, 39.11, 45.44, 0.06,
    2.22, 1.28, 0, 0.31, 2.2, 20.44, 1.32, 0, 1.7, 3.17, 32.94,
    6.56, 0, 0, 0.08, 13.98, 0.36, 0.05, 0, 0.98, 0.28, 8.26,
    0.52, 0.05, 1.69, 0.03, 37.7, 8.3, 0.04, 0, 4.09, 0.02, 1.38,
    0, 0.01, 0.28, 1.41, 0.78, 0.33, 0.24, 0, 0, 0.5, 3.51, 0.05,
    0.28, 0.12, 0, 20.45, 18.59, 3.07, 0.01, 0.4, 0.26, 3.25,
    0.69, 1.32, 0.41, 0.21, 5.11, 0.01, 0.31, 0.03, 0.04, 0,
    0.01, 0.98, 0.14, 0.08, 0, 2.29, 0.44, 0.05, 0.88, 5.86,
    0.01, 0, 0.03, 0, 0, 0, 33.18, 0, 0.23, 0, 46.5, 0.15, 2.94,
    4.51, 0.03, 14.24, 5.88, 0.12, 0.5, 0.84, 0.03, 0, 0, 20.34,
    0.18, 0.68, 87.49, 9.66, 3.06, 8.22, 1.98, 7.61, 0.01, 0,
    0.02, 0.36, 0, 5.22, 3.17, 12.1, 0, 0, 0.97, 0.06, 48.85,
    0, 0, 0.08, 20.54, 0.04, 0.65, 0.41, 0.24, 0.02, 1.7, 0.08,
    0.93, 0, 0, 4.14, 1.86, 0.28, 11.37, 33.89, 0.04, 0.54, 26.5,
    105.72, 1.22, 1.44, 0.01, 69.57, 0.08, 0.72, 0.5, 0, 1.57,
    2.72, 3.73, 3.33, 97.78, 36.89, 2.23, 0, 4.21, 0.89, 0, 0.16,
    4.49, 0.14, 5.69, 0, 1.29, 0, 0.09, 0.02, 77.22, 3.06, 34.17,
    0, 0, 0.22, 26.81, 3.26, 0, 2.69, 0.01, 4.08, 0.01, 0.11,
    0, 4.71, 0, 2.1, 0.03, 0, 0, 111.28, 0, 0.94, 0, 4.34, 4.63,
    15, 20.21, 0.28, 2.01, 0, 0, 8.24, 0.79, 79.03, 0.18, 0,
    0, 0, 3.81, 12.94, 0.38, 0.21, 175.39, 2.04, 1.08, 0.16,
    1.48, 8.33, 0.12, 67.64, 0.89, 32.06, 0.06, 32.22, 1.46,
    0.17, 0.8, 8.22, 0, 1.29, 0.01, 0, 0.37, 1.25, 1.14, 0.06,
    0, 1.28, 0, 9.23, 31.81, 79.76, 0.1, 55.64, 1.97, 0, 52.54,
    0, 2.27, 23.59, 0.04, 0, 0, 0, 0.61, 0, 0, 0, 0, 0), taille_racines = c(4.73,
    0.71, 16.82, 1.4, 0, 11.53, 3.13, 19.96, 0.53, 0.51, 24.16,
    0.51, 20.44, 0.53, 0.47, 7.96, 0.87, 16.58, 11.58, 0.02,
    19.69, 1.27, 16.93, 16.02, 0.56, 21.78, 6.51, 17.51, 23.71,
    3.51, 0.53, 0.33, 2.07, 0.87, 0.56, 0.56, 0.31, 2.33, 0.42,
    0.33, 0.53, 0.44, 0.47, 0.49, 0.44, 1.89, 0.51, 1.29, 0.44,
    0.38, 0.44, 0.38, 0.51, 0.49, 0.56, 0.53, 0.49, 0.49, 0.64,
    0.53, 0.49, 2.31, 11.8, 10.82, 14.89, 12.18, 16.07, 46.91,
    13.58, 36.4, 27.87, 61.89, 122.53, 56.47, 96.31, 62.91, 0.38,
    8.16, 17.18, 0.67, 0.4, 2.04, 17.82, 34.33, 0.56, 0.51, 0.78,
    14.82, 74.04, 0.82, 0.79, 0, 7.91, 3.51, 2.11, 3.02, 0.4,
    14.38, 3.16, 3, 6.69, 3.49, 60.78, 1.49, 27.56, 28.56, 0.09,
    4.89, 2.07, 0.02, 0.84, 1.38, 12.38, 2.29, 0.44, 1.69, 2.22,
    18.22, 3.2, 0.56, 7.49, 0.63, 10.68, 1.18, 0.63, 0.56, 2.4,
    1.86, 11.83, 3.5, 0.76, 4.26, 0.47, 23.53, 8.82, 0.6, 0.56,
    3.4, 0.63, 2.7, 0.56, 0.64, 1.12, 4.9, 2.49, 1.39, 0.79,
    0.56, 0.56, 2.24, 7.36, 0.64, 1.13, 1.46, 0.54, 20.08, 15.6,
    3.28, 0.47, 2.61, 1.47, 7.13, 3.04, 4.22, 1.48, 1.69, 4.91,
    0.57, 1.42, 0.57, 0.57, 0.56, 0.53, 2.47, 0.83, 1.09, 0.56,
    2.63, 1.83, 0.81, 3.37, 8.07, 0.62, 0.56, 0.49, 0.57, 0.56,
    0.56, 23.38, 0.56, 1.59, 0.56, 31.92, 1.3, 5.36, 6.94, 0.67,
    10.6, 7.2, 1.06, 1.46, 2.51, 0.62, 0.56, 0.52, 17.79, 2.04,
    3.47, 2.13, 8.36, 8.34, 8.22, 5.46, 13.78, 0.52, 0.56, 0.48,
    1.97, 0.56, 6.57, 6.49, 16.61, 0.38, 0.54, 2.61, 0.87, 20.72,
    0.56, 0.56, 1.26, 17.17, 0.53, 2.37, 2.38, 1.1, 0.64, 2.88,
    0.97, 1.67, 0.49, 0.56, 7.49, 5.8, 0.47, 6.22, 20.64, 1.49,
    3.47, 16.93, 53.18, 2.02, 1.78, 0.62, 26.29, 0.78, 3.64,
    2.4, 0.2, 5.87, 2.87, 9, 4.33, 33.42, 12.6, 1.67, 0.42, 14,
    2.73, 0.56, 0.84, 5.44, 0.84, 7.87, 0.56, 4.67, 0.44, 0.56,
    0.73, 39.04, 7.71, 20.38, 0.49, 1.6, 2.76, 19.47, 10.09,
    0.51, 1.93, 0.62, 10.82, 0.6, 0.6, 0.58, 9.38, 0.96, 6.58,
    0.64, 0.53, 1.11, 35.62, 0.4, 0.98, 0.56, 1.96, 9.67, 10.4,
    12.04, 1.29, 1.56, 1.07, 0.53, 12.2, 3.58, 25.2, 1.13, 0.33,
    0.33, 0.56, 5.29, 11.36, 1.4, 1.51, 67.44, 8.87, 0.91, 0.71,
    0.96, 8.44, 2.31, 20.58, 1.09, 26.62, 0.87, 16.84, 0.93,
    2.18, 1.07, 12.11, 0.56, 1.51, 0.29, 0.53, 2.24, 1.98, 2.71,
    0.69, 0.56, 3.82, 0.51, 10.29, 11.31, 26.64, 0.78, 25, 1.93,
    0.53, 22.82, 0.89, 4.73, 14.84, 0.11, 0, 0.09, 0.27, 1.57,
    0.43, 0.01, 0.1, 0.31, 0.1)), row.names = c(NA, 370L), class = "data.frame", na.action = structure(371:390, .Names = c("371",
"372", "373", "374", "375", "376", "377", "378", "379", "380",
"381", "382", "383", "384", "385", "386", "387", "388", "389",
"390"), class = "omit"))

Fred Santos
Messages : 233
Enregistré le : 11 Avr 2009, 10:00
Contact :

Re: ACP sur R avec des NA + mettre couleurs

Messagepar Fred Santos » 09 Juil 2019, 17:18

Au-delà des considérations techniques, je ne suis pas sûr de bien voir la pertinence d'une ACP sachant que tu n'as que deux variables, concrètement. Ou bien tu n'utilises pas le bon outil (voir plutôt du côté de l'AFDM pour inclure tes variables quali, cf. fonction FAMD de R), ou bien un simple nuage de points suffirait.
Dans les deux cas, on tombe hors des objectifs de ce forum. ;-)

margot julien
Messages : 46
Enregistré le : 28 Nov 2017, 12:10

Re: ACP sur R avec des NA + mettre couleurs

Messagepar margot julien » 10 Juil 2019, 09:22

Bonjour,

merci pour le retour.
En effet, vous avez raison. Mon objectif est de représenter l'ensemble de mes données graphiquement avec les points des variables mesurées puis une couleur , forme différente pour les variables explicatives dans le but de voir si il y a des groupes qui se forment; par exemple quand tous les poids des racines sont bas, la taille est haute ou alors on pourrait voir que pour une année tous les poids de racines sont bas ou que pour un traitement tous les poids sont élevés et de voir aussi d'éventuelles interactions graphiquement.

Avez-vous une idée de comment je pourrais faire cela, sur un même graphique mettre:
- mes 3 variables mesurées: variable 1: la taille des racines (mm), variable 2: le poids des racines (g), variable 3: le poids des plantes (Kg)) avec un symbole différent

et représenter es variables qui peuvent influencer ces mesures par des symboles, couleurs et tailles différentes par exemple:
-variété --> on pourrait les représenter en ajoutant des noms v1, v2 v3 v4 et v5 sur le graphique
-traitement --> on pourrait mettre 4 couleurs différentes
-Field treatment --> mettre des tailles de points différents
-année de l'essai (N=3 pour variable 1 et 2 et N=2 pour variable 3) --> ?? cela va faire trop pour le graphique?

et enfin pour ce qui est de la période d'observation dans le temps en mois (N=4) je pense que c'est mieux de faire un graphique par période sinon cela va être illisible, qu'en pensez-vous? comment faire cela sur R? est-ce qu'il y aurait une autre solution? un type d'analyse pour ce genre de représentation visuelle?

Merci par avance pour votre aide.

Fred Santos
Messages : 233
Enregistré le : 11 Avr 2009, 10:00
Contact :

Re: ACP sur R avec des NA + mettre couleurs

Messagepar Fred Santos » 10 Juil 2019, 10:22

margot julien a écrit :Avez-vous une idée de comment je pourrais faire cela, sur un même graphique mettre:
- mes 3 variables mesurées: variable 1: la taille des racines (mm), variable 2: le poids des racines (g), variable 3: le poids des plantes (Kg)) avec un symbole différent

Des pistes :
https://datascienceplus.com/how-to-make ... d-package/
http://www.sthda.com/english/wiki/impre ... ualization

et représenter es variables qui peuvent influencer ces mesures par des symboles, couleurs et tailles différentes par exemple:
-variété --> on pourrait les représenter en ajoutant des noms v1, v2 v3 v4 et v5 sur le graphique
-traitement --> on pourrait mettre 4 couleurs différentes
-Field treatment --> mettre des tailles de points différents
-année de l'essai (N=3 pour variable 1 et 2 et N=2 pour variable 3) --> ?? cela va faire trop pour le graphique?

Clairement ce ne sera pas les 4 info à la fois sans quoi ce sera purement et simplement illisible, mais une par une ça ne posera aucun souci (cf. liens ci-dessus).
Ou alors, s'il faut tout représenter à la fois, on en revient effectivement à ceci : http://www.sthda.com/french/articles/38 ... essentiel/

Mais au risque de radoter, ces questions-là auraient plutôt leur place sur un forum de stats ou ici, puisqu'on sort du cadre du présent forum : ce ne sont pas des questions sur R mais des questions de méthode. ;-)

margot julien
Messages : 46
Enregistré le : 28 Nov 2017, 12:10

Re: ACP sur R avec des NA + mettre couleurs

Messagepar margot julien » 11 Juil 2019, 06:15

Parfait, merci beaucoup pour les pistes. Je vais aussi poser ma question sur des sites orientés "méthode".
Bonne journée à vous.
Salutations.


Retourner vers « Questions en cours »

Qui est en ligne

Utilisateurs parcourant ce forum : Aucun utilisateur enregistré et 1 invité