setwd("~/Library/CloudStorage/GoogleDrive-icarounam@gmail.com/Mi unidad/Agrosavia/Colaboraciones/René/1er_Cd/data")
datos<-read.table("granofinmod.csv", header=T, sep=',')
datos$curva <- factor(datos$curva, levels = c("1", "2", "3"), 
                      labels = c("T3", "T1", "T2"))
datos$gen<-as.factor(datos$gen)
datos$curva<-as.factor(datos$curva)
datos$id<-as.factor(datos$id)
datos$muestra<-as.factor(datos$muestra)
datos$diam2<-as.factor(datos$diam2)
library(ggplot2)
library(Rmisc)
## Loading required package: lattice
## Loading required package: plyr
library(dplyr)
## Warning: package 'dplyr' was built under R version 4.1.2
## 
## Attaching package: 'dplyr'
## The following objects are masked from 'package:plyr':
## 
##     arrange, count, desc, failwith, id, mutate, rename, summarise,
##     summarize
## The following objects are masked from 'package:stats':
## 
##     filter, lag
## The following objects are masked from 'package:base':
## 
##     intersect, setdiff, setequal, union
library(tidyverse)
## ── Attaching packages ─────────────────────────────────────── tidyverse 1.3.1 ──
## ✔ tibble  3.2.1     ✔ purrr   1.0.1
## ✔ tidyr   1.3.0     ✔ stringr 1.5.0
## ✔ readr   2.1.1     ✔ forcats 1.0.0
## Warning: package 'tibble' was built under R version 4.1.2
## Warning: package 'tidyr' was built under R version 4.1.2
## Warning: package 'purrr' was built under R version 4.1.2
## Warning: package 'stringr' was built under R version 4.1.2
## Warning: package 'forcats' was built under R version 4.1.2
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## ✖ dplyr::arrange()   masks plyr::arrange()
## ✖ purrr::compact()   masks plyr::compact()
## ✖ dplyr::count()     masks plyr::count()
## ✖ dplyr::desc()      masks plyr::desc()
## ✖ dplyr::failwith()  masks plyr::failwith()
## ✖ dplyr::filter()    masks stats::filter()
## ✖ dplyr::id()        masks plyr::id()
## ✖ dplyr::lag()       masks stats::lag()
## ✖ dplyr::mutate()    masks plyr::mutate()
## ✖ dplyr::rename()    masks plyr::rename()
## ✖ dplyr::summarise() masks plyr::summarise()
## ✖ dplyr::summarize() masks plyr::summarize()
library(ggpubr)
## 
## Attaching package: 'ggpubr'
## The following object is masked from 'package:plyr':
## 
##     mutate
library(rstatix)
## 
## Attaching package: 'rstatix'
## The following objects are masked from 'package:plyr':
## 
##     desc, mutate
## The following object is masked from 'package:stats':
## 
##     filter
library(emmeans)
##Summary statistics
summ<-datos %>%
  group_by(curva, gen, diam2) %>%
  get_summary_stats(cd.grano.c, type = "mean_sd")
summ %>% as_tibble() %>% print(n=Inf)
## # A tibble: 36 × 7
##    curva gen   diam2 variable       n  mean    sd
##    <fct> <fct> <fct> <chr>      <dbl> <dbl> <dbl>
##  1 T3    CCN51 0     cd.grano.c     3  8.76 0.807
##  2 T3    CCN51 2     cd.grano.c     3  8.23 0.315
##  3 T3    CCN51 5     cd.grano.c     3  7.78 0.312
##  4 T3    CCN51 6     cd.grano.c     3  7.39 0.137
##  5 T3    ICS95 0     cd.grano.c     3 11.8  0.664
##  6 T3    ICS95 2     cd.grano.c     3 11.5  0.69 
##  7 T3    ICS95 5     cd.grano.c     3 10.9  0.43 
##  8 T3    ICS95 6     cd.grano.c     3 10.2  0.624
##  9 T3    TCS01 0     cd.grano.c     3  9.67 1.76 
## 10 T3    TCS01 2     cd.grano.c     3  8.30 0.355
## 11 T3    TCS01 5     cd.grano.c     3  7.78 0.919
## 12 T3    TCS01 6     cd.grano.c     3  7.05 0.342
## 13 T1    CCN51 0     cd.grano.c     3  9.53 0.448
## 14 T1    CCN51 2     cd.grano.c     3  8.37 0.615
## 15 T1    CCN51 5     cd.grano.c     3  7.88 0.551
## 16 T1    CCN51 6     cd.grano.c     3  7.69 0.489
## 17 T1    ICS95 0     cd.grano.c     3 10.0  0.77 
## 18 T1    ICS95 2     cd.grano.c     3  9.63 0.824
## 19 T1    ICS95 5     cd.grano.c     3  9.30 0.831
## 20 T1    ICS95 6     cd.grano.c     3  8.75 1.11 
## 21 T1    TCS01 0     cd.grano.c     3  7.71 1.30 
## 22 T1    TCS01 2     cd.grano.c     3  6.75 0.419
## 23 T1    TCS01 5     cd.grano.c     3  6.55 0.337
## 24 T1    TCS01 6     cd.grano.c     3  6.41 0.396
## 25 T2    CCN51 0     cd.grano.c     3  7.27 0.486
## 26 T2    CCN51 2     cd.grano.c     3  6.98 0.512
## 27 T2    CCN51 5     cd.grano.c     3  6.47 0.139
## 28 T2    CCN51 6     cd.grano.c     3  5.70 0.729
## 29 T2    ICS95 0     cd.grano.c     3 12.2  0.301
## 30 T2    ICS95 2     cd.grano.c     3 11.5  0.228
## 31 T2    ICS95 5     cd.grano.c     3 11.4  0.156
## 32 T2    ICS95 6     cd.grano.c     3 10.8  0.495
## 33 T2    TCS01 0     cd.grano.c     3  8.98 0.476
## 34 T2    TCS01 2     cd.grano.c     3  8.75 0.442
## 35 T2    TCS01 5     cd.grano.c     3  8.21 0.16 
## 36 T2    TCS01 6     cd.grano.c     3  6.69 0.393
##Visualization
bxp <- ggboxplot(
  datos, x = "curva", y = "cd.grano.c",
  color = "diam2", palette = "jco",
  facet.by =  "gen"
)
bxp

##Check assumptions
##Outliers

datos %>%
  group_by(curva, gen, diam2) %>%
  identify_outliers(cd.grano.c)
##  [1] curva      gen        diam2      muestra    id         dia       
##  [7] cd.grano   curva.1    protocolo  gen.1      muestra.1  dia.1     
## [13] diam       Testa      Grano      cd.grano.1 cd.grano.c cd.grano.a
## [19] cd.grano.d is.outlier is.extreme
## <0 rows> (or 0-length row.names)
##Normality assumption
##Compute Shapiro-Wilk test for each combinations of factor levels:
  
norm<-datos %>%
  group_by(curva, gen, diam2) %>%
  shapiro_test(cd.grano.c)
norm %>% as_tibble() %>% print(n=Inf)
## # A tibble: 36 × 6
##    curva gen   diam2 variable   statistic       p
##    <fct> <fct> <fct> <chr>          <dbl>   <dbl>
##  1 T3    CCN51 0     cd.grano.c     0.934 0.504  
##  2 T3    CCN51 2     cd.grano.c     0.913 0.428  
##  3 T3    CCN51 5     cd.grano.c     0.781 0.0705 
##  4 T3    CCN51 6     cd.grano.c     0.904 0.400  
##  5 T3    ICS95 0     cd.grano.c     0.994 0.847  
##  6 T3    ICS95 2     cd.grano.c     0.971 0.672  
##  7 T3    ICS95 5     cd.grano.c     0.774 0.0533 
##  8 T3    ICS95 6     cd.grano.c     0.919 0.449  
##  9 T3    TCS01 0     cd.grano.c     0.991 0.820  
## 10 T3    TCS01 2     cd.grano.c     0.756 0.0134 
## 11 T3    TCS01 5     cd.grano.c     0.824 0.173  
## 12 T3    TCS01 6     cd.grano.c     0.994 0.857  
## 13 T1    CCN51 0     cd.grano.c     0.999 0.940  
## 14 T1    CCN51 2     cd.grano.c     0.857 0.258  
## 15 T1    CCN51 5     cd.grano.c     0.893 0.363  
## 16 T1    CCN51 6     cd.grano.c     0.993 0.836  
## 17 T1    ICS95 0     cd.grano.c     0.978 0.718  
## 18 T1    ICS95 2     cd.grano.c     0.828 0.182  
## 19 T1    ICS95 5     cd.grano.c     0.844 0.226  
## 20 T1    ICS95 6     cd.grano.c     0.785 0.0783 
## 21 T1    TCS01 0     cd.grano.c     0.785 0.0788 
## 22 T1    TCS01 2     cd.grano.c     0.754 0.00911
## 23 T1    TCS01 5     cd.grano.c     0.968 0.658  
## 24 T1    TCS01 6     cd.grano.c     1.00  0.979  
## 25 T2    CCN51 0     cd.grano.c     0.989 0.799  
## 26 T2    CCN51 2     cd.grano.c     0.972 0.678  
## 27 T2    CCN51 5     cd.grano.c     0.946 0.551  
## 28 T2    CCN51 6     cd.grano.c     0.912 0.424  
## 29 T2    ICS95 0     cd.grano.c     0.950 0.567  
## 30 T2    ICS95 2     cd.grano.c     0.986 0.770  
## 31 T2    ICS95 5     cd.grano.c     0.973 0.683  
## 32 T2    ICS95 6     cd.grano.c     0.809 0.135  
## 33 T2    TCS01 0     cd.grano.c     0.813 0.147  
## 34 T2    TCS01 2     cd.grano.c     0.932 0.496  
## 35 T2    TCS01 5     cd.grano.c     0.888 0.349  
## 36 T2    TCS01 6     cd.grano.c     1.00  0.986
##Create QQ plot for each cell of design:
    
    ggqqplot(datos, "cd.grano.c", ggtheme = theme_bw()) +
    facet_grid(diam2~ curva*gen, labeller = "label_both")
## Warning: The following aesthetics were dropped during statistical transformation: sample
## ℹ This can happen when ggplot fails to infer the correct grouping structure in
##   the data.
## ℹ Did you forget to specify a `group` aesthetic or to convert a numerical
##   variable into a factor?
## Warning: The following aesthetics were dropped during statistical transformation: sample
## ℹ This can happen when ggplot fails to infer the correct grouping structure in
##   the data.
## ℹ Did you forget to specify a `group` aesthetic or to convert a numerical
##   variable into a factor?
## The following aesthetics were dropped during statistical transformation: sample
## ℹ This can happen when ggplot fails to infer the correct grouping structure in
##   the data.
## ℹ Did you forget to specify a `group` aesthetic or to convert a numerical
##   variable into a factor?
## The following aesthetics were dropped during statistical transformation: sample
## ℹ This can happen when ggplot fails to infer the correct grouping structure in
##   the data.
## ℹ Did you forget to specify a `group` aesthetic or to convert a numerical
##   variable into a factor?
## The following aesthetics were dropped during statistical transformation: sample
## ℹ This can happen when ggplot fails to infer the correct grouping structure in
##   the data.
## ℹ Did you forget to specify a `group` aesthetic or to convert a numerical
##   variable into a factor?
## The following aesthetics were dropped during statistical transformation: sample
## ℹ This can happen when ggplot fails to infer the correct grouping structure in
##   the data.
## ℹ Did you forget to specify a `group` aesthetic or to convert a numerical
##   variable into a factor?
## The following aesthetics were dropped during statistical transformation: sample
## ℹ This can happen when ggplot fails to infer the correct grouping structure in
##   the data.
## ℹ Did you forget to specify a `group` aesthetic or to convert a numerical
##   variable into a factor?
## The following aesthetics were dropped during statistical transformation: sample
## ℹ This can happen when ggplot fails to infer the correct grouping structure in
##   the data.
## ℹ Did you forget to specify a `group` aesthetic or to convert a numerical
##   variable into a factor?
## The following aesthetics were dropped during statistical transformation: sample
## ℹ This can happen when ggplot fails to infer the correct grouping structure in
##   the data.
## ℹ Did you forget to specify a `group` aesthetic or to convert a numerical
##   variable into a factor?
## The following aesthetics were dropped during statistical transformation: sample
## ℹ This can happen when ggplot fails to infer the correct grouping structure in
##   the data.
## ℹ Did you forget to specify a `group` aesthetic or to convert a numerical
##   variable into a factor?
## The following aesthetics were dropped during statistical transformation: sample
## ℹ This can happen when ggplot fails to infer the correct grouping structure in
##   the data.
## ℹ Did you forget to specify a `group` aesthetic or to convert a numerical
##   variable into a factor?
## The following aesthetics were dropped during statistical transformation: sample
## ℹ This can happen when ggplot fails to infer the correct grouping structure in
##   the data.
## ℹ Did you forget to specify a `group` aesthetic or to convert a numerical
##   variable into a factor?
## The following aesthetics were dropped during statistical transformation: sample
## ℹ This can happen when ggplot fails to infer the correct grouping structure in
##   the data.
## ℹ Did you forget to specify a `group` aesthetic or to convert a numerical
##   variable into a factor?
## The following aesthetics were dropped during statistical transformation: sample
## ℹ This can happen when ggplot fails to infer the correct grouping structure in
##   the data.
## ℹ Did you forget to specify a `group` aesthetic or to convert a numerical
##   variable into a factor?
## The following aesthetics were dropped during statistical transformation: sample
## ℹ This can happen when ggplot fails to infer the correct grouping structure in
##   the data.
## ℹ Did you forget to specify a `group` aesthetic or to convert a numerical
##   variable into a factor?
## The following aesthetics were dropped during statistical transformation: sample
## ℹ This can happen when ggplot fails to infer the correct grouping structure in
##   the data.
## ℹ Did you forget to specify a `group` aesthetic or to convert a numerical
##   variable into a factor?
## The following aesthetics were dropped during statistical transformation: sample
## ℹ This can happen when ggplot fails to infer the correct grouping structure in
##   the data.
## ℹ Did you forget to specify a `group` aesthetic or to convert a numerical
##   variable into a factor?
## The following aesthetics were dropped during statistical transformation: sample
## ℹ This can happen when ggplot fails to infer the correct grouping structure in
##   the data.
## ℹ Did you forget to specify a `group` aesthetic or to convert a numerical
##   variable into a factor?
## The following aesthetics were dropped during statistical transformation: sample
## ℹ This can happen when ggplot fails to infer the correct grouping structure in
##   the data.
## ℹ Did you forget to specify a `group` aesthetic or to convert a numerical
##   variable into a factor?
## The following aesthetics were dropped during statistical transformation: sample
## ℹ This can happen when ggplot fails to infer the correct grouping structure in
##   the data.
## ℹ Did you forget to specify a `group` aesthetic or to convert a numerical
##   variable into a factor?
## The following aesthetics were dropped during statistical transformation: sample
## ℹ This can happen when ggplot fails to infer the correct grouping structure in
##   the data.
## ℹ Did you forget to specify a `group` aesthetic or to convert a numerical
##   variable into a factor?
## The following aesthetics were dropped during statistical transformation: sample
## ℹ This can happen when ggplot fails to infer the correct grouping structure in
##   the data.
## ℹ Did you forget to specify a `group` aesthetic or to convert a numerical
##   variable into a factor?
## The following aesthetics were dropped during statistical transformation: sample
## ℹ This can happen when ggplot fails to infer the correct grouping structure in
##   the data.
## ℹ Did you forget to specify a `group` aesthetic or to convert a numerical
##   variable into a factor?
## The following aesthetics were dropped during statistical transformation: sample
## ℹ This can happen when ggplot fails to infer the correct grouping structure in
##   the data.
## ℹ Did you forget to specify a `group` aesthetic or to convert a numerical
##   variable into a factor?
## The following aesthetics were dropped during statistical transformation: sample
## ℹ This can happen when ggplot fails to infer the correct grouping structure in
##   the data.
## ℹ Did you forget to specify a `group` aesthetic or to convert a numerical
##   variable into a factor?
## The following aesthetics were dropped during statistical transformation: sample
## ℹ This can happen when ggplot fails to infer the correct grouping structure in
##   the data.
## ℹ Did you forget to specify a `group` aesthetic or to convert a numerical
##   variable into a factor?
## The following aesthetics were dropped during statistical transformation: sample
## ℹ This can happen when ggplot fails to infer the correct grouping structure in
##   the data.
## ℹ Did you forget to specify a `group` aesthetic or to convert a numerical
##   variable into a factor?
## The following aesthetics were dropped during statistical transformation: sample
## ℹ This can happen when ggplot fails to infer the correct grouping structure in
##   the data.
## ℹ Did you forget to specify a `group` aesthetic or to convert a numerical
##   variable into a factor?
## The following aesthetics were dropped during statistical transformation: sample
## ℹ This can happen when ggplot fails to infer the correct grouping structure in
##   the data.
## ℹ Did you forget to specify a `group` aesthetic or to convert a numerical
##   variable into a factor?
## The following aesthetics were dropped during statistical transformation: sample
## ℹ This can happen when ggplot fails to infer the correct grouping structure in
##   the data.
## ℹ Did you forget to specify a `group` aesthetic or to convert a numerical
##   variable into a factor?
## The following aesthetics were dropped during statistical transformation: sample
## ℹ This can happen when ggplot fails to infer the correct grouping structure in
##   the data.
## ℹ Did you forget to specify a `group` aesthetic or to convert a numerical
##   variable into a factor?
## The following aesthetics were dropped during statistical transformation: sample
## ℹ This can happen when ggplot fails to infer the correct grouping structure in
##   the data.
## ℹ Did you forget to specify a `group` aesthetic or to convert a numerical
##   variable into a factor?
## The following aesthetics were dropped during statistical transformation: sample
## ℹ This can happen when ggplot fails to infer the correct grouping structure in
##   the data.
## ℹ Did you forget to specify a `group` aesthetic or to convert a numerical
##   variable into a factor?
## The following aesthetics were dropped during statistical transformation: sample
## ℹ This can happen when ggplot fails to infer the correct grouping structure in
##   the data.
## ℹ Did you forget to specify a `group` aesthetic or to convert a numerical
##   variable into a factor?
## The following aesthetics were dropped during statistical transformation: sample
## ℹ This can happen when ggplot fails to infer the correct grouping structure in
##   the data.
## ℹ Did you forget to specify a `group` aesthetic or to convert a numerical
##   variable into a factor?
## The following aesthetics were dropped during statistical transformation: sample
## ℹ This can happen when ggplot fails to infer the correct grouping structure in
##   the data.
## ℹ Did you forget to specify a `group` aesthetic or to convert a numerical
##   variable into a factor?
## The following aesthetics were dropped during statistical transformation: sample
## ℹ This can happen when ggplot fails to infer the correct grouping structure in
##   the data.
## ℹ Did you forget to specify a `group` aesthetic or to convert a numerical
##   variable into a factor?
## The following aesthetics were dropped during statistical transformation: sample
## ℹ This can happen when ggplot fails to infer the correct grouping structure in
##   the data.
## ℹ Did you forget to specify a `group` aesthetic or to convert a numerical
##   variable into a factor?
## The following aesthetics were dropped during statistical transformation: sample
## ℹ This can happen when ggplot fails to infer the correct grouping structure in
##   the data.
## ℹ Did you forget to specify a `group` aesthetic or to convert a numerical
##   variable into a factor?
## The following aesthetics were dropped during statistical transformation: sample
## ℹ This can happen when ggplot fails to infer the correct grouping structure in
##   the data.
## ℹ Did you forget to specify a `group` aesthetic or to convert a numerical
##   variable into a factor?
## The following aesthetics were dropped during statistical transformation: sample
## ℹ This can happen when ggplot fails to infer the correct grouping structure in
##   the data.
## ℹ Did you forget to specify a `group` aesthetic or to convert a numerical
##   variable into a factor?
## The following aesthetics were dropped during statistical transformation: sample
## ℹ This can happen when ggplot fails to infer the correct grouping structure in
##   the data.
## ℹ Did you forget to specify a `group` aesthetic or to convert a numerical
##   variable into a factor?
## The following aesthetics were dropped during statistical transformation: sample
## ℹ This can happen when ggplot fails to infer the correct grouping structure in
##   the data.
## ℹ Did you forget to specify a `group` aesthetic or to convert a numerical
##   variable into a factor?
## The following aesthetics were dropped during statistical transformation: sample
## ℹ This can happen when ggplot fails to infer the correct grouping structure in
##   the data.
## ℹ Did you forget to specify a `group` aesthetic or to convert a numerical
##   variable into a factor?
## The following aesthetics were dropped during statistical transformation: sample
## ℹ This can happen when ggplot fails to infer the correct grouping structure in
##   the data.
## ℹ Did you forget to specify a `group` aesthetic or to convert a numerical
##   variable into a factor?
## The following aesthetics were dropped during statistical transformation: sample
## ℹ This can happen when ggplot fails to infer the correct grouping structure in
##   the data.
## ℹ Did you forget to specify a `group` aesthetic or to convert a numerical
##   variable into a factor?
## The following aesthetics were dropped during statistical transformation: sample
## ℹ This can happen when ggplot fails to infer the correct grouping structure in
##   the data.
## ℹ Did you forget to specify a `group` aesthetic or to convert a numerical
##   variable into a factor?
## The following aesthetics were dropped during statistical transformation: sample
## ℹ This can happen when ggplot fails to infer the correct grouping structure in
##   the data.
## ℹ Did you forget to specify a `group` aesthetic or to convert a numerical
##   variable into a factor?
## The following aesthetics were dropped during statistical transformation: sample
## ℹ This can happen when ggplot fails to infer the correct grouping structure in
##   the data.
## ℹ Did you forget to specify a `group` aesthetic or to convert a numerical
##   variable into a factor?
## The following aesthetics were dropped during statistical transformation: sample
## ℹ This can happen when ggplot fails to infer the correct grouping structure in
##   the data.
## ℹ Did you forget to specify a `group` aesthetic or to convert a numerical
##   variable into a factor?
## The following aesthetics were dropped during statistical transformation: sample
## ℹ This can happen when ggplot fails to infer the correct grouping structure in
##   the data.
## ℹ Did you forget to specify a `group` aesthetic or to convert a numerical
##   variable into a factor?
## The following aesthetics were dropped during statistical transformation: sample
## ℹ This can happen when ggplot fails to infer the correct grouping structure in
##   the data.
## ℹ Did you forget to specify a `group` aesthetic or to convert a numerical
##   variable into a factor?
## The following aesthetics were dropped during statistical transformation: sample
## ℹ This can happen when ggplot fails to infer the correct grouping structure in
##   the data.
## ℹ Did you forget to specify a `group` aesthetic or to convert a numerical
##   variable into a factor?
## The following aesthetics were dropped during statistical transformation: sample
## ℹ This can happen when ggplot fails to infer the correct grouping structure in
##   the data.
## ℹ Did you forget to specify a `group` aesthetic or to convert a numerical
##   variable into a factor?
## The following aesthetics were dropped during statistical transformation: sample
## ℹ This can happen when ggplot fails to infer the correct grouping structure in
##   the data.
## ℹ Did you forget to specify a `group` aesthetic or to convert a numerical
##   variable into a factor?
## The following aesthetics were dropped during statistical transformation: sample
## ℹ This can happen when ggplot fails to infer the correct grouping structure in
##   the data.
## ℹ Did you forget to specify a `group` aesthetic or to convert a numerical
##   variable into a factor?
## The following aesthetics were dropped during statistical transformation: sample
## ℹ This can happen when ggplot fails to infer the correct grouping structure in
##   the data.
## ℹ Did you forget to specify a `group` aesthetic or to convert a numerical
##   variable into a factor?
## The following aesthetics were dropped during statistical transformation: sample
## ℹ This can happen when ggplot fails to infer the correct grouping structure in
##   the data.
## ℹ Did you forget to specify a `group` aesthetic or to convert a numerical
##   variable into a factor?
## The following aesthetics were dropped during statistical transformation: sample
## ℹ This can happen when ggplot fails to infer the correct grouping structure in
##   the data.
## ℹ Did you forget to specify a `group` aesthetic or to convert a numerical
##   variable into a factor?
## The following aesthetics were dropped during statistical transformation: sample
## ℹ This can happen when ggplot fails to infer the correct grouping structure in
##   the data.
## ℹ Did you forget to specify a `group` aesthetic or to convert a numerical
##   variable into a factor?
## The following aesthetics were dropped during statistical transformation: sample
## ℹ This can happen when ggplot fails to infer the correct grouping structure in
##   the data.
## ℹ Did you forget to specify a `group` aesthetic or to convert a numerical
##   variable into a factor?
## The following aesthetics were dropped during statistical transformation: sample
## ℹ This can happen when ggplot fails to infer the correct grouping structure in
##   the data.
## ℹ Did you forget to specify a `group` aesthetic or to convert a numerical
##   variable into a factor?
## The following aesthetics were dropped during statistical transformation: sample
## ℹ This can happen when ggplot fails to infer the correct grouping structure in
##   the data.
## ℹ Did you forget to specify a `group` aesthetic or to convert a numerical
##   variable into a factor?
## The following aesthetics were dropped during statistical transformation: sample
## ℹ This can happen when ggplot fails to infer the correct grouping structure in
##   the data.
## ℹ Did you forget to specify a `group` aesthetic or to convert a numerical
##   variable into a factor?
## The following aesthetics were dropped during statistical transformation: sample
## ℹ This can happen when ggplot fails to infer the correct grouping structure in
##   the data.
## ℹ Did you forget to specify a `group` aesthetic or to convert a numerical
##   variable into a factor?
## The following aesthetics were dropped during statistical transformation: sample
## ℹ This can happen when ggplot fails to infer the correct grouping structure in
##   the data.
## ℹ Did you forget to specify a `group` aesthetic or to convert a numerical
##   variable into a factor?
## The following aesthetics were dropped during statistical transformation: sample
## ℹ This can happen when ggplot fails to infer the correct grouping structure in
##   the data.
## ℹ Did you forget to specify a `group` aesthetic or to convert a numerical
##   variable into a factor?
## The following aesthetics were dropped during statistical transformation: sample
## ℹ This can happen when ggplot fails to infer the correct grouping structure in
##   the data.
## ℹ Did you forget to specify a `group` aesthetic or to convert a numerical
##   variable into a factor?
## The following aesthetics were dropped during statistical transformation: sample
## ℹ This can happen when ggplot fails to infer the correct grouping structure in
##   the data.
## ℹ Did you forget to specify a `group` aesthetic or to convert a numerical
##   variable into a factor?
## The following aesthetics were dropped during statistical transformation: sample
## ℹ This can happen when ggplot fails to infer the correct grouping structure in
##   the data.
## ℹ Did you forget to specify a `group` aesthetic or to convert a numerical
##   variable into a factor?
## The following aesthetics were dropped during statistical transformation: sample
## ℹ This can happen when ggplot fails to infer the correct grouping structure in
##   the data.
## ℹ Did you forget to specify a `group` aesthetic or to convert a numerical
##   variable into a factor?
## The following aesthetics were dropped during statistical transformation: sample
## ℹ This can happen when ggplot fails to infer the correct grouping structure in
##   the data.
## ℹ Did you forget to specify a `group` aesthetic or to convert a numerical
##   variable into a factor?

##Homogneity of variance assumption
    
##Compute the Levene’s test at each level of the within-subjects factor, here time variable:
      
lev<-datos %>%
      group_by(diam2) %>%
      levene_test(cd.grano.c ~ curva*gen)
lev %>% as_tibble() %>% print(n=Inf)
## # A tibble: 4 × 5
##   diam2   df1   df2 statistic     p
##   <fct> <int> <int>     <dbl> <dbl>
## 1 0         8    18     0.659 0.720
## 2 2         8    18     0.245 0.976
## 3 5         8    18     0.476 0.857
## 4 6         8    18     0.338 0.940
##Computation
      
res.aov <- anova_test(
        data = datos, dv = cd.grano.c, wid = id,
        within = diam2, between = c(curva, gen)
      )
res.aov
## ANOVA Table (type II tests)
## 
## $ANOVA
##            Effect DFn DFd      F        p p<.05   ges
## 1           curva   2  18  6.595 7.00e-03     * 0.326
## 2             gen   2  18 95.539 2.60e-10     * 0.875
## 3           diam2   3  54 71.579 8.13e-19     * 0.576
## 4       curva:gen   4  18 11.174 9.83e-05     * 0.621
## 5     curva:diam2   6  54  1.686 1.42e-01       0.060
## 6       gen:diam2   6  54  1.176 3.33e-01       0.043
## 7 curva:gen:diam2  12  54  1.286 2.54e-01       0.089
## 
## $`Mauchly's Test for Sphericity`
##            Effect     W     p p<.05
## 1           diam2 0.295 0.001     *
## 2     curva:diam2 0.295 0.001     *
## 3       gen:diam2 0.295 0.001     *
## 4 curva:gen:diam2 0.295 0.001     *
## 
## $`Sphericity Corrections`
##            Effect   GGe      DF[GG]    p[GG] p[GG]<.05  HFe      DF[HF]
## 1           diam2 0.559 1.68, 30.21 1.76e-11         * 0.61 1.83, 32.96
## 2     curva:diam2 0.559 3.36, 30.21 1.87e-01           0.61 3.66, 32.96
## 3       gen:diam2 0.559 3.36, 30.21 3.38e-01           0.61 3.66, 32.96
## 4 curva:gen:diam2 0.559 6.71, 30.21 2.91e-01           0.61 7.33, 32.96
##      p[HF] p[HF]<.05
## 1 2.47e-12         *
## 2 1.81e-01          
## 3 3.38e-01          
## 4 2.87e-01
get_anova_table(res.aov)
## ANOVA Table (type II tests)
## 
##            Effect  DFn   DFd      F        p p<.05   ges
## 1           curva 2.00 18.00  6.595 7.00e-03     * 0.326
## 2             gen 2.00 18.00 95.539 2.60e-10     * 0.875
## 3           diam2 1.68 30.21 71.579 1.76e-11     * 0.576
## 4       curva:gen 4.00 18.00 11.174 9.83e-05     * 0.621
## 5     curva:diam2 3.36 30.21  1.686 1.87e-01       0.060
## 6       gen:diam2 3.36 30.21  1.176 3.38e-01       0.043
## 7 curva:gen:diam2 6.71 30.21  1.286 2.91e-01       0.089
#Table by error
res.aov.error <- aov(cd.grano.c ~ diam2*curva*gen + Error(id/diam2), datos)
res.aov.error
## 
## Call:
## aov(formula = cd.grano.c ~ diam2 * curva * gen + Error(id/diam2), 
##     data = datos)
## 
## Grand Mean: 8.690667
## 
## Stratum 1: id
## 
## Terms:
##                     curva       gen curva:gen Residuals
## Sum of Squares   14.51771 210.30386  49.19511  19.81119
## Deg. of Freedom         2         2         4        18
## 
## Residual standard error: 1.049105
## 24 out of 32 effects not estimable
## Estimated effects may be unbalanced
## 
## Stratum 2: id:diam2
## 
## Terms:
##                    diam2 diam2:curva diam2:gen diam2:curva:gen Residuals
## Sum of Squares  40.82593     1.92349   1.34164         2.93389  10.26652
## Deg. of Freedom        3           6         6              12        54
## 
## Residual standard error: 0.4360284
## Estimated effects may be unbalanced
summary(res.aov.error)
## 
## Error: id
##           Df Sum Sq Mean Sq F value   Pr(>F)    
## curva      2  14.52    7.26   6.595   0.0071 ** 
## gen        2 210.30  105.15  95.539 2.60e-10 ***
## curva:gen  4  49.20   12.30  11.174 9.83e-05 ***
## Residuals 18  19.81    1.10                     
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Error: id:diam2
##                 Df Sum Sq Mean Sq F value Pr(>F)    
## diam2            3  40.83  13.609  71.579 <2e-16 ***
## diam2:curva      6   1.92   0.321   1.686  0.142    
## diam2:gen        6   1.34   0.224   1.176  0.333    
## diam2:curva:gen 12   2.93   0.244   1.286  0.254    
## Residuals       54  10.27   0.190                   
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## Emmeans
emmip(res.aov.error, gen ~ diam2 | curva)
## Note: re-fitting model with sum-to-zero contrasts

emm_curva <- emmeans(res.aov.error, pairwise ~ curva)
## Note: re-fitting model with sum-to-zero contrasts
## NOTE: Results may be misleading due to involvement in interactions
emm_curva
## $emmeans
##  curva emmean    SE df lower.CL upper.CL
##  T3      9.11 0.175 18     8.74     9.48
##  T1      8.22 0.175 18     7.85     8.58
##  T2      8.75 0.175 18     8.38     9.12
## 
## Results are averaged over the levels of: diam2, gen 
## Warning: EMMs are biased unless design is perfectly balanced 
## Confidence level used: 0.95 
## 
## $contrasts
##  contrast estimate    SE df t.ratio p.value
##  T3 - T1     0.893 0.247 18   3.610  0.0054
##  T3 - T2     0.361 0.247 18   1.458  0.3336
##  T1 - T2    -0.532 0.247 18  -2.151  0.1075
## 
## Results are averaged over the levels of: diam2, gen 
## P value adjustment: tukey method for comparing a family of 3 estimates
emm_gen_curva <- emmeans(res.aov.error, pairwise ~ gen | curva)
## Note: re-fitting model with sum-to-zero contrasts
## NOTE: Results may be misleading due to involvement in interactions
emm_gen_curva
## $emmeans
## curva = T3:
##  gen   emmean    SE df lower.CL upper.CL
##  CCN51   8.04 0.303 18     7.40     8.68
##  ICS95  11.09 0.303 18    10.45    11.72
##  TCS01   8.20 0.303 18     7.56     8.84
## 
## curva = T1:
##  gen   emmean    SE df lower.CL upper.CL
##  CCN51   8.37 0.303 18     7.73     9.01
##  ICS95   9.42 0.303 18     8.79    10.06
##  TCS01   6.85 0.303 18     6.22     7.49
## 
## curva = T2:
##  gen   emmean    SE df lower.CL upper.CL
##  CCN51   6.61 0.303 18     5.97     7.24
##  ICS95  11.48 0.303 18    10.84    12.12
##  TCS01   8.16 0.303 18     7.52     8.79
## 
## Results are averaged over the levels of: diam2 
## Warning: EMMs are biased unless design is perfectly balanced 
## Confidence level used: 0.95 
## 
## $contrasts
## curva = T3:
##  contrast      estimate    SE df t.ratio p.value
##  CCN51 - ICS95   -3.048 0.428 18  -7.117  <.0001
##  CCN51 - TCS01   -0.161 0.428 18  -0.375  0.9258
##  ICS95 - TCS01    2.888 0.428 18   6.742  <.0001
## 
## curva = T1:
##  contrast      estimate    SE df t.ratio p.value
##  CCN51 - ICS95   -1.055 0.428 18  -2.464  0.0595
##  CCN51 - TCS01    1.514 0.428 18   3.535  0.0064
##  ICS95 - TCS01    2.570 0.428 18   5.999  <.0001
## 
## curva = T2:
##  contrast      estimate    SE df t.ratio p.value
##  CCN51 - ICS95   -4.875 0.428 18 -11.382  <.0001
##  CCN51 - TCS01   -1.552 0.428 18  -3.624  0.0052
##  ICS95 - TCS01    3.323 0.428 18   7.758  <.0001
## 
## Results are averaged over the levels of: diam2 
## P value adjustment: tukey method for comparing a family of 3 estimates
emm_gen_diam2 <- emmeans(res.aov.error, pairwise ~ diam2 | curva*gen)
## Note: re-fitting model with sum-to-zero contrasts
emm_gen_diam2
## $emmeans
## curva = T3, gen = CCN51:
##  diam2 emmean    SE   df lower.CL upper.CL
##  0       8.76 0.373 38.1     8.01     9.52
##  2       8.23 0.373 38.1     7.47     8.98
##  5       7.78 0.373 38.1     7.02     8.53
##  6       7.39 0.373 38.1     6.63     8.15
## 
## curva = T1, gen = CCN51:
##  diam2 emmean    SE   df lower.CL upper.CL
##  0       9.53 0.373 38.1     8.78    10.29
##  2       8.37 0.373 38.1     7.61     9.12
##  5       7.88 0.373 38.1     7.13     8.64
##  6       7.69 0.373 38.1     6.93     8.45
## 
## curva = T2, gen = CCN51:
##  diam2 emmean    SE   df lower.CL upper.CL
##  0       7.27 0.373 38.1     6.51     8.02
##  2       6.98 0.373 38.1     6.22     7.73
##  5       6.47 0.373 38.1     5.72     7.23
##  6       5.70 0.373 38.1     4.95     6.46
## 
## curva = T3, gen = ICS95:
##  diam2 emmean    SE   df lower.CL upper.CL
##  0      11.75 0.373 38.1    10.99    12.51
##  2      11.48 0.373 38.1    10.72    12.23
##  5      10.94 0.373 38.1    10.18    11.69
##  6      10.18 0.373 38.1     9.43    10.94
## 
## curva = T1, gen = ICS95:
##  diam2 emmean    SE   df lower.CL upper.CL
##  0      10.02 0.373 38.1     9.26    10.77
##  2       9.63 0.373 38.1     8.87    10.38
##  5       9.31 0.373 38.1     8.55    10.06
##  6       8.75 0.373 38.1     7.99     9.50
## 
## curva = T2, gen = ICS95:
##  diam2 emmean    SE   df lower.CL upper.CL
##  0      12.16 0.373 38.1    11.41    12.92
##  2      11.55 0.373 38.1    10.79    12.30
##  5      11.43 0.373 38.1    10.67    12.19
##  6      10.78 0.373 38.1    10.03    11.54
## 
## curva = T3, gen = TCS01:
##  diam2 emmean    SE   df lower.CL upper.CL
##  0       9.67 0.373 38.1     8.92    10.43
##  2       8.30 0.373 38.1     7.54     9.05
##  5       7.78 0.373 38.1     7.02     8.53
##  6       7.05 0.373 38.1     6.29     7.80
## 
## curva = T1, gen = TCS01:
##  diam2 emmean    SE   df lower.CL upper.CL
##  0       7.71 0.373 38.1     6.95     8.46
##  2       6.75 0.373 38.1     5.99     7.51
##  5       6.55 0.373 38.1     5.79     7.30
##  6       6.41 0.373 38.1     5.66     7.17
## 
## curva = T2, gen = TCS01:
##  diam2 emmean    SE   df lower.CL upper.CL
##  0       8.98 0.373 38.1     8.23     9.74
##  2       8.75 0.373 38.1     7.99     9.50
##  5       8.21 0.373 38.1     7.46     8.97
##  6       6.69 0.373 38.1     5.93     7.44
## 
## Warning: EMMs are biased unless design is perfectly balanced 
## Confidence level used: 0.95 
## 
## $contrasts
## curva = T3, gen = CCN51:
##  contrast estimate    SE df t.ratio p.value
##  0 - 2       0.535 0.356 54   1.502  0.4435
##  0 - 5       0.986 0.356 54   2.769  0.0375
##  0 - 6       1.372 0.356 54   3.854  0.0017
##  2 - 5       0.451 0.356 54   1.267  0.5877
##  2 - 6       0.837 0.356 54   2.352  0.0991
##  5 - 6       0.386 0.356 54   1.085  0.7000
## 
## curva = T1, gen = CCN51:
##  contrast estimate    SE df t.ratio p.value
##  0 - 2       1.166 0.356 54   3.276  0.0097
##  0 - 5       1.649 0.356 54   4.632  0.0001
##  0 - 6       1.843 0.356 54   5.177  <.0001
##  2 - 5       0.483 0.356 54   1.356  0.5322
##  2 - 6       0.677 0.356 54   1.901  0.2399
##  5 - 6       0.194 0.356 54   0.545  0.9475
## 
## curva = T2, gen = CCN51:
##  contrast estimate    SE df t.ratio p.value
##  0 - 2       0.288 0.356 54   0.810  0.8495
##  0 - 5       0.793 0.356 54   2.226  0.1291
##  0 - 6       1.565 0.356 54   4.396  0.0003
##  2 - 5       0.504 0.356 54   1.417  0.4947
##  2 - 6       1.277 0.356 54   3.586  0.0039
##  5 - 6       0.772 0.356 54   2.169  0.1449
## 
## curva = T3, gen = ICS95:
##  contrast estimate    SE df t.ratio p.value
##  0 - 2       0.271 0.356 54   0.760  0.8719
##  0 - 5       0.815 0.356 54   2.288  0.1135
##  0 - 6       1.566 0.356 54   4.398  0.0003
##  2 - 5       0.544 0.356 54   1.528  0.4282
##  2 - 6       1.295 0.356 54   3.637  0.0034
##  5 - 6       0.751 0.356 54   2.109  0.1631
## 
## curva = T1, gen = ICS95:
##  contrast estimate    SE df t.ratio p.value
##  0 - 2       0.391 0.356 54   1.098  0.6921
##  0 - 5       0.712 0.356 54   1.999  0.2011
##  0 - 6       1.269 0.356 54   3.564  0.0042
##  2 - 5       0.321 0.356 54   0.901  0.8045
##  2 - 6       0.878 0.356 54   2.466  0.0769
##  5 - 6       0.557 0.356 54   1.565  0.4067
## 
## curva = T2, gen = ICS95:
##  contrast estimate    SE df t.ratio p.value
##  0 - 2       0.617 0.356 54   1.734  0.3165
##  0 - 5       0.733 0.356 54   2.060  0.1795
##  0 - 6       1.380 0.356 54   3.877  0.0016
##  2 - 5       0.116 0.356 54   0.326  0.9879
##  2 - 6       0.763 0.356 54   2.143  0.1527
##  5 - 6       0.647 0.356 54   1.817  0.2765
## 
## curva = T3, gen = TCS01:
##  contrast estimate    SE df t.ratio p.value
##  0 - 2       1.375 0.356 54   3.862  0.0017
##  0 - 5       1.894 0.356 54   5.320  <.0001
##  0 - 6       2.627 0.356 54   7.378  <.0001
##  2 - 5       0.519 0.356 54   1.458  0.4697
##  2 - 6       1.252 0.356 54   3.516  0.0048
##  5 - 6       0.733 0.356 54   2.058  0.1801
## 
## curva = T1, gen = TCS01:
##  contrast estimate    SE df t.ratio p.value
##  0 - 2       0.959 0.356 54   2.693  0.0452
##  0 - 5       1.162 0.356 54   3.264  0.0100
##  0 - 6       1.296 0.356 54   3.639  0.0033
##  2 - 5       0.203 0.356 54   0.571  0.9403
##  2 - 6       0.337 0.356 54   0.947  0.7799
##  5 - 6       0.134 0.356 54   0.375  0.9818
## 
## curva = T2, gen = TCS01:
##  contrast estimate    SE df t.ratio p.value
##  0 - 2       0.236 0.356 54   0.664  0.9102
##  0 - 5       0.771 0.356 54   2.166  0.1460
##  0 - 6       2.296 0.356 54   6.448  <.0001
##  2 - 5       0.535 0.356 54   1.502  0.4435
##  2 - 6       2.059 0.356 54   5.784  <.0001
##  5 - 6       1.525 0.356 54   4.283  0.0004
## 
## P value adjustment: tukey method for comparing a family of 4 estimates
emm_gen_diam2_trend <- emmeans(res.aov.error, pairwise ~ diam2*gen | curva)
## Note: re-fitting model with sum-to-zero contrasts
emm_gen_diam2_trend
## $emmeans
## curva = T3:
##  diam2 gen   emmean    SE   df lower.CL upper.CL
##  0     CCN51   8.76 0.373 38.1     8.01     9.52
##  2     CCN51   8.23 0.373 38.1     7.47     8.98
##  5     CCN51   7.78 0.373 38.1     7.02     8.53
##  6     CCN51   7.39 0.373 38.1     6.63     8.15
##  0     ICS95  11.75 0.373 38.1    10.99    12.51
##  2     ICS95  11.48 0.373 38.1    10.72    12.23
##  5     ICS95  10.94 0.373 38.1    10.18    11.69
##  6     ICS95  10.18 0.373 38.1     9.43    10.94
##  0     TCS01   9.67 0.373 38.1     8.92    10.43
##  2     TCS01   8.30 0.373 38.1     7.54     9.05
##  5     TCS01   7.78 0.373 38.1     7.02     8.53
##  6     TCS01   7.05 0.373 38.1     6.29     7.80
## 
## curva = T1:
##  diam2 gen   emmean    SE   df lower.CL upper.CL
##  0     CCN51   9.53 0.373 38.1     8.78    10.29
##  2     CCN51   8.37 0.373 38.1     7.61     9.12
##  5     CCN51   7.88 0.373 38.1     7.13     8.64
##  6     CCN51   7.69 0.373 38.1     6.93     8.45
##  0     ICS95  10.02 0.373 38.1     9.26    10.77
##  2     ICS95   9.63 0.373 38.1     8.87    10.38
##  5     ICS95   9.31 0.373 38.1     8.55    10.06
##  6     ICS95   8.75 0.373 38.1     7.99     9.50
##  0     TCS01   7.71 0.373 38.1     6.95     8.46
##  2     TCS01   6.75 0.373 38.1     5.99     7.51
##  5     TCS01   6.55 0.373 38.1     5.79     7.30
##  6     TCS01   6.41 0.373 38.1     5.66     7.17
## 
## curva = T2:
##  diam2 gen   emmean    SE   df lower.CL upper.CL
##  0     CCN51   7.27 0.373 38.1     6.51     8.02
##  2     CCN51   6.98 0.373 38.1     6.22     7.73
##  5     CCN51   6.47 0.373 38.1     5.72     7.23
##  6     CCN51   5.70 0.373 38.1     4.95     6.46
##  0     ICS95  12.16 0.373 38.1    11.41    12.92
##  2     ICS95  11.55 0.373 38.1    10.79    12.30
##  5     ICS95  11.43 0.373 38.1    10.67    12.19
##  6     ICS95  10.78 0.373 38.1    10.03    11.54
##  0     TCS01   8.98 0.373 38.1     8.23     9.74
##  2     TCS01   8.75 0.373 38.1     7.99     9.50
##  5     TCS01   8.21 0.373 38.1     7.46     8.97
##  6     TCS01   6.69 0.373 38.1     5.93     7.44
## 
## Warning: EMMs are biased unless design is perfectly balanced 
## Confidence level used: 0.95 
## 
## $contrasts
## curva = T3:
##  contrast          estimate    SE   df t.ratio p.value
##  0 CCN51 - 2 CCN51   0.5347 0.356 54.0   1.502  0.9337
##  0 CCN51 - 5 CCN51   0.9857 0.356 54.0   2.769  0.2227
##  0 CCN51 - 6 CCN51   1.3720 0.356 54.0   3.854  0.0148
##  0 CCN51 - 0 ICS95  -2.9877 0.528 38.1  -5.661  0.0001
##  0 CCN51 - 2 ICS95  -2.7170 0.528 38.1  -5.148  0.0005
##  0 CCN51 - 5 ICS95  -2.1730 0.528 38.1  -4.118  0.0093
##  0 CCN51 - 6 ICS95  -1.4220 0.528 38.1  -2.695  0.2674
##  0 CCN51 - 0 TCS01  -0.9113 0.528 38.1  -1.727  0.8447
##  0 CCN51 - 2 TCS01   0.4637 0.528 38.1   0.879  0.9990
##  0 CCN51 - 5 TCS01   0.9827 0.528 38.1   1.862  0.7739
##  0 CCN51 - 6 TCS01   1.7153 0.528 38.1   3.250  0.0857
##  2 CCN51 - 5 CCN51   0.4510 0.356 54.0   1.267  0.9799
##  2 CCN51 - 6 CCN51   0.8373 0.356 54.0   2.352  0.4547
##  2 CCN51 - 0 ICS95  -3.5223 0.528 38.1  -6.675  <.0001
##  2 CCN51 - 2 ICS95  -3.2517 0.528 38.1  -6.162  <.0001
##  2 CCN51 - 5 ICS95  -2.7077 0.528 38.1  -5.131  0.0005
##  2 CCN51 - 6 ICS95  -1.9567 0.528 38.1  -3.708  0.0281
##  2 CCN51 - 0 TCS01  -1.4460 0.528 38.1  -2.740  0.2463
##  2 CCN51 - 2 TCS01  -0.0710 0.528 38.1  -0.135  1.0000
##  2 CCN51 - 5 TCS01   0.4480 0.528 38.1   0.849  0.9993
##  2 CCN51 - 6 TCS01   1.1807 0.528 38.1   2.237  0.5348
##  5 CCN51 - 6 CCN51   0.3863 0.356 54.0   1.085  0.9941
##  5 CCN51 - 0 ICS95  -3.9733 0.528 38.1  -7.529  <.0001
##  5 CCN51 - 2 ICS95  -3.7027 0.528 38.1  -7.016  <.0001
##  5 CCN51 - 5 ICS95  -3.1587 0.528 38.1  -5.985  <.0001
##  5 CCN51 - 6 ICS95  -2.4077 0.528 38.1  -4.562  0.0026
##  5 CCN51 - 0 TCS01  -1.8970 0.528 38.1  -3.595  0.0374
##  5 CCN51 - 2 TCS01  -0.5220 0.528 38.1  -0.989  0.9971
##  5 CCN51 - 5 TCS01  -0.0030 0.528 38.1  -0.006  1.0000
##  5 CCN51 - 6 TCS01   0.7297 0.528 38.1   1.383  0.9600
##  6 CCN51 - 0 ICS95  -4.3597 0.528 38.1  -8.261  <.0001
##  6 CCN51 - 2 ICS95  -4.0890 0.528 38.1  -7.748  <.0001
##  6 CCN51 - 5 ICS95  -3.5450 0.528 38.1  -6.717  <.0001
##  6 CCN51 - 6 ICS95  -2.7940 0.528 38.1  -5.294  0.0003
##  6 CCN51 - 0 TCS01  -2.2833 0.528 38.1  -4.327  0.0052
##  6 CCN51 - 2 TCS01  -0.9083 0.528 38.1  -1.721  0.8474
##  6 CCN51 - 5 TCS01  -0.3893 0.528 38.1  -0.738  0.9998
##  6 CCN51 - 6 TCS01   0.3433 0.528 38.1   0.651  0.9999
##  0 ICS95 - 2 ICS95   0.2707 0.356 54.0   0.760  0.9998
##  0 ICS95 - 5 ICS95   0.8147 0.356 54.0   2.288  0.4969
##  0 ICS95 - 6 ICS95   1.5657 0.356 54.0   4.398  0.0028
##  0 ICS95 - 0 TCS01   2.0763 0.528 38.1   3.934  0.0154
##  0 ICS95 - 2 TCS01   3.4513 0.528 38.1   6.540  <.0001
##  0 ICS95 - 5 TCS01   3.9703 0.528 38.1   7.523  <.0001
##  0 ICS95 - 6 TCS01   4.7030 0.528 38.1   8.912  <.0001
##  2 ICS95 - 5 ICS95   0.5440 0.356 54.0   1.528  0.9259
##  2 ICS95 - 6 ICS95   1.2950 0.356 54.0   3.637  0.0274
##  2 ICS95 - 0 TCS01   1.8057 0.528 38.1   3.422  0.0573
##  2 ICS95 - 2 TCS01   3.1807 0.528 38.1   6.027  <.0001
##  2 ICS95 - 5 TCS01   3.6997 0.528 38.1   7.011  <.0001
##  2 ICS95 - 6 TCS01   4.4323 0.528 38.1   8.399  <.0001
##  5 ICS95 - 6 ICS95   0.7510 0.356 54.0   2.109  0.6185
##  5 ICS95 - 0 TCS01   1.2617 0.528 38.1   2.391  0.4359
##  5 ICS95 - 2 TCS01   2.6367 0.528 38.1   4.996  0.0007
##  5 ICS95 - 5 TCS01   3.1557 0.528 38.1   5.980  <.0001
##  5 ICS95 - 6 TCS01   3.8883 0.528 38.1   7.368  <.0001
##  6 ICS95 - 0 TCS01   0.5107 0.528 38.1   0.968  0.9976
##  6 ICS95 - 2 TCS01   1.8857 0.528 38.1   3.573  0.0395
##  6 ICS95 - 5 TCS01   2.4047 0.528 38.1   4.557  0.0027
##  6 ICS95 - 6 TCS01   3.1373 0.528 38.1   5.945  <.0001
##  0 TCS01 - 2 TCS01   1.3750 0.356 54.0   3.862  0.0144
##  0 TCS01 - 5 TCS01   1.8940 0.356 54.0   5.320  0.0001
##  0 TCS01 - 6 TCS01   2.6267 0.356 54.0   7.378  <.0001
##  2 TCS01 - 5 TCS01   0.5190 0.356 54.0   1.458  0.9454
##  2 TCS01 - 6 TCS01   1.2517 0.356 54.0   3.516  0.0383
##  5 TCS01 - 6 TCS01   0.7327 0.356 54.0   2.058  0.6531
## 
## curva = T1:
##  contrast          estimate    SE   df t.ratio p.value
##  0 CCN51 - 2 CCN51   1.1663 0.356 54.0   3.276  0.0713
##  0 CCN51 - 5 CCN51   1.6490 0.356 54.0   4.632  0.0013
##  0 CCN51 - 6 CCN51   1.8430 0.356 54.0   5.177  0.0002
##  0 CCN51 - 0 ICS95  -0.4837 0.528 38.1  -0.917  0.9985
##  0 CCN51 - 2 ICS95  -0.0927 0.528 38.1  -0.176  1.0000
##  0 CCN51 - 5 ICS95   0.2280 0.528 38.1   0.432  1.0000
##  0 CCN51 - 6 ICS95   0.7853 0.528 38.1   1.488  0.9349
##  0 CCN51 - 0 TCS01   1.8247 0.528 38.1   3.458  0.0525
##  0 CCN51 - 2 TCS01   2.7833 0.528 38.1   5.274  0.0003
##  0 CCN51 - 5 TCS01   2.9867 0.528 38.1   5.659  0.0001
##  0 CCN51 - 6 TCS01   3.1203 0.528 38.1   5.913  <.0001
##  2 CCN51 - 5 CCN51   0.4827 0.356 54.0   1.356  0.9669
##  2 CCN51 - 6 CCN51   0.6767 0.356 54.0   1.901  0.7535
##  2 CCN51 - 0 ICS95  -1.6500 0.528 38.1  -3.127  0.1130
##  2 CCN51 - 2 ICS95  -1.2590 0.528 38.1  -2.386  0.4391
##  2 CCN51 - 5 ICS95  -0.9383 0.528 38.1  -1.778  0.8194
##  2 CCN51 - 6 ICS95  -0.3810 0.528 38.1  -0.722  0.9998
##  2 CCN51 - 0 TCS01   0.6583 0.528 38.1   1.247  0.9809
##  2 CCN51 - 2 TCS01   1.6170 0.528 38.1   3.064  0.1294
##  2 CCN51 - 5 TCS01   1.8203 0.528 38.1   3.449  0.0536
##  2 CCN51 - 6 TCS01   1.9540 0.528 38.1   3.703  0.0284
##  5 CCN51 - 6 CCN51   0.1940 0.356 54.0   0.545  1.0000
##  5 CCN51 - 0 ICS95  -2.1327 0.528 38.1  -4.041  0.0115
##  5 CCN51 - 2 ICS95  -1.7417 0.528 38.1  -3.300  0.0764
##  5 CCN51 - 5 ICS95  -1.4210 0.528 38.1  -2.693  0.2683
##  5 CCN51 - 6 ICS95  -0.8637 0.528 38.1  -1.637  0.8844
##  5 CCN51 - 0 TCS01   0.1757 0.528 38.1   0.333  1.0000
##  5 CCN51 - 2 TCS01   1.1343 0.528 38.1   2.149  0.5930
##  5 CCN51 - 5 TCS01   1.3377 0.528 38.1   2.535  0.3504
##  5 CCN51 - 6 TCS01   1.4713 0.528 38.1   2.788  0.2253
##  6 CCN51 - 0 ICS95  -2.3267 0.528 38.1  -4.409  0.0041
##  6 CCN51 - 2 ICS95  -1.9357 0.528 38.1  -3.668  0.0311
##  6 CCN51 - 5 ICS95  -1.6150 0.528 38.1  -3.060  0.1304
##  6 CCN51 - 6 ICS95  -1.0577 0.528 38.1  -2.004  0.6879
##  6 CCN51 - 0 TCS01  -0.0183 0.528 38.1  -0.035  1.0000
##  6 CCN51 - 2 TCS01   0.9403 0.528 38.1   1.782  0.8175
##  6 CCN51 - 5 TCS01   1.1437 0.528 38.1   2.167  0.5813
##  6 CCN51 - 6 TCS01   1.2773 0.528 38.1   2.420  0.4176
##  0 ICS95 - 2 ICS95   0.3910 0.356 54.0   1.098  0.9935
##  0 ICS95 - 5 ICS95   0.7117 0.356 54.0   1.999  0.6920
##  0 ICS95 - 6 ICS95   1.2690 0.356 54.0   3.564  0.0335
##  0 ICS95 - 0 TCS01   2.3083 0.528 38.1   4.374  0.0045
##  0 ICS95 - 2 TCS01   3.2670 0.528 38.1   6.191  <.0001
##  0 ICS95 - 5 TCS01   3.4703 0.528 38.1   6.576  <.0001
##  0 ICS95 - 6 TCS01   3.6040 0.528 38.1   6.829  <.0001
##  2 ICS95 - 5 ICS95   0.3207 0.356 54.0   0.901  0.9989
##  2 ICS95 - 6 ICS95   0.8780 0.356 54.0   2.466  0.3823
##  2 ICS95 - 0 TCS01   1.9173 0.528 38.1   3.633  0.0340
##  2 ICS95 - 2 TCS01   2.8760 0.528 38.1   5.450  0.0002
##  2 ICS95 - 5 TCS01   3.0793 0.528 38.1   5.835  0.0001
##  2 ICS95 - 6 TCS01   3.2130 0.528 38.1   6.088  <.0001
##  5 ICS95 - 6 ICS95   0.5573 0.356 54.0   1.565  0.9138
##  5 ICS95 - 0 TCS01   1.5967 0.528 38.1   3.026  0.1404
##  5 ICS95 - 2 TCS01   2.5553 0.528 38.1   4.842  0.0012
##  5 ICS95 - 5 TCS01   2.7587 0.528 38.1   5.227  0.0004
##  5 ICS95 - 6 TCS01   2.8923 0.528 38.1   5.481  0.0002
##  6 ICS95 - 0 TCS01   1.0393 0.528 38.1   1.969  0.7097
##  6 ICS95 - 2 TCS01   1.9980 0.528 38.1   3.786  0.0229
##  6 ICS95 - 5 TCS01   2.2013 0.528 38.1   4.171  0.0081
##  6 ICS95 - 6 TCS01   2.3350 0.528 38.1   4.425  0.0039
##  0 TCS01 - 2 TCS01   0.9587 0.356 54.0   2.693  0.2577
##  0 TCS01 - 5 TCS01   1.1620 0.356 54.0   3.264  0.0735
##  0 TCS01 - 6 TCS01   1.2957 0.356 54.0   3.639  0.0273
##  2 TCS01 - 5 TCS01   0.2033 0.356 54.0   0.571  1.0000
##  2 TCS01 - 6 TCS01   0.3370 0.356 54.0   0.947  0.9982
##  5 TCS01 - 6 TCS01   0.1337 0.356 54.0   0.375  1.0000
## 
## curva = T2:
##  contrast          estimate    SE   df t.ratio p.value
##  0 CCN51 - 2 CCN51   0.2883 0.356 54.0   0.810  0.9996
##  0 CCN51 - 5 CCN51   0.7927 0.356 54.0   2.226  0.5387
##  0 CCN51 - 6 CCN51   1.5650 0.356 54.0   4.396  0.0028
##  0 CCN51 - 0 ICS95  -4.8960 0.528 38.1  -9.277  <.0001
##  0 CCN51 - 2 ICS95  -4.2787 0.528 38.1  -8.108  <.0001
##  0 CCN51 - 5 ICS95  -4.1627 0.528 38.1  -7.888  <.0001
##  0 CCN51 - 6 ICS95  -3.5157 0.528 38.1  -6.662  <.0001
##  0 CCN51 - 0 TCS01  -1.7163 0.528 38.1  -3.252  0.0853
##  0 CCN51 - 2 TCS01  -1.4800 0.528 38.1  -2.804  0.2185
##  0 CCN51 - 5 TCS01  -0.9453 0.528 38.1  -1.791  0.8125
##  0 CCN51 - 6 TCS01   0.5793 0.528 38.1   1.098  0.9930
##  2 CCN51 - 5 CCN51   0.5043 0.356 54.0   1.417  0.9550
##  2 CCN51 - 6 CCN51   1.2767 0.356 54.0   3.586  0.0316
##  2 CCN51 - 0 ICS95  -5.1843 0.528 38.1  -9.824  <.0001
##  2 CCN51 - 2 ICS95  -4.5670 0.528 38.1  -8.654  <.0001
##  2 CCN51 - 5 ICS95  -4.4510 0.528 38.1  -8.434  <.0001
##  2 CCN51 - 6 ICS95  -3.8040 0.528 38.1  -7.208  <.0001
##  2 CCN51 - 0 TCS01  -2.0047 0.528 38.1  -3.799  0.0221
##  2 CCN51 - 2 TCS01  -1.7683 0.528 38.1  -3.351  0.0678
##  2 CCN51 - 5 TCS01  -1.2337 0.528 38.1  -2.338  0.4694
##  2 CCN51 - 6 TCS01   0.2910 0.528 38.1   0.551  1.0000
##  5 CCN51 - 6 CCN51   0.7723 0.356 54.0   2.169  0.5777
##  5 CCN51 - 0 ICS95  -5.6887 0.528 38.1 -10.780  <.0001
##  5 CCN51 - 2 ICS95  -5.0713 0.528 38.1  -9.610  <.0001
##  5 CCN51 - 5 ICS95  -4.9553 0.528 38.1  -9.390  <.0001
##  5 CCN51 - 6 ICS95  -4.3083 0.528 38.1  -8.164  <.0001
##  5 CCN51 - 0 TCS01  -2.5090 0.528 38.1  -4.754  0.0015
##  5 CCN51 - 2 TCS01  -2.2727 0.528 38.1  -4.307  0.0055
##  5 CCN51 - 5 TCS01  -1.7380 0.528 38.1  -3.293  0.0776
##  5 CCN51 - 6 TCS01  -0.2133 0.528 38.1  -0.404  1.0000
##  6 CCN51 - 0 ICS95  -6.4610 0.528 38.1 -12.243  <.0001
##  6 CCN51 - 2 ICS95  -5.8437 0.528 38.1 -11.073  <.0001
##  6 CCN51 - 5 ICS95  -5.7277 0.528 38.1 -10.853  <.0001
##  6 CCN51 - 6 ICS95  -5.0807 0.528 38.1  -9.627  <.0001
##  6 CCN51 - 0 TCS01  -3.2813 0.528 38.1  -6.218  <.0001
##  6 CCN51 - 2 TCS01  -3.0450 0.528 38.1  -5.770  0.0001
##  6 CCN51 - 5 TCS01  -2.5103 0.528 38.1  -4.757  0.0015
##  6 CCN51 - 6 TCS01  -0.9857 0.528 38.1  -1.868  0.7707
##  0 ICS95 - 2 ICS95   0.6173 0.356 54.0   1.734  0.8444
##  0 ICS95 - 5 ICS95   0.7333 0.356 54.0   2.060  0.6519
##  0 ICS95 - 6 ICS95   1.3803 0.356 54.0   3.877  0.0138
##  0 ICS95 - 0 TCS01   3.1797 0.528 38.1   6.025  <.0001
##  0 ICS95 - 2 TCS01   3.4160 0.528 38.1   6.473  <.0001
##  0 ICS95 - 5 TCS01   3.9507 0.528 38.1   7.486  <.0001
##  0 ICS95 - 6 TCS01   5.4753 0.528 38.1  10.375  <.0001
##  2 ICS95 - 5 ICS95   0.1160 0.356 54.0   0.326  1.0000
##  2 ICS95 - 6 ICS95   0.7630 0.356 54.0   2.143  0.5956
##  2 ICS95 - 0 TCS01   2.5623 0.528 38.1   4.855  0.0011
##  2 ICS95 - 2 TCS01   2.7987 0.528 38.1   5.303  0.0003
##  2 ICS95 - 5 TCS01   3.3333 0.528 38.1   6.316  <.0001
##  2 ICS95 - 6 TCS01   4.8580 0.528 38.1   9.205  <.0001
##  5 ICS95 - 6 ICS95   0.6470 0.356 54.0   1.817  0.8014
##  5 ICS95 - 0 TCS01   2.4463 0.528 38.1   4.636  0.0021
##  5 ICS95 - 2 TCS01   2.6827 0.528 38.1   5.083  0.0006
##  5 ICS95 - 5 TCS01   3.2173 0.528 38.1   6.097  <.0001
##  5 ICS95 - 6 TCS01   4.7420 0.528 38.1   8.986  <.0001
##  6 ICS95 - 0 TCS01   1.7993 0.528 38.1   3.410  0.0590
##  6 ICS95 - 2 TCS01   2.0357 0.528 38.1   3.857  0.0190
##  6 ICS95 - 5 TCS01   2.5703 0.528 38.1   4.871  0.0011
##  6 ICS95 - 6 TCS01   4.0950 0.528 38.1   7.760  <.0001
##  0 TCS01 - 2 TCS01   0.2363 0.356 54.0   0.664  0.9999
##  0 TCS01 - 5 TCS01   0.7710 0.356 54.0   2.166  0.5802
##  0 TCS01 - 6 TCS01   2.2957 0.356 54.0   6.448  <.0001
##  2 TCS01 - 5 TCS01   0.5347 0.356 54.0   1.502  0.9337
##  2 TCS01 - 6 TCS01   2.0593 0.356 54.0   5.784  <.0001
##  5 TCS01 - 6 TCS01   1.5247 0.356 54.0   4.283  0.0040
## 
## P value adjustment: tukey method for comparing a family of 12 estimates
emm_diam2 <- emmeans(res.aov.error, pairwise ~ diam2)
## Note: re-fitting model with sum-to-zero contrasts
## NOTE: Results may be misleading due to involvement in interactions
emm_diam2
## $emmeans
##  diam2 emmean    SE   df lower.CL upper.CL
##  0       9.54 0.124 38.1     9.29     9.79
##  2       8.89 0.124 38.1     8.64     9.14
##  5       8.48 0.124 38.1     8.23     8.73
##  6       7.85 0.124 38.1     7.60     8.10
## 
## Results are averaged over the levels of: curva, gen 
## Warning: EMMs are biased unless design is perfectly balanced 
## Confidence level used: 0.95 
## 
## $contrasts
##  contrast estimate    SE df t.ratio p.value
##  0 - 2       0.649 0.119 54   5.466  <.0001
##  0 - 5       1.057 0.119 54   8.908  <.0001
##  0 - 6       1.690 0.119 54  14.244  <.0001
##  2 - 5       0.408 0.119 54   3.441  0.0060
##  2 - 6       1.042 0.119 54   8.777  <.0001
##  5 - 6       0.633 0.119 54   5.336  <.0001
## 
## Results are averaged over the levels of: curva, gen 
## P value adjustment: tukey method for comparing a family of 4 estimates
emm_diam2_curva <- emmeans(res.aov.error, pairwise ~ diam2 | curva)
## Note: re-fitting model with sum-to-zero contrasts
## NOTE: Results may be misleading due to involvement in interactions
emm_diam2_curva
## $emmeans
## curva = T3:
##  diam2 emmean    SE   df lower.CL upper.CL
##  0      10.06 0.215 38.1     9.63    10.50
##  2       9.33 0.215 38.1     8.90     9.77
##  5       8.83 0.215 38.1     8.39     9.27
##  6       8.21 0.215 38.1     7.77     8.64
## 
## curva = T1:
##  diam2 emmean    SE   df lower.CL upper.CL
##  0       9.09 0.215 38.1     8.65     9.52
##  2       8.25 0.215 38.1     7.81     8.68
##  5       7.91 0.215 38.1     7.48     8.35
##  6       7.62 0.215 38.1     7.18     8.05
## 
## curva = T2:
##  diam2 emmean    SE   df lower.CL upper.CL
##  0       9.47 0.215 38.1     9.03     9.91
##  2       9.09 0.215 38.1     8.65     9.53
##  5       8.71 0.215 38.1     8.27     9.14
##  6       7.72 0.215 38.1     7.29     8.16
## 
## Results are averaged over the levels of: gen 
## Warning: EMMs are biased unless design is perfectly balanced 
## Confidence level used: 0.95 
## 
## $contrasts
## curva = T3:
##  contrast estimate    SE df t.ratio p.value
##  0 - 2       0.727 0.206 54   3.536  0.0046
##  0 - 5       1.231 0.206 54   5.991  <.0001
##  0 - 6       1.855 0.206 54   9.024  <.0001
##  2 - 5       0.505 0.206 54   2.455  0.0789
##  2 - 6       1.128 0.206 54   5.488  <.0001
##  5 - 6       0.623 0.206 54   3.033  0.0189
## 
## curva = T1:
##  contrast estimate    SE df t.ratio p.value
##  0 - 2       0.839 0.206 54   4.080  0.0008
##  0 - 5       1.174 0.206 54   5.713  <.0001
##  0 - 6       1.469 0.206 54   7.148  <.0001
##  2 - 5       0.336 0.206 54   1.633  0.3694
##  2 - 6       0.631 0.206 54   3.068  0.0172
##  5 - 6       0.295 0.206 54   1.435  0.4834
## 
## curva = T2:
##  contrast estimate    SE df t.ratio p.value
##  0 - 2       0.381 0.206 54   1.852  0.2609
##  0 - 5       0.766 0.206 54   3.725  0.0026
##  0 - 6       1.747 0.206 54   8.499  <.0001
##  2 - 5       0.385 0.206 54   1.873  0.2517
##  2 - 6       1.366 0.206 54   6.647  <.0001
##  5 - 6       0.981 0.206 54   4.774  0.0001
## 
## Results are averaged over the levels of: gen 
## P value adjustment: tukey method for comparing a family of 4 estimates
##Splitting dataframe by temperature ramp
## Protocol 3 (T3)

datos.curve1<-filter(datos, curva=="T3")

##Check assumptions
##Outliers

datos.curve1 %>%
  group_by(gen, diam2) %>%
  identify_outliers(cd.grano.c)
##  [1] gen        diam2      curva      muestra    id         dia       
##  [7] cd.grano   curva.1    protocolo  gen.1      muestra.1  dia.1     
## [13] diam       Testa      Grano      cd.grano.1 cd.grano.c cd.grano.a
## [19] cd.grano.d is.outlier is.extreme
## <0 rows> (or 0-length row.names)
##Normality assumption
##Compute Shapiro-Wilk test for each combinations of factor levels:

norm1<-datos.curve1 %>%
  group_by(gen, diam2) %>%
  shapiro_test(cd.grano.c)
norm1 %>% as_tibble() %>% print(n=Inf)
## # A tibble: 12 × 5
##    gen   diam2 variable   statistic      p
##    <fct> <fct> <chr>          <dbl>  <dbl>
##  1 CCN51 0     cd.grano.c     0.934 0.504 
##  2 CCN51 2     cd.grano.c     0.913 0.428 
##  3 CCN51 5     cd.grano.c     0.781 0.0705
##  4 CCN51 6     cd.grano.c     0.904 0.400 
##  5 ICS95 0     cd.grano.c     0.994 0.847 
##  6 ICS95 2     cd.grano.c     0.971 0.672 
##  7 ICS95 5     cd.grano.c     0.774 0.0533
##  8 ICS95 6     cd.grano.c     0.919 0.449 
##  9 TCS01 0     cd.grano.c     0.991 0.820 
## 10 TCS01 2     cd.grano.c     0.756 0.0134
## 11 TCS01 5     cd.grano.c     0.824 0.173 
## 12 TCS01 6     cd.grano.c     0.994 0.857
##Create QQ plot for each cell of design:

ggqqplot(datos.curve1, "cd.grano.c", ggtheme = theme_bw()) +
  facet_grid(diam2~ curva*gen, labeller = "label_both")
## Warning: The following aesthetics were dropped during statistical transformation: sample
## ℹ This can happen when ggplot fails to infer the correct grouping structure in
##   the data.
## ℹ Did you forget to specify a `group` aesthetic or to convert a numerical
##   variable into a factor?
## The following aesthetics were dropped during statistical transformation: sample
## ℹ This can happen when ggplot fails to infer the correct grouping structure in
##   the data.
## ℹ Did you forget to specify a `group` aesthetic or to convert a numerical
##   variable into a factor?
## The following aesthetics were dropped during statistical transformation: sample
## ℹ This can happen when ggplot fails to infer the correct grouping structure in
##   the data.
## ℹ Did you forget to specify a `group` aesthetic or to convert a numerical
##   variable into a factor?
## The following aesthetics were dropped during statistical transformation: sample
## ℹ This can happen when ggplot fails to infer the correct grouping structure in
##   the data.
## ℹ Did you forget to specify a `group` aesthetic or to convert a numerical
##   variable into a factor?
## The following aesthetics were dropped during statistical transformation: sample
## ℹ This can happen when ggplot fails to infer the correct grouping structure in
##   the data.
## ℹ Did you forget to specify a `group` aesthetic or to convert a numerical
##   variable into a factor?
## The following aesthetics were dropped during statistical transformation: sample
## ℹ This can happen when ggplot fails to infer the correct grouping structure in
##   the data.
## ℹ Did you forget to specify a `group` aesthetic or to convert a numerical
##   variable into a factor?
## The following aesthetics were dropped during statistical transformation: sample
## ℹ This can happen when ggplot fails to infer the correct grouping structure in
##   the data.
## ℹ Did you forget to specify a `group` aesthetic or to convert a numerical
##   variable into a factor?
## The following aesthetics were dropped during statistical transformation: sample
## ℹ This can happen when ggplot fails to infer the correct grouping structure in
##   the data.
## ℹ Did you forget to specify a `group` aesthetic or to convert a numerical
##   variable into a factor?
## The following aesthetics were dropped during statistical transformation: sample
## ℹ This can happen when ggplot fails to infer the correct grouping structure in
##   the data.
## ℹ Did you forget to specify a `group` aesthetic or to convert a numerical
##   variable into a factor?
## The following aesthetics were dropped during statistical transformation: sample
## ℹ This can happen when ggplot fails to infer the correct grouping structure in
##   the data.
## ℹ Did you forget to specify a `group` aesthetic or to convert a numerical
##   variable into a factor?
## The following aesthetics were dropped during statistical transformation: sample
## ℹ This can happen when ggplot fails to infer the correct grouping structure in
##   the data.
## ℹ Did you forget to specify a `group` aesthetic or to convert a numerical
##   variable into a factor?
## The following aesthetics were dropped during statistical transformation: sample
## ℹ This can happen when ggplot fails to infer the correct grouping structure in
##   the data.
## ℹ Did you forget to specify a `group` aesthetic or to convert a numerical
##   variable into a factor?
## The following aesthetics were dropped during statistical transformation: sample
## ℹ This can happen when ggplot fails to infer the correct grouping structure in
##   the data.
## ℹ Did you forget to specify a `group` aesthetic or to convert a numerical
##   variable into a factor?
## The following aesthetics were dropped during statistical transformation: sample
## ℹ This can happen when ggplot fails to infer the correct grouping structure in
##   the data.
## ℹ Did you forget to specify a `group` aesthetic or to convert a numerical
##   variable into a factor?
## The following aesthetics were dropped during statistical transformation: sample
## ℹ This can happen when ggplot fails to infer the correct grouping structure in
##   the data.
## ℹ Did you forget to specify a `group` aesthetic or to convert a numerical
##   variable into a factor?
## The following aesthetics were dropped during statistical transformation: sample
## ℹ This can happen when ggplot fails to infer the correct grouping structure in
##   the data.
## ℹ Did you forget to specify a `group` aesthetic or to convert a numerical
##   variable into a factor?
## The following aesthetics were dropped during statistical transformation: sample
## ℹ This can happen when ggplot fails to infer the correct grouping structure in
##   the data.
## ℹ Did you forget to specify a `group` aesthetic or to convert a numerical
##   variable into a factor?
## The following aesthetics were dropped during statistical transformation: sample
## ℹ This can happen when ggplot fails to infer the correct grouping structure in
##   the data.
## ℹ Did you forget to specify a `group` aesthetic or to convert a numerical
##   variable into a factor?
## The following aesthetics were dropped during statistical transformation: sample
## ℹ This can happen when ggplot fails to infer the correct grouping structure in
##   the data.
## ℹ Did you forget to specify a `group` aesthetic or to convert a numerical
##   variable into a factor?
## The following aesthetics were dropped during statistical transformation: sample
## ℹ This can happen when ggplot fails to infer the correct grouping structure in
##   the data.
## ℹ Did you forget to specify a `group` aesthetic or to convert a numerical
##   variable into a factor?
## The following aesthetics were dropped during statistical transformation: sample
## ℹ This can happen when ggplot fails to infer the correct grouping structure in
##   the data.
## ℹ Did you forget to specify a `group` aesthetic or to convert a numerical
##   variable into a factor?
## The following aesthetics were dropped during statistical transformation: sample
## ℹ This can happen when ggplot fails to infer the correct grouping structure in
##   the data.
## ℹ Did you forget to specify a `group` aesthetic or to convert a numerical
##   variable into a factor?
## The following aesthetics were dropped during statistical transformation: sample
## ℹ This can happen when ggplot fails to infer the correct grouping structure in
##   the data.
## ℹ Did you forget to specify a `group` aesthetic or to convert a numerical
##   variable into a factor?
## The following aesthetics were dropped during statistical transformation: sample
## ℹ This can happen when ggplot fails to infer the correct grouping structure in
##   the data.
## ℹ Did you forget to specify a `group` aesthetic or to convert a numerical
##   variable into a factor?

##Homogneity of variance assumption

##Compute the Levene’s test at each level of the within-subjects factor, here time variable:

lev1<-datos.curve1 %>%
  group_by(diam2) %>%
  levene_test(cd.grano.c ~ gen)
lev1 %>% as_tibble() %>% print(n=Inf)
## # A tibble: 4 × 5
##   diam2   df1   df2 statistic     p
##   <fct> <int> <int>     <dbl> <dbl>
## 1 0         2     6     0.897 0.456
## 2 2         2     6     0.499 0.630
## 3 5         2     6     0.376 0.701
## 4 6         2     6     0.826 0.482
##Computation

res.aov1 <- anova_test(
  data = datos.curve1, dv = cd.grano.c, wid = id,
  within = diam2, between = gen
)
get_anova_table(res.aov1)
## ANOVA Table (type II tests)
## 
##      Effect DFn DFd      F        p p<.05   ges
## 1       gen   2   6 27.867 9.18e-04     * 0.844
## 2     diam2   3  18 18.299 1.06e-05     * 0.560
## 3 gen:diam2   6  18  1.017 4.45e-01       0.124
#CCN51
datos.ccn<-filter(datos.curve1, gen=="CCN51")
res.aov.ccn1 <- anova_test(
  data = datos.ccn, dv = cd.grano.c, wid = id,
  within = diam2
)
get_anova_table(res.aov.ccn1)
## ANOVA Table (type III tests)
## 
##   Effect DFn DFd     F    p p<.05   ges
## 1  diam2   3   6 6.034 0.03     * 0.645
#ICS95
datos.ics<-filter(datos.curve1, gen=="ICS95")
res.aov.ics1 <- anova_test(
  data = datos.ics, dv = cd.grano.c, wid = id,
  within = diam2
)
get_anova_table(res.aov.ics1)
## ANOVA Table (type III tests)
## 
##   Effect DFn DFd     F     p p<.05  ges
## 1  diam2   3   6 6.312 0.028     * 0.59
#TCS01
datos.tcs<-filter(datos.curve1, gen=="TCS01")
res.aov.tcs1 <- anova_test(
  data = datos.tcs, dv = cd.grano.c, wid = id,
  within = diam2
)
get_anova_table(res.aov.tcs1)
## ANOVA Table (type III tests)
## 
##   Effect DFn DFd     F    p p<.05  ges
## 1  diam2   3   6 7.238 0.02     * 0.57
## Protocol 1 (T1)

datos.curve2<-filter(datos, curva=="T1")

##Check assumptions
##Outliers

datos.curve2 %>%
  group_by(gen, diam2) %>%
  identify_outliers(cd.grano.c)
##  [1] gen        diam2      curva      muestra    id         dia       
##  [7] cd.grano   curva.1    protocolo  gen.1      muestra.1  dia.1     
## [13] diam       Testa      Grano      cd.grano.1 cd.grano.c cd.grano.a
## [19] cd.grano.d is.outlier is.extreme
## <0 rows> (or 0-length row.names)
##Normality assumption
##Compute Shapiro-Wilk test for each combinations of factor levels:

norm2<-datos.curve2 %>%
  group_by(gen, diam2) %>%
  shapiro_test(cd.grano.c)
norm2 %>% as_tibble() %>% print(n=Inf)
## # A tibble: 12 × 5
##    gen   diam2 variable   statistic       p
##    <fct> <fct> <chr>          <dbl>   <dbl>
##  1 CCN51 0     cd.grano.c     0.999 0.940  
##  2 CCN51 2     cd.grano.c     0.857 0.258  
##  3 CCN51 5     cd.grano.c     0.893 0.363  
##  4 CCN51 6     cd.grano.c     0.993 0.836  
##  5 ICS95 0     cd.grano.c     0.978 0.718  
##  6 ICS95 2     cd.grano.c     0.828 0.182  
##  7 ICS95 5     cd.grano.c     0.844 0.226  
##  8 ICS95 6     cd.grano.c     0.785 0.0783 
##  9 TCS01 0     cd.grano.c     0.785 0.0788 
## 10 TCS01 2     cd.grano.c     0.754 0.00911
## 11 TCS01 5     cd.grano.c     0.968 0.658  
## 12 TCS01 6     cd.grano.c     1.00  0.979
##Create QQ plot for each cell of design:

ggqqplot(datos.curve2, "cd.grano.c", ggtheme = theme_bw()) +
  facet_grid(diam2~ curva*gen, labeller = "label_both")
## Warning: The following aesthetics were dropped during statistical transformation: sample
## ℹ This can happen when ggplot fails to infer the correct grouping structure in
##   the data.
## ℹ Did you forget to specify a `group` aesthetic or to convert a numerical
##   variable into a factor?
## The following aesthetics were dropped during statistical transformation: sample
## ℹ This can happen when ggplot fails to infer the correct grouping structure in
##   the data.
## ℹ Did you forget to specify a `group` aesthetic or to convert a numerical
##   variable into a factor?
## The following aesthetics were dropped during statistical transformation: sample
## ℹ This can happen when ggplot fails to infer the correct grouping structure in
##   the data.
## ℹ Did you forget to specify a `group` aesthetic or to convert a numerical
##   variable into a factor?
## The following aesthetics were dropped during statistical transformation: sample
## ℹ This can happen when ggplot fails to infer the correct grouping structure in
##   the data.
## ℹ Did you forget to specify a `group` aesthetic or to convert a numerical
##   variable into a factor?
## The following aesthetics were dropped during statistical transformation: sample
## ℹ This can happen when ggplot fails to infer the correct grouping structure in
##   the data.
## ℹ Did you forget to specify a `group` aesthetic or to convert a numerical
##   variable into a factor?
## The following aesthetics were dropped during statistical transformation: sample
## ℹ This can happen when ggplot fails to infer the correct grouping structure in
##   the data.
## ℹ Did you forget to specify a `group` aesthetic or to convert a numerical
##   variable into a factor?
## The following aesthetics were dropped during statistical transformation: sample
## ℹ This can happen when ggplot fails to infer the correct grouping structure in
##   the data.
## ℹ Did you forget to specify a `group` aesthetic or to convert a numerical
##   variable into a factor?
## The following aesthetics were dropped during statistical transformation: sample
## ℹ This can happen when ggplot fails to infer the correct grouping structure in
##   the data.
## ℹ Did you forget to specify a `group` aesthetic or to convert a numerical
##   variable into a factor?
## The following aesthetics were dropped during statistical transformation: sample
## ℹ This can happen when ggplot fails to infer the correct grouping structure in
##   the data.
## ℹ Did you forget to specify a `group` aesthetic or to convert a numerical
##   variable into a factor?
## The following aesthetics were dropped during statistical transformation: sample
## ℹ This can happen when ggplot fails to infer the correct grouping structure in
##   the data.
## ℹ Did you forget to specify a `group` aesthetic or to convert a numerical
##   variable into a factor?
## The following aesthetics were dropped during statistical transformation: sample
## ℹ This can happen when ggplot fails to infer the correct grouping structure in
##   the data.
## ℹ Did you forget to specify a `group` aesthetic or to convert a numerical
##   variable into a factor?
## The following aesthetics were dropped during statistical transformation: sample
## ℹ This can happen when ggplot fails to infer the correct grouping structure in
##   the data.
## ℹ Did you forget to specify a `group` aesthetic or to convert a numerical
##   variable into a factor?
## The following aesthetics were dropped during statistical transformation: sample
## ℹ This can happen when ggplot fails to infer the correct grouping structure in
##   the data.
## ℹ Did you forget to specify a `group` aesthetic or to convert a numerical
##   variable into a factor?
## The following aesthetics were dropped during statistical transformation: sample
## ℹ This can happen when ggplot fails to infer the correct grouping structure in
##   the data.
## ℹ Did you forget to specify a `group` aesthetic or to convert a numerical
##   variable into a factor?
## The following aesthetics were dropped during statistical transformation: sample
## ℹ This can happen when ggplot fails to infer the correct grouping structure in
##   the data.
## ℹ Did you forget to specify a `group` aesthetic or to convert a numerical
##   variable into a factor?
## The following aesthetics were dropped during statistical transformation: sample
## ℹ This can happen when ggplot fails to infer the correct grouping structure in
##   the data.
## ℹ Did you forget to specify a `group` aesthetic or to convert a numerical
##   variable into a factor?
## The following aesthetics were dropped during statistical transformation: sample
## ℹ This can happen when ggplot fails to infer the correct grouping structure in
##   the data.
## ℹ Did you forget to specify a `group` aesthetic or to convert a numerical
##   variable into a factor?
## The following aesthetics were dropped during statistical transformation: sample
## ℹ This can happen when ggplot fails to infer the correct grouping structure in
##   the data.
## ℹ Did you forget to specify a `group` aesthetic or to convert a numerical
##   variable into a factor?
## The following aesthetics were dropped during statistical transformation: sample
## ℹ This can happen when ggplot fails to infer the correct grouping structure in
##   the data.
## ℹ Did you forget to specify a `group` aesthetic or to convert a numerical
##   variable into a factor?
## The following aesthetics were dropped during statistical transformation: sample
## ℹ This can happen when ggplot fails to infer the correct grouping structure in
##   the data.
## ℹ Did you forget to specify a `group` aesthetic or to convert a numerical
##   variable into a factor?
## The following aesthetics were dropped during statistical transformation: sample
## ℹ This can happen when ggplot fails to infer the correct grouping structure in
##   the data.
## ℹ Did you forget to specify a `group` aesthetic or to convert a numerical
##   variable into a factor?
## The following aesthetics were dropped during statistical transformation: sample
## ℹ This can happen when ggplot fails to infer the correct grouping structure in
##   the data.
## ℹ Did you forget to specify a `group` aesthetic or to convert a numerical
##   variable into a factor?
## The following aesthetics were dropped during statistical transformation: sample
## ℹ This can happen when ggplot fails to infer the correct grouping structure in
##   the data.
## ℹ Did you forget to specify a `group` aesthetic or to convert a numerical
##   variable into a factor?
## The following aesthetics were dropped during statistical transformation: sample
## ℹ This can happen when ggplot fails to infer the correct grouping structure in
##   the data.
## ℹ Did you forget to specify a `group` aesthetic or to convert a numerical
##   variable into a factor?

##Homogneity of variance assumption

##Compute the Levene’s test at each level of the within-subjects factor, here time variable:

lev2<-datos.curve2 %>%
  group_by(diam2) %>%
  levene_test(cd.grano.c ~ gen)
lev2 %>% as_tibble() %>% print(n=Inf)
## # A tibble: 4 × 5
##   diam2   df1   df2 statistic     p
##   <fct> <int> <int>     <dbl> <dbl>
## 1 0         2     6     0.271 0.772
## 2 2         2     6     0.151 0.863
## 3 5         2     6     0.249 0.787
## 4 6         2     6     0.319 0.739
##Computation

res.aov2 <- anova_test(
  data = datos.curve2, dv = cd.grano.c, wid = id,
  within = diam2, between = gen
)
get_anova_table(res.aov2)
## ANOVA Table (type II tests)
## 
##      Effect  DFn DFd      F     p p<.05   ges
## 1       gen 2.00 6.0 12.534 0.007     * 0.756
## 2     diam2 1.13 6.8 19.749 0.003     * 0.458
## 3 gen:diam2 2.27 6.8  0.861 0.477       0.069
#CCN51
datos.ccn<-filter(datos.curve2, gen=="CCN51")
res.aov.ccn2 <- anova_test(
  data = datos.ccn, dv = cd.grano.c, wid = id,
  within = diam2
)
get_anova_table(res.aov.ccn2)
## ANOVA Table (type III tests)
## 
##   Effect DFn DFd      F     p p<.05   ges
## 1  diam2   3   6 19.176 0.002     * 0.733
#ICS95
datos.ics<-filter(datos.curve2, gen=="ICS95")
res.aov.ics2 <- anova_test(
  data = datos.ics, dv = cd.grano.c, wid = id,
  within = diam2
)
get_anova_table(res.aov.ics2)
## ANOVA Table (type III tests)
## 
##   Effect DFn DFd      F     p p<.05   ges
## 1  diam2   3   6 18.459 0.002     * 0.288
#TCS01
datos.tcs<-filter(datos.curve2, gen=="TCS01")
res.aov.tcs2 <- anova_test(
  data = datos.tcs, dv = cd.grano.c, wid = id,
  within = diam2
)
get_anova_table(res.aov.tcs2)
## ANOVA Table (type III tests)
## 
##   Effect DFn DFd     F     p p<.05   ges
## 1  diam2   3   6 2.592 0.148       0.421
## Protocol 2 (T2)

datos.curve3<-filter(datos, curva=="T2")

##Check assumptions
##Outliers

datos.curve3 %>%
  group_by(gen, diam2) %>%
  identify_outliers(cd.grano.c)
##  [1] gen        diam2      curva      muestra    id         dia       
##  [7] cd.grano   curva.1    protocolo  gen.1      muestra.1  dia.1     
## [13] diam       Testa      Grano      cd.grano.1 cd.grano.c cd.grano.a
## [19] cd.grano.d is.outlier is.extreme
## <0 rows> (or 0-length row.names)
##Normality assumption
##Compute Shapiro-Wilk test for each combinations of factor levels:

norm2<-datos.curve3 %>%
  group_by(gen, diam2) %>%
  shapiro_test(cd.grano.c)
norm2 %>% as_tibble() %>% print(n=Inf)
## # A tibble: 12 × 5
##    gen   diam2 variable   statistic     p
##    <fct> <fct> <chr>          <dbl> <dbl>
##  1 CCN51 0     cd.grano.c     0.989 0.799
##  2 CCN51 2     cd.grano.c     0.972 0.678
##  3 CCN51 5     cd.grano.c     0.946 0.551
##  4 CCN51 6     cd.grano.c     0.912 0.424
##  5 ICS95 0     cd.grano.c     0.950 0.567
##  6 ICS95 2     cd.grano.c     0.986 0.770
##  7 ICS95 5     cd.grano.c     0.973 0.683
##  8 ICS95 6     cd.grano.c     0.809 0.135
##  9 TCS01 0     cd.grano.c     0.813 0.147
## 10 TCS01 2     cd.grano.c     0.932 0.496
## 11 TCS01 5     cd.grano.c     0.888 0.349
## 12 TCS01 6     cd.grano.c     1.00  0.986
##Create QQ plot for each cell of design:

ggqqplot(datos.curve3, "cd.grano.c", ggtheme = theme_bw()) +
  facet_grid(diam2~ curva*gen, labeller = "label_both")
## Warning: The following aesthetics were dropped during statistical transformation: sample
## ℹ This can happen when ggplot fails to infer the correct grouping structure in
##   the data.
## ℹ Did you forget to specify a `group` aesthetic or to convert a numerical
##   variable into a factor?
## The following aesthetics were dropped during statistical transformation: sample
## ℹ This can happen when ggplot fails to infer the correct grouping structure in
##   the data.
## ℹ Did you forget to specify a `group` aesthetic or to convert a numerical
##   variable into a factor?
## The following aesthetics were dropped during statistical transformation: sample
## ℹ This can happen when ggplot fails to infer the correct grouping structure in
##   the data.
## ℹ Did you forget to specify a `group` aesthetic or to convert a numerical
##   variable into a factor?
## The following aesthetics were dropped during statistical transformation: sample
## ℹ This can happen when ggplot fails to infer the correct grouping structure in
##   the data.
## ℹ Did you forget to specify a `group` aesthetic or to convert a numerical
##   variable into a factor?
## The following aesthetics were dropped during statistical transformation: sample
## ℹ This can happen when ggplot fails to infer the correct grouping structure in
##   the data.
## ℹ Did you forget to specify a `group` aesthetic or to convert a numerical
##   variable into a factor?
## The following aesthetics were dropped during statistical transformation: sample
## ℹ This can happen when ggplot fails to infer the correct grouping structure in
##   the data.
## ℹ Did you forget to specify a `group` aesthetic or to convert a numerical
##   variable into a factor?
## The following aesthetics were dropped during statistical transformation: sample
## ℹ This can happen when ggplot fails to infer the correct grouping structure in
##   the data.
## ℹ Did you forget to specify a `group` aesthetic or to convert a numerical
##   variable into a factor?
## The following aesthetics were dropped during statistical transformation: sample
## ℹ This can happen when ggplot fails to infer the correct grouping structure in
##   the data.
## ℹ Did you forget to specify a `group` aesthetic or to convert a numerical
##   variable into a factor?
## The following aesthetics were dropped during statistical transformation: sample
## ℹ This can happen when ggplot fails to infer the correct grouping structure in
##   the data.
## ℹ Did you forget to specify a `group` aesthetic or to convert a numerical
##   variable into a factor?
## The following aesthetics were dropped during statistical transformation: sample
## ℹ This can happen when ggplot fails to infer the correct grouping structure in
##   the data.
## ℹ Did you forget to specify a `group` aesthetic or to convert a numerical
##   variable into a factor?
## The following aesthetics were dropped during statistical transformation: sample
## ℹ This can happen when ggplot fails to infer the correct grouping structure in
##   the data.
## ℹ Did you forget to specify a `group` aesthetic or to convert a numerical
##   variable into a factor?
## The following aesthetics were dropped during statistical transformation: sample
## ℹ This can happen when ggplot fails to infer the correct grouping structure in
##   the data.
## ℹ Did you forget to specify a `group` aesthetic or to convert a numerical
##   variable into a factor?
## The following aesthetics were dropped during statistical transformation: sample
## ℹ This can happen when ggplot fails to infer the correct grouping structure in
##   the data.
## ℹ Did you forget to specify a `group` aesthetic or to convert a numerical
##   variable into a factor?
## The following aesthetics were dropped during statistical transformation: sample
## ℹ This can happen when ggplot fails to infer the correct grouping structure in
##   the data.
## ℹ Did you forget to specify a `group` aesthetic or to convert a numerical
##   variable into a factor?
## The following aesthetics were dropped during statistical transformation: sample
## ℹ This can happen when ggplot fails to infer the correct grouping structure in
##   the data.
## ℹ Did you forget to specify a `group` aesthetic or to convert a numerical
##   variable into a factor?
## The following aesthetics were dropped during statistical transformation: sample
## ℹ This can happen when ggplot fails to infer the correct grouping structure in
##   the data.
## ℹ Did you forget to specify a `group` aesthetic or to convert a numerical
##   variable into a factor?
## The following aesthetics were dropped during statistical transformation: sample
## ℹ This can happen when ggplot fails to infer the correct grouping structure in
##   the data.
## ℹ Did you forget to specify a `group` aesthetic or to convert a numerical
##   variable into a factor?
## The following aesthetics were dropped during statistical transformation: sample
## ℹ This can happen when ggplot fails to infer the correct grouping structure in
##   the data.
## ℹ Did you forget to specify a `group` aesthetic or to convert a numerical
##   variable into a factor?
## The following aesthetics were dropped during statistical transformation: sample
## ℹ This can happen when ggplot fails to infer the correct grouping structure in
##   the data.
## ℹ Did you forget to specify a `group` aesthetic or to convert a numerical
##   variable into a factor?
## The following aesthetics were dropped during statistical transformation: sample
## ℹ This can happen when ggplot fails to infer the correct grouping structure in
##   the data.
## ℹ Did you forget to specify a `group` aesthetic or to convert a numerical
##   variable into a factor?
## The following aesthetics were dropped during statistical transformation: sample
## ℹ This can happen when ggplot fails to infer the correct grouping structure in
##   the data.
## ℹ Did you forget to specify a `group` aesthetic or to convert a numerical
##   variable into a factor?
## The following aesthetics were dropped during statistical transformation: sample
## ℹ This can happen when ggplot fails to infer the correct grouping structure in
##   the data.
## ℹ Did you forget to specify a `group` aesthetic or to convert a numerical
##   variable into a factor?
## The following aesthetics were dropped during statistical transformation: sample
## ℹ This can happen when ggplot fails to infer the correct grouping structure in
##   the data.
## ℹ Did you forget to specify a `group` aesthetic or to convert a numerical
##   variable into a factor?
## The following aesthetics were dropped during statistical transformation: sample
## ℹ This can happen when ggplot fails to infer the correct grouping structure in
##   the data.
## ℹ Did you forget to specify a `group` aesthetic or to convert a numerical
##   variable into a factor?

##Homogneity of variance assumption

##Compute the Levene’s test at each level of the within-subjects factor, here time variable:

lev2<-datos.curve3 %>%
  group_by(diam2) %>%
  levene_test(cd.grano.c ~ gen)
lev2 %>% as_tibble() %>% print(n=Inf)
## # A tibble: 4 × 5
##   diam2   df1   df2 statistic     p
##   <fct> <int> <int>     <dbl> <dbl>
## 1 0         2     6    0.122  0.887
## 2 2         2     6    0.363  0.710
## 3 5         2     6    0.0112 0.989
## 4 6         2     6    0.187  0.834
##Computation

res.aov2 <- anova_test(
  data = datos.curve3, dv = cd.grano.c, wid = id,
  within = diam2, between = gen
)
get_anova_table(res.aov2)
## ANOVA Table (type II tests)
## 
##      Effect DFn DFd       F        p p<.05   ges
## 1       gen   2   6 169.964 5.22e-06     * 0.973
## 2     diam2   3  18  60.864 1.27e-09     * 0.787
## 3 gen:diam2   6  18   2.952 3.50e-02     * 0.263
#CCN51
datos.ccn<-filter(datos.curve3, gen=="CCN51")
res.aov.ccn2 <- anova_test(
  data = datos.ccn, dv = cd.grano.c, wid = id,
  within = diam2
)
get_anova_table(res.aov.ccn2)
## ANOVA Table (type III tests)
## 
##   Effect DFn DFd      F     p p<.05   ges
## 1  diam2   3   6 14.126 0.004     * 0.668
#ICS95
datos.ics<-filter(datos.curve3, gen=="ICS95")
res.aov.ics2 <- anova_test(
  data = datos.ics, dv = cd.grano.c, wid = id,
  within = diam2
)
get_anova_table(res.aov.ics2)
## ANOVA Table (type III tests)
## 
##   Effect DFn DFd     F     p p<.05   ges
## 1  diam2   3   6 8.365 0.015     * 0.777
#TCS01
datos.tcs<-filter(datos.curve3, gen=="TCS01")
res.aov.tcs2 <- anova_test(
  data = datos.tcs, dv = cd.grano.c, wid = id,
  within = diam2
)
get_anova_table(res.aov.tcs2)
## ANOVA Table (type III tests)
## 
##   Effect DFn DFd      F        p p<.05   ges
## 1  diam2   3   6 90.215 2.21e-05     * 0.888
## Gráficas por réplica y genotipo
datos$diam2<-as.numeric(as.character(datos$diam2))
##Gráfica por réplica compuesta
pht<- ggplot(datos, aes(x = diam2)) +
  facet_grid(curva~gen*muestra) +
  geom_line(aes(y=cd.grano.c)) +
  geom_point(aes(y=cd.grano.c)) +
  scale_y_continuous(name = expression("Cd (mg*kg"^"-1)")) +  # Etiqueta de la variable continua
  scale_x_continuous(name = "day", breaks=seq(0,7,1)) + # Etiqueta de los grupos
  theme(axis.line = element_line(colour = "black", # Personalización del tema
                                 size = 0.25)) +
  theme(text = element_text(size = 12))
## Warning: The `size` argument of `element_line()` is deprecated as of ggplot2 3.4.0.
## ℹ Please use the `linewidth` argument instead.
## This warning is displayed once every 8 hours.
## Call `lifecycle::last_lifecycle_warnings()` to see where this warning was
## generated.
pht

## Gráfica por genotipo

datos2<-summarySE (datos, measurevar = "cd.grano.c", groupvars = c("curva", "gen","diam2"))
write.csv(datos2, "~/Library/CloudStorage/GoogleDrive-icarounam@gmail.com/Mi unidad/Agrosavia/Colaboraciones/René/1er_Cd/data_out/Cd_grano_mean.csv")

pht2<- ggplot(datos2, aes(x = diam2)) +
  facet_grid(curva~gen) +
  geom_errorbar(aes(ymin=cd.grano.c-ci, ymax=cd.grano.c+ci), width=.1) +
  geom_line(aes(y=cd.grano.c)) +
  geom_point(aes(y=cd.grano.c)) +
  scale_y_continuous(name = expression("Cd (mg*kg"^"-1)")) +  # Etiqueta de la variable continua
  scale_x_continuous(name = "day", breaks=seq(0,7,1)) + # Etiqueta de los grupos
  theme(axis.line = element_line(colour = "black", # Personalización del tema
                                 size = 0.25)) +
  theme(text = element_text(size = 15))  
pht2