Retour à la page d’accueil



Exercice 1:

Ajouter le test statistique le plus approprié aux deux graphiques suivant:

ggplot(expt1, aes(fluctuation, rosette.leaf.num)) +
  geom_violin() +
  stat_compare_means()
## Warning: Removed 95 rows containing non-finite values (stat_ydensity).
## Warning: Removed 95 rows containing non-finite values (stat_compare_means).

ggplot(expt1, aes(days.to.bolt, days.to.flower)) +
    geom_point() +
  stat_cor()
## Warning: Removed 83 rows containing non-finite values (stat_cor).
## Warning: Removed 83 rows containing missing values (geom_point).

> > BONUS: Ajoutez une ligne de régression (pour le graphique où cela est possible). Déplacez le résultat du test statistique pour qu’il soit au meilleur endroit sur le graphique. Qu’est ce que vous pouvez conclure pour chacun de ces graphiques?

ggplot(expt1, aes(days.to.bolt, days.to.flower)) +
    geom_point() +
  stat_cor() +
  geom_smooth()
## Warning: Removed 83 rows containing non-finite values (stat_cor).
## `geom_smooth()` using method = 'loess' and formula 'y ~ x'
## Warning: Removed 83 rows containing non-finite values (stat_smooth).
## Warning: Removed 83 rows containing missing values (geom_point).

On observe une corrélation positive significative (p-value<2.2e-16, test de pearson) entre le nombre de jours jusqu’à floraison et le nombre de jours jusqu’au bolting.

ggplot(expt1, aes(fluctuation, rosette.leaf.num)) +
  geom_violin() +
  stat_compare_means(label.x.npc="middle")
## Warning: Removed 95 rows containing non-finite values (stat_ydensity).
## Warning: Removed 95 rows containing non-finite values (stat_compare_means).

On observe une différence significative (p-value=0.014, test de Wilcoxon) pour la moyenne du nombre de feuilles de rosettes en fonction du type de traitement de température utilisé. Les plantes ayant poussé avec une température constante ont un nombre de feuille plus élevé en moyenne que celles ayant poussé avec une température fluctuante.

Exercice 2:

Calculez la médiane et l’écart-type de blade.length.mm et total.leaf.length.mm pour chaque genotype aux différentes day.length. Calculez aussi le nombre d’observations de chaque groupe.

group_by(expt1, genotype, day.length) %>% 
  summarise(mediane.blade.length.mm= median(blade.length.mm, na.rm=TRUE),
            mediane.total.leaf.length.mm= median(total.leaf.length.mm, na.rm=TRUE),
            sd.blade.length.mm= sd(blade.length.mm, na.rm=TRUE),
            sd.total.leaf.length.mm= sd(total.leaf.length.mm, na.rm=TRUE))
## `summarise()` regrouping output by 'genotype' (override with `.groups` argument)
## # A tibble: 20 x 6
## # Groups:   genotype [10]
##    genotype day.length mediane.blade.l… mediane.total.l… sd.blade.length…
##    <chr>         <dbl>            <dbl>            <dbl>            <dbl>
##  1 Col Ama           8             23.1             39.1             4.13
##  2 Col Ama          16             13.7             23               2.12
##  3 Col FRI           8             23.4             40.0             3.78
##  4 Col FRI          16             20.1             34               3.75
##  5 fca-6             8             22.4             34.8             5.28
##  6 fca-6            16             16.8             27.8             3.02
##  7 flc-3 F…          8             23.5             39.8             3.99
##  8 flc-3 F…         16             13.5             21.5             3.05
##  9 flk-1             8             23.2             39.1             9.75
## 10 flk-1            16             20.8             35.3             3.63
## 11 fve-3             8             20.5             37.9             3.12
## 12 fve-3            16             21.9             36.6             2.13
## 13 ld-1              8             24.4             37.2             4.12
## 14 ld-1             16             24.2             40.0             3.03
## 15 Ler-1             8             21.6             34.4             8.00
## 16 Ler-1            16             13.8             17.9             3.65
## 17 prmt5 F…          8             20.8             34.1             3.62
## 18 prmt5 F…         16             19.9             32.5             3.81
## 19 vin3-4 …          8             21.4             39.6             3.49
## 20 vin3-4 …         16             23.6             39.3             3.23
## # … with 1 more variable: sd.total.leaf.length.mm <dbl>

Exercice 3

Faites un voilin plot de total.leaf.length.mm pour chaque génotype et ajoutez la médiane pour chaque groupe (avec un point coloré) ainsi que le nombre d’observation de chaque groupe

group_by(expt1, genotype) %>% 
  summarise(n.obs=n(),
            mediane.leaf.length=median(total.leaf.length.mm, na.rm=TRUE)) %>% 
  mutate(n.obs=paste("n =",n.obs)) %>% 
  full_join(expt1, by="genotype") %>% 
  ggplot( aes(genotype, total.leaf.length.mm)) +
  geom_violin() +
  geom_point(aes(x=genotype,y=mediane.leaf.length), colour="red") +
  geom_text(aes(label=n.obs, x=genotype, y=0)) 
## `summarise()` ungrouping output (override with `.groups` argument)
## Warning: Removed 303 rows containing non-finite values (stat_ydensity).

BONUS: Modifiez le graphique que vous venez de créer pour ajouter les comparaison de moyenne de chaque génotype avec Col Ama (comme sur le graphique ci-dessous)

my_comparisons <- list( c("Col Ama", "Col FRI"), c("Col Ama", "fca-6"),c("Col Ama", "flc-3 FRI"),
                        c("Col Ama", "flk-1"),c("Col Ama", "fve-3"),c("Col Ama", "ld-1"),
                        c("Col Ama", "Ler-1"),c("Col Ama", "prmt5 FRI"),c("Col Ama", "vin3-4 FRI"))


group_by(expt1, genotype) %>% 
  summarise(n.obs=n(),
            mediane.leaf.length=median(total.leaf.length.mm, na.rm=TRUE)) %>% 
  mutate(n.obs=paste("n =",n.obs)) %>% 
  full_join(expt1, by="genotype") %>% 
  ggplot( aes(genotype, total.leaf.length.mm)) +
  geom_violin() +
  geom_point(aes(x=genotype,y=mediane.leaf.length), colour="red") +
  geom_text(aes(label=n.obs, x=genotype, y=0)) +
  stat_compare_means(comparisons = my_comparisons)
## `summarise()` ungrouping output (override with `.groups` argument)
## Warning: Removed 303 rows containing non-finite values (stat_ydensity).
## Warning: Removed 303 rows containing non-finite values (stat_signif).

Exercice 4: Filtrez les données pour garder les plantes selon les 3 cas de figures suivant (indépendants les uns des autres):

  1. Plantes qui ne sont pas du background Ler et qui ont été traitées avec une température fluctuante.
filter(expt1, background!="Ler" & fluctuation=="Var")
## # A tibble: 389 x 15
##    plant_nb genotype background temperature fluctuation day.length vernalization
##       <dbl> <chr>    <chr>            <dbl> <chr>            <dbl> <chr>        
##  1        1 Col Ama  Col                 12 Var                 16 NV           
##  2        2 Col Ama  Col                 12 Var                 16 NV           
##  3        3 Col Ama  Col                 12 Var                 16 NV           
##  4        4 Col Ama  Col                 12 Var                 16 NV           
##  5        5 Col Ama  Col                 12 Var                 16 NV           
##  6        6 Col Ama  Col                 12 Var                 16 NV           
##  7        7 Col Ama  Col                 12 Var                 16 NV           
##  8        8 Col Ama  Col                 12 Var                 16 NV           
##  9        1 Col Ama  Col                 12 Var                  8 NV           
## 10        2 Col Ama  Col                 12 Var                  8 NV           
## # … with 379 more rows, and 8 more variables: survival.bolt <chr>, bolt <chr>,
## #   days.to.bolt <dbl>, days.to.flower <dbl>, rosette.leaf.num <dbl>,
## #   cauline.leaf.num <dbl>, blade.length.mm <dbl>, total.leaf.length.mm <dbl>
  1. Plantes qui ont fleuries (bolt) en moins de 57 jours et qui ont moins de 40 feuilles de rosette
filter(expt1, days.to.bolt<57 & cauline.leaf.num<40)
## # A tibble: 464 x 15
##    plant_nb genotype background temperature fluctuation day.length vernalization
##       <dbl> <chr>    <chr>            <dbl> <chr>            <dbl> <chr>        
##  1        1 Col Ama  Col                 12 Con                 16 NV           
##  2        2 Col Ama  Col                 12 Con                 16 NV           
##  3        3 Col Ama  Col                 12 Con                 16 NV           
##  4        4 Col Ama  Col                 12 Con                 16 NV           
##  5        5 Col Ama  Col                 12 Con                 16 NV           
##  6        6 Col Ama  Col                 12 Con                 16 NV           
##  7        7 Col Ama  Col                 12 Con                 16 NV           
##  8        8 Col Ama  Col                 12 Con                 16 NV           
##  9        1 Col Ama  Col                 12 Var                 16 NV           
## 10        2 Col Ama  Col                 12 Var                 16 NV           
## # … with 454 more rows, and 8 more variables: survival.bolt <chr>, bolt <chr>,
## #   days.to.bolt <dbl>, days.to.flower <dbl>, rosette.leaf.num <dbl>,
## #   cauline.leaf.num <dbl>, blade.length.mm <dbl>, total.leaf.length.mm <dbl>
  1. Plantes du génotype fca-6 pour qui le blade.length.mm n’est pas manquant
filter(expt1, genotype=="fca-6", !is.na(blade.length.mm))
## # A tibble: 44 x 15
##    plant_nb genotype background temperature fluctuation day.length vernalization
##       <dbl> <chr>    <chr>            <dbl> <chr>            <dbl> <chr>        
##  1        1 fca-6    Ler                 12 Con                 16 NV           
##  2        2 fca-6    Ler                 12 Con                 16 NV           
##  3        3 fca-6    Ler                 12 Con                 16 NV           
##  4        4 fca-6    Ler                 12 Con                 16 NV           
##  5        5 fca-6    Ler                 12 Con                 16 NV           
##  6        6 fca-6    Ler                 12 Con                 16 NV           
##  7        7 fca-6    Ler                 12 Con                 16 NV           
##  8        8 fca-6    Ler                 12 Con                 16 NV           
##  9        1 fca-6    Ler                 12 Con                  8 NV           
## 10        2 fca-6    Ler                 12 Con                  8 NV           
## # … with 34 more rows, and 8 more variables: survival.bolt <chr>, bolt <chr>,
## #   days.to.bolt <dbl>, days.to.flower <dbl>, rosette.leaf.num <dbl>,
## #   cauline.leaf.num <dbl>, blade.length.mm <dbl>, total.leaf.length.mm <dbl>