ANOVA sur mesures répétées

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

Simon Pouil
Messages : 7
Enregistré le : 18 Fév 2018, 10:44

ANOVA sur mesures répétées

Messagepar Simon Pouil » 18 Mar 2020, 16:22

Bonjour à tout.e.s,

J'espère que je pose cette question au bon endroit.
J'ai réalisé une expérience vivant à mesurer des taux de filtration (CR) chez deux espèces de bivalves (Species) exposés à 4 températures (Temp.fac). L'expérience a été faite de jour puis de nuit (Light) avec les mêmes individus (Ind). Voici mon jeu de données:

Code : Tout sélectionner

 #Donnees
Low.food
     Ind            Species Temp Light Food         CR Temp.fac
1     1 Corbicula fluminea   10  Dark  Low 135.043571       10
2     2 Corbicula fluminea   10  Dark  Low 111.303527       10
3     3 Corbicula fluminea   10  Dark  Low 116.679320       10
4     4 Corbicula fluminea   10  Dark  Low  68.308738       10
5     5 Corbicula fluminea   10  Dark  Low 138.679111       10
6     6 Corbicula fluminea   10  Dark  Low   0.000000       10
7     7 Corbicula fluminea   10  Dark  Low  67.668204       10
8     8 Corbicula fluminea   10  Dark  Low 179.693177       10
9     9    Lampsilis ovata   10  Dark  Low   0.000000       10
10   10    Lampsilis ovata   10  Dark  Low 286.276747       10
11   11    Lampsilis ovata   10  Dark  Low 396.544756       10
12   12    Lampsilis ovata   10  Dark  Low 283.516987       10
13   13    Lampsilis ovata   10  Dark  Low 187.449443       10
14   14    Lampsilis ovata   10  Dark  Low 298.805863       10
15   15    Lampsilis ovata   10  Dark  Low 227.563088       10
16   16    Lampsilis ovata   10  Dark  Low 273.046142       10
17    1 Corbicula fluminea   10 Light  Low  92.394119       10
18    2 Corbicula fluminea   10 Light  Low 149.005839       10
19    3 Corbicula fluminea   10 Light  Low 137.511994       10
20    4 Corbicula fluminea   10 Light  Low 204.061669       10
21    5 Corbicula fluminea   10 Light  Low 176.288980       10
22    6 Corbicula fluminea   10 Light  Low   0.000000       10
23    7 Corbicula fluminea   10 Light  Low 187.049779       10
24    8 Corbicula fluminea   10 Light  Low 160.345553       10
25    9    Lampsilis ovata   10 Light  Low 600.612438       10
26   10    Lampsilis ovata   10 Light  Low 440.099819       10
27   11    Lampsilis ovata   10 Light  Low 585.026912       10
28   12    Lampsilis ovata   10 Light  Low 244.044045       10
29   13    Lampsilis ovata   10 Light  Low 138.380733       10
30   14    Lampsilis ovata   10 Light  Low 219.377102       10
31   15    Lampsilis ovata   10 Light  Low 329.905918       10
32   16    Lampsilis ovata   10 Light  Low 293.373147       10
33   17 Corbicula fluminea   15  Dark  Low 114.509869       15
34   18 Corbicula fluminea   15  Dark  Low 402.491366       15
35   19 Corbicula fluminea   15  Dark  Low 292.216070       15
36   20 Corbicula fluminea   15  Dark  Low 314.940211       15
37   21 Corbicula fluminea   15  Dark  Low 185.898722       15
38   22 Corbicula fluminea   15  Dark  Low 249.669653       15
39   23 Corbicula fluminea   15  Dark  Low 289.074040       15
40   24 Corbicula fluminea   15  Dark  Low 196.649432       15
41   25    Lampsilis ovata   15  Dark  Low 529.086973       15
42   26    Lampsilis ovata   15  Dark  Low 510.443884       15
43   27    Lampsilis ovata   15  Dark  Low 485.561259       15
44   28    Lampsilis ovata   15  Dark  Low 366.379617       15
45   29    Lampsilis ovata   15  Dark  Low 341.180901       15
46   30    Lampsilis ovata   15  Dark  Low 136.057439       15
47   31    Lampsilis ovata   15  Dark  Low 512.408129       15
48   32    Lampsilis ovata   15  Dark  Low 539.481506       15
49   17 Corbicula fluminea   15 Light  Low 173.690441       15
50   18 Corbicula fluminea   15 Light  Low 471.642796       15
51   19 Corbicula fluminea   15 Light  Low 296.069814       15
52   20 Corbicula fluminea   15 Light  Low 203.449867       15
53   21 Corbicula fluminea   15 Light  Low 284.374648       15
54   22 Corbicula fluminea   15 Light  Low 397.414331       15
55   23 Corbicula fluminea   15 Light  Low 392.281365       15
56   24 Corbicula fluminea   15 Light  Low 397.850595       15
57   25    Lampsilis ovata   15 Light  Low 533.486837       15
58   26    Lampsilis ovata   15 Light  Low 254.825460       15
59   27    Lampsilis ovata   15 Light  Low 347.021381       15
60   28    Lampsilis ovata   15 Light  Low 159.976292       15
61   29    Lampsilis ovata   15 Light  Low 501.051113       15
62   30    Lampsilis ovata   15 Light  Low 244.325450       15
63   31    Lampsilis ovata   15 Light  Low 485.552469       15
64   32    Lampsilis ovata   15 Light  Low 619.189683       15
65   33 Corbicula fluminea   20  Dark  Low 387.453425       20
66   34 Corbicula fluminea   20  Dark  Low 272.111521       20
67   35 Corbicula fluminea   20  Dark  Low 323.985097       20
68   36 Corbicula fluminea   20  Dark  Low 341.526070       20
69   37 Corbicula fluminea   20  Dark  Low   8.997132       20
70   38 Corbicula fluminea   20  Dark  Low   0.000000       20
71   39 Corbicula fluminea   20  Dark  Low   1.047647       20
72   40 Corbicula fluminea   20  Dark  Low 372.163828       20
73   41    Lampsilis ovata   20  Dark  Low 104.174991       20
74   42    Lampsilis ovata   20  Dark  Low 662.638202       20
75   43    Lampsilis ovata   20  Dark  Low 732.252415       20
76   44    Lampsilis ovata   20  Dark  Low 580.399036       20
77   45    Lampsilis ovata   20  Dark  Low 625.958893       20
78   46    Lampsilis ovata   20  Dark  Low 611.299753       20
79   47    Lampsilis ovata   20  Dark  Low 459.770817       20
80   48    Lampsilis ovata   20  Dark  Low  97.116105       20
81   33 Corbicula fluminea   20 Light  Low   0.000000       20
82   34 Corbicula fluminea   20 Light  Low 339.611807       20
83   35 Corbicula fluminea   20 Light  Low   1.921766       20
84   36 Corbicula fluminea   20 Light  Low 298.577415       20
85   37 Corbicula fluminea   20 Light  Low  14.145785       20
86   38 Corbicula fluminea   20 Light  Low 229.786798       20
87   39 Corbicula fluminea   20 Light  Low 391.712153       20
88   40 Corbicula fluminea   20 Light  Low 293.175052       20
89   41    Lampsilis ovata   20 Light  Low 590.010156       20
90   42    Lampsilis ovata   20 Light  Low 417.415762       20
91   43    Lampsilis ovata   20 Light  Low 540.350738       20
92   44    Lampsilis ovata   20 Light  Low 375.402525       20
93   45    Lampsilis ovata   20 Light  Low 419.160798       20
94   46    Lampsilis ovata   20 Light  Low 802.685452       20
95   47    Lampsilis ovata   20 Light  Low 317.359457       20
96   48    Lampsilis ovata   20 Light  Low 268.721333       20
97   49 Corbicula fluminea   25  Dark  Low   0.000000       25
98   50 Corbicula fluminea   25  Dark  Low 433.323618       25
99   51 Corbicula fluminea   25  Dark  Low  14.523455       25
100  52 Corbicula fluminea   25  Dark  Low   7.674266       25
101  53 Corbicula fluminea   25  Dark  Low 348.018823       25
102  54 Corbicula fluminea   25  Dark  Low 200.378868       25
103  55 Corbicula fluminea   25  Dark  Low   0.000000       25
104  56 Corbicula fluminea   25  Dark  Low 359.858384       25
105  57    Lampsilis ovata   25  Dark  Low 685.211204       25
106  58    Lampsilis ovata   25  Dark  Low 904.615732       25
107  59    Lampsilis ovata   25  Dark  Low 689.766894       25
108  60    Lampsilis ovata   25  Dark  Low 546.404265       25
109  61    Lampsilis ovata   25  Dark  Low 515.068921       25
110  62    Lampsilis ovata   25  Dark  Low 422.093635       25
111  63    Lampsilis ovata   25  Dark  Low 587.326212       25
112  64    Lampsilis ovata   25  Dark  Low 723.062643       25
113  49 Corbicula fluminea   25 Light  Low   0.000000       25
114  50 Corbicula fluminea   25 Light  Low  16.972120       25
115  51 Corbicula fluminea   25 Light  Low 287.532691       25
116  52 Corbicula fluminea   25 Light  Low   4.448288       25
117  53 Corbicula fluminea   25 Light  Low   0.000000       25
118  54 Corbicula fluminea   25 Light  Low 394.347294       25
119  55 Corbicula fluminea   25 Light  Low 358.981115       25
120  56 Corbicula fluminea   25 Light  Low   8.450351       25
121  57    Lampsilis ovata   25 Light  Low 527.560585       25
122  58    Lampsilis ovata   25 Light  Low 614.357973       25
123  59    Lampsilis ovata   25 Light  Low 449.734513       25
124  60    Lampsilis ovata   25 Light  Low 355.281813       25
125  61    Lampsilis ovata   25 Light  Low 535.817361       25
126  62    Lampsilis ovata   25 Light  Low 388.232641       25
127  63    Lampsilis ovata   25 Light  Low 544.858733       25
128  64    Lampsilis ovata   25 Light  Low 571.152458       25


Plus d'information concernant la structure du data.frame :

Code : Tout sélectionner

 # Structure du data.frame
 str(Low.food)
'data.frame':   128 obs. of  7 variables:
 $ Ind     : int  1 2 3 4 5 6 7 8 9 10 ...
 $ Species : Factor w/ 2 levels "Corbicula fluminea",..: 1 1 1 1 1 1 1 1 2 2 ...
 $ Temp    : int  10 10 10 10 10 10 10 10 10 10 ...
 $ Light   : Factor w/ 2 levels "Dark","Light": 1 1 1 1 1 1 1 1 1 1 ...
 $ Food    : Factor w/ 2 levels "High","Low": 2 2 2 2 2 2 2 2 2 2 ...
 $ CR      : num  135 111.3 116.7 68.3 138.7 ...
 $ Temp.fac: Factor w/ 4 levels "10","15","20",..: 1 1 1 1 1 1 1 1 1 1 ...
>


J'essaye de réaliser une ANOVA à 3 facteurs sur mesures répétées où CR est ma variable explicative et Species, Temp et Light sont mes variables réponses. J'ai utilisé pour ce faire la fonction anova_test() du package rstatix dont l'utilisation est aisée.

Préalablement à l'ANOVA, j'ai édité un QQ-plot pour évaluer la normalité :

Code : Tout sélectionner

# QQ plot
library(ggpubr)
ggqqplot(Low.food, "CR", ggtheme = theme_bw()) +
  facet_grid(Species + Temp.fac ~ Light, labeller = "label_both")


Comme tous les points se situent approximativement le long de la ligne de référence, la normalité semble respectée.

J'ai donc ensuite réalisé mon ANOVA :

Code : Tout sélectionner

# ANOVA sur mesures repetees
library(rstatix)
res.aov <- anova_test(data = Low.food, dv = CR, wid = Ind,
  within = c(Species, Temp.fac, Light))


J'obtiens l'erreur suivante :
Error in lm.fit(x, y, offset = offset, singular.ok = singular.ok, ...) :
0 (non-NA) cases

Mon jeu de données contient des valeurs égales à 0 (certains individus n'ont pas filtrés donc le CR égal à 0). J'ai essayé de refaire la même analyse après avoir remplacé les 0 par des 100 juste pour voir si l'erreur était due à la présence de 0 dans mes données mais j'ai obtenu le même message d'erreur.

Quelqu'un aurait une idée d'où peut venir cette 'erreur ?

Merci par avance de votre aide.

Bien à vous,

Simon

Retourner vers « Questions en cours »

Qui est en ligne

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