setwd("~/Library/CloudStorage/GoogleDrive-icarounam@gmail.com/Mi unidad/Agrosavia/Colaboraciones/René/1er_Cd/data")
datos<-read.table("percentage.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(tf, 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     tf           3 0.43  0.028
##  2 T3    CCN51 2     tf           3 0.713 0.146
##  3 T3    CCN51 5     tf           3 1.32  0.209
##  4 T3    CCN51 6     tf           3 1.67  0.117
##  5 T3    ICS95 0     tf           3 0.473 0.06 
##  6 T3    ICS95 2     tf           3 0.734 0.117
##  7 T3    ICS95 5     tf           3 1.22  0.06 
##  8 T3    ICS95 6     tf           3 1.47  0.062
##  9 T3    TCS01 0     tf           3 0.295 0.025
## 10 T3    TCS01 2     tf           3 0.602 0.124
## 11 T3    TCS01 5     tf           3 0.894 0.157
## 12 T3    TCS01 6     tf           3 1.12  0.19 
## 13 T1    CCN51 0     tf           3 0.631 0.226
## 14 T1    CCN51 2     tf           3 1.07  0.214
## 15 T1    CCN51 5     tf           3 1.72  0.316
## 16 T1    CCN51 6     tf           3 1.80  0.066
## 17 T1    ICS95 0     tf           3 0.639 0.06 
## 18 T1    ICS95 2     tf           3 0.798 0.007
## 19 T1    ICS95 5     tf           3 1.01  0.086
## 20 T1    ICS95 6     tf           3 1.09  0.066
## 21 T1    TCS01 0     tf           3 0.494 0.089
## 22 T1    TCS01 2     tf           3 0.748 0.096
## 23 T1    TCS01 5     tf           3 1.00  0.119
## 24 T1    TCS01 6     tf           3 1.14  0.091
## 25 T2    CCN51 0     tf           3 0.702 0.049
## 26 T2    CCN51 2     tf           3 0.742 0.029
## 27 T2    CCN51 5     tf           3 1.51  0.161
## 28 T2    CCN51 6     tf           3 1.53  0.105
## 29 T2    ICS95 0     tf           3 0.565 0.035
## 30 T2    ICS95 2     tf           3 0.783 0.061
## 31 T2    ICS95 5     tf           3 0.71  0.058
## 32 T2    ICS95 6     tf           3 0.937 0.147
## 33 T2    TCS01 0     tf           3 0.448 0.029
## 34 T2    TCS01 2     tf           3 0.586 0.03 
## 35 T2    TCS01 5     tf           3 0.904 0.067
## 36 T2    TCS01 6     tf           3 1.26  0.27
##Visualization
bxp <- ggboxplot(
  datos, x = "curva", y = "tf",
  color = "diam2", palette = "jco",
  facet.by =  "gen", xlab = "Treatment", ylab = "ITF", legend.title = "day"
)
bxp

##Check assumptions
##Outliers

datos %>%
  group_by(curva, gen, diam2) %>%
  identify_outliers(tf)
##  [1] curva        gen          diam2        ids          trat        
##  [6] muestra      id           dia          cd.testa     cd.grano    
## [11] pdcd.grano   picd.testa   pdph.grano   piph.testa   ph.testa    
## [16] acidez.testa ph.grano     acidez.grano tf           pi.tf       
## [21] 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(tf)
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     tf           0.834 0.198 
##  2 T3    CCN51 2     tf           0.994 0.851 
##  3 T3    CCN51 5     tf           0.834 0.199 
##  4 T3    CCN51 6     tf           0.866 0.285 
##  5 T3    ICS95 0     tf           0.984 0.755 
##  6 T3    ICS95 2     tf           0.830 0.188 
##  7 T3    ICS95 5     tf           0.903 0.396 
##  8 T3    ICS95 6     tf           0.985 0.762 
##  9 T3    TCS01 0     tf           0.964 0.637 
## 10 T3    TCS01 2     tf           0.991 0.817 
## 11 T3    TCS01 5     tf           0.972 0.681 
## 12 T3    TCS01 6     tf           0.921 0.456 
## 13 T1    CCN51 0     tf           0.834 0.199 
## 14 T1    CCN51 2     tf           0.787 0.0832
## 15 T1    CCN51 5     tf           0.834 0.198 
## 16 T1    CCN51 6     tf           1.00  0.985 
## 17 T1    ICS95 0     tf           0.894 0.368 
## 18 T1    ICS95 2     tf           0.931 0.494 
## 19 T1    ICS95 5     tf           0.974 0.690 
## 20 T1    ICS95 6     tf           0.966 0.646 
## 21 T1    TCS01 0     tf           1.00  0.988 
## 22 T1    TCS01 2     tf           0.978 0.715 
## 23 T1    TCS01 5     tf           0.885 0.339 
## 24 T1    TCS01 6     tf           0.989 0.798 
## 25 T2    CCN51 0     tf           0.756 0.0142
## 26 T2    CCN51 2     tf           0.954 0.588 
## 27 T2    CCN51 5     tf           0.963 0.628 
## 28 T2    CCN51 6     tf           0.877 0.316 
## 29 T2    ICS95 0     tf           0.992 0.825 
## 30 T2    ICS95 2     tf           0.759 0.0202
## 31 T2    ICS95 5     tf           0.966 0.647 
## 32 T2    ICS95 6     tf           0.811 0.141 
## 33 T2    TCS01 0     tf           0.934 0.505 
## 34 T2    TCS01 2     tf           0.986 0.777 
## 35 T2    TCS01 5     tf           0.884 0.337 
## 36 T2    TCS01 6     tf           1.00  0.967
##Create QQ plot for each cell of design:

ggqqplot(datos, "tf", 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(tf ~ 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.798 0.612
## 2 2         8    18     0.617 0.753
## 3 5         8    18     0.474 0.859
## 4 6         8    18     0.648 0.728
##Computation

res.aov <- anova_test(
  data = datos, dv = tf, 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   5.943 1.00e-02     * 0.203
## 2             gen   2  18  51.875 3.37e-08     * 0.690
## 3           diam2   3  54 275.421 1.07e-32     * 0.904
## 4       curva:gen   4  18   5.460 5.00e-03     * 0.319
## 5     curva:diam2   6  54   5.079 3.39e-04     * 0.257
## 6       gen:diam2   6  54  13.706 2.18e-09     * 0.483
## 7 curva:gen:diam2  12  54   3.138 2.00e-03     * 0.300
## 
## $`Mauchly's Test for Sphericity`
##            Effect     W     p p<.05
## 1           diam2 0.787 0.549      
## 2     curva:diam2 0.787 0.549      
## 3       gen:diam2 0.787 0.549      
## 4 curva:gen:diam2 0.787 0.549      
## 
## $`Sphericity Corrections`
##            Effect   GGe       DF[GG]    p[GG] p[GG]<.05  HFe       DF[HF]
## 1           diam2 0.877  2.63, 47.33 6.14e-29         * 1.04  3.12, 56.17
## 2     curva:diam2 0.877  5.26, 47.33 6.95e-04         * 1.04  6.24, 56.17
## 3       gen:diam2 0.877  5.26, 47.33 1.83e-08         * 1.04  6.24, 56.17
## 4 curva:gen:diam2 0.877 10.52, 47.33 3.00e-03         * 1.04 12.48, 56.17
##      p[HF] p[HF]<.05
## 1 1.07e-32         *
## 2 3.39e-04         *
## 3 2.18e-09         *
## 4 2.00e-03         *
get_anova_table(res.aov)
## ANOVA Table (type II tests)
## 
##            Effect DFn DFd       F        p p<.05   ges
## 1           curva   2  18   5.943 1.00e-02     * 0.203
## 2             gen   2  18  51.875 3.37e-08     * 0.690
## 3           diam2   3  54 275.421 1.07e-32     * 0.904
## 4       curva:gen   4  18   5.460 5.00e-03     * 0.319
## 5     curva:diam2   6  54   5.079 3.39e-04     * 0.257
## 6       gen:diam2   6  54  13.706 2.18e-09     * 0.483
## 7 curva:gen:diam2  12  54   3.138 2.00e-03     * 0.300
#Table by error
res.aov.error <- aov(tf ~ diam2*curva*gen + Error(id/diam2), datos)
res.aov.error
## 
## Call:
## aov(formula = tf ~ diam2 * curva * gen + Error(id/diam2), data = datos)
## 
## Grand Mean: 0.9371656
## 
## Stratum 1: id
## 
## Terms:
##                     curva       gen curva:gen Residuals
## Sum of Squares  0.2992541 2.6121718 0.5498559 0.4531984
## Deg. of Freedom         2         2         4        18
## 
## Residual standard error: 0.1586748
## 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  10.999270    0.405681  1.094717        0.501285  0.718853
## Deg. of Freedom         3           6         6              12        54
## 
## Residual standard error: 0.115378
## Estimated effects may be unbalanced
## 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     0.911 0.0264 18    0.855    0.966
##  T1     1.011 0.0264 18    0.955    1.066
##  T2     0.890 0.0264 18    0.834    0.946
## 
## 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.0997 0.0374 18  -2.666  0.0398
##  T3 - T2    0.0209 0.0374 18   0.560  0.8428
##  T1 - T2    0.1207 0.0374 18   3.226  0.0124
## 
## 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  1.032 0.0458 18    0.936    1.129
##  ICS95  0.974 0.0458 18    0.877    1.070
##  TCS01  0.727 0.0458 18    0.631    0.823
## 
## curva = T1:
##  gen   emmean     SE df lower.CL upper.CL
##  CCN51  1.303 0.0458 18    1.207    1.399
##  ICS95  0.884 0.0458 18    0.788    0.980
##  TCS01  0.845 0.0458 18    0.749    0.941
## 
## curva = T2:
##  gen   emmean     SE df lower.CL upper.CL
##  CCN51  1.122 0.0458 18    1.026    1.218
##  ICS95  0.749 0.0458 18    0.652    0.845
##  TCS01  0.799 0.0458 18    0.703    0.895
## 
## 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   0.0587 0.0648 18   0.906  0.6435
##  CCN51 - TCS01   0.3055 0.0648 18   4.716  0.0005
##  ICS95 - TCS01   0.2468 0.0648 18   3.810  0.0035
## 
## curva = T1:
##  contrast      estimate     SE df t.ratio p.value
##  CCN51 - ICS95   0.4191 0.0648 18   6.469  <.0001
##  CCN51 - TCS01   0.4578 0.0648 18   7.067  <.0001
##  ICS95 - TCS01   0.0387 0.0648 18   0.597  0.8233
## 
## curva = T2:
##  contrast      estimate     SE df t.ratio p.value
##  CCN51 - ICS95   0.3733 0.0648 18   5.763  0.0001
##  CCN51 - TCS01   0.3228 0.0648 18   4.983  0.0003
##  ICS95 - TCS01  -0.0506 0.0648 18  -0.781  0.7193
## 
## 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      0.430 0.0737 65.5    0.283    0.578
##  2      0.713 0.0737 65.5    0.566    0.860
##  5      1.318 0.0737 65.5    1.171    1.465
##  6      1.668 0.0737 65.5    1.521    1.815
## 
## curva = T1, gen = CCN51:
##  diam2 emmean     SE   df lower.CL upper.CL
##  0      0.631 0.0737 65.5    0.484    0.778
##  2      1.068 0.0737 65.5    0.921    1.216
##  5      1.716 0.0737 65.5    1.569    1.863
##  6      1.796 0.0737 65.5    1.649    1.943
## 
## curva = T2, gen = CCN51:
##  diam2 emmean     SE   df lower.CL upper.CL
##  0      0.702 0.0737 65.5    0.555    0.849
##  2      0.742 0.0737 65.5    0.595    0.889
##  5      1.514 0.0737 65.5    1.367    1.661
##  6      1.529 0.0737 65.5    1.382    1.677
## 
## curva = T3, gen = ICS95:
##  diam2 emmean     SE   df lower.CL upper.CL
##  0      0.473 0.0737 65.5    0.326    0.620
##  2      0.734 0.0737 65.5    0.587    0.881
##  5      1.221 0.0737 65.5    1.074    1.368
##  6      1.467 0.0737 65.5    1.320    1.614
## 
## curva = T1, gen = ICS95:
##  diam2 emmean     SE   df lower.CL upper.CL
##  0      0.639 0.0737 65.5    0.492    0.786
##  2      0.798 0.0737 65.5    0.651    0.945
##  5      1.007 0.0737 65.5    0.860    1.154
##  6      1.092 0.0737 65.5    0.945    1.239
## 
## curva = T2, gen = ICS95:
##  diam2 emmean     SE   df lower.CL upper.CL
##  0      0.565 0.0737 65.5    0.418    0.712
##  2      0.783 0.0737 65.5    0.636    0.930
##  5      0.710 0.0737 65.5    0.562    0.857
##  6      0.937 0.0737 65.5    0.790    1.085
## 
## curva = T3, gen = TCS01:
##  diam2 emmean     SE   df lower.CL upper.CL
##  0      0.295 0.0737 65.5    0.148    0.443
##  2      0.602 0.0737 65.5    0.455    0.750
##  5      0.894 0.0737 65.5    0.747    1.041
##  6      1.115 0.0737 65.5    0.968    1.263
## 
## curva = T1, gen = TCS01:
##  diam2 emmean     SE   df lower.CL upper.CL
##  0      0.494 0.0737 65.5    0.347    0.642
##  2      0.748 0.0737 65.5    0.601    0.895
##  5      1.002 0.0737 65.5    0.855    1.149
##  6      1.136 0.0737 65.5    0.989    1.283
## 
## curva = T2, gen = TCS01:
##  diam2 emmean     SE   df lower.CL upper.CL
##  0      0.448 0.0737 65.5    0.301    0.595
##  2      0.586 0.0737 65.5    0.439    0.733
##  5      0.904 0.0737 65.5    0.757    1.051
##  6      1.259 0.0737 65.5    1.112    1.406
## 
## 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.2824 0.0942 54  -2.997  0.0208
##  0 - 5     -0.8873 0.0942 54  -9.419  <.0001
##  0 - 6     -1.2378 0.0942 54 -13.140  <.0001
##  2 - 5     -0.6049 0.0942 54  -6.421  <.0001
##  2 - 6     -0.9555 0.0942 54 -10.142  <.0001
##  5 - 6     -0.3505 0.0942 54  -3.721  0.0026
## 
## curva = T1, gen = CCN51:
##  contrast estimate     SE df t.ratio p.value
##  0 - 2     -0.4371 0.0942 54  -4.640  0.0001
##  0 - 5     -1.0844 0.0942 54 -11.511  <.0001
##  0 - 6     -1.1646 0.0942 54 -12.362  <.0001
##  2 - 5     -0.6473 0.0942 54  -6.871  <.0001
##  2 - 6     -0.7275 0.0942 54  -7.722  <.0001
##  5 - 6     -0.0802 0.0942 54  -0.851  0.8298
## 
## curva = T2, gen = CCN51:
##  contrast estimate     SE df t.ratio p.value
##  0 - 2     -0.0398 0.0942 54  -0.422  0.9744
##  0 - 5     -0.8122 0.0942 54  -8.621  <.0001
##  0 - 6     -0.8273 0.0942 54  -8.781  <.0001
##  2 - 5     -0.7724 0.0942 54  -8.199  <.0001
##  2 - 6     -0.7875 0.0942 54  -8.359  <.0001
##  5 - 6     -0.0151 0.0942 54  -0.160  0.9985
## 
## curva = T3, gen = ICS95:
##  contrast estimate     SE df t.ratio p.value
##  0 - 2     -0.2602 0.0942 54  -2.762  0.0381
##  0 - 5     -0.7474 0.0942 54  -7.933  <.0001
##  0 - 6     -0.9933 0.0942 54 -10.544  <.0001
##  2 - 5     -0.4872 0.0942 54  -5.171  <.0001
##  2 - 6     -0.7331 0.0942 54  -7.782  <.0001
##  5 - 6     -0.2460 0.0942 54  -2.611  0.0550
## 
## curva = T1, gen = ICS95:
##  contrast estimate     SE df t.ratio p.value
##  0 - 2     -0.1592 0.0942 54  -1.690  0.3388
##  0 - 5     -0.3681 0.0942 54  -3.908  0.0015
##  0 - 6     -0.4533 0.0942 54  -4.812  0.0001
##  2 - 5     -0.2089 0.0942 54  -2.218  0.1314
##  2 - 6     -0.2941 0.0942 54  -3.122  0.0149
##  5 - 6     -0.0852 0.0942 54  -0.904  0.8028
## 
## curva = T2, gen = ICS95:
##  contrast estimate     SE df t.ratio p.value
##  0 - 2     -0.2184 0.0942 54  -2.318  0.1065
##  0 - 5     -0.1448 0.0942 54  -1.537  0.4227
##  0 - 6     -0.3728 0.0942 54  -3.957  0.0012
##  2 - 5      0.0735 0.0942 54   0.781  0.8629
##  2 - 6     -0.1544 0.0942 54  -1.639  0.3660
##  5 - 6     -0.2279 0.0942 54  -2.419  0.0854
## 
## curva = T3, gen = TCS01:
##  contrast estimate     SE df t.ratio p.value
##  0 - 2     -0.3070 0.0942 54  -3.259  0.0102
##  0 - 5     -0.5983 0.0942 54  -6.351  <.0001
##  0 - 6     -0.8200 0.0942 54  -8.704  <.0001
##  2 - 5     -0.2913 0.0942 54  -3.092  0.0161
##  2 - 6     -0.5130 0.0942 54  -5.445  <.0001
##  5 - 6     -0.2217 0.0942 54  -2.353  0.0988
## 
## curva = T1, gen = TCS01:
##  contrast estimate     SE df t.ratio p.value
##  0 - 2     -0.2539 0.0942 54  -2.695  0.0449
##  0 - 5     -0.5075 0.0942 54  -5.387  <.0001
##  0 - 6     -0.6411 0.0942 54  -6.806  <.0001
##  2 - 5     -0.2536 0.0942 54  -2.692  0.0452
##  2 - 6     -0.3872 0.0942 54  -4.111  0.0008
##  5 - 6     -0.1336 0.0942 54  -1.418  0.4936
## 
## curva = T2, gen = TCS01:
##  contrast estimate     SE df t.ratio p.value
##  0 - 2     -0.1381 0.0942 54  -1.465  0.4652
##  0 - 5     -0.4560 0.0942 54  -4.841  0.0001
##  0 - 6     -0.8112 0.0942 54  -8.611  <.0001
##  2 - 5     -0.3180 0.0942 54  -3.376  0.0073
##  2 - 6     -0.6732 0.0942 54  -7.146  <.0001
##  5 - 6     -0.3552 0.0942 54  -3.770  0.0022
## 
## 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  0.430 0.0737 65.5    0.283    0.578
##  2     CCN51  0.713 0.0737 65.5    0.566    0.860
##  5     CCN51  1.318 0.0737 65.5    1.171    1.465
##  6     CCN51  1.668 0.0737 65.5    1.521    1.815
##  0     ICS95  0.473 0.0737 65.5    0.326    0.620
##  2     ICS95  0.734 0.0737 65.5    0.587    0.881
##  5     ICS95  1.221 0.0737 65.5    1.074    1.368
##  6     ICS95  1.467 0.0737 65.5    1.320    1.614
##  0     TCS01  0.295 0.0737 65.5    0.148    0.443
##  2     TCS01  0.602 0.0737 65.5    0.455    0.750
##  5     TCS01  0.894 0.0737 65.5    0.747    1.041
##  6     TCS01  1.115 0.0737 65.5    0.968    1.263
## 
## curva = T1:
##  diam2 gen   emmean     SE   df lower.CL upper.CL
##  0     CCN51  0.631 0.0737 65.5    0.484    0.778
##  2     CCN51  1.068 0.0737 65.5    0.921    1.216
##  5     CCN51  1.716 0.0737 65.5    1.569    1.863
##  6     CCN51  1.796 0.0737 65.5    1.649    1.943
##  0     ICS95  0.639 0.0737 65.5    0.492    0.786
##  2     ICS95  0.798 0.0737 65.5    0.651    0.945
##  5     ICS95  1.007 0.0737 65.5    0.860    1.154
##  6     ICS95  1.092 0.0737 65.5    0.945    1.239
##  0     TCS01  0.494 0.0737 65.5    0.347    0.642
##  2     TCS01  0.748 0.0737 65.5    0.601    0.895
##  5     TCS01  1.002 0.0737 65.5    0.855    1.149
##  6     TCS01  1.136 0.0737 65.5    0.989    1.283
## 
## curva = T2:
##  diam2 gen   emmean     SE   df lower.CL upper.CL
##  0     CCN51  0.702 0.0737 65.5    0.555    0.849
##  2     CCN51  0.742 0.0737 65.5    0.595    0.889
##  5     CCN51  1.514 0.0737 65.5    1.367    1.661
##  6     CCN51  1.529 0.0737 65.5    1.382    1.677
##  0     ICS95  0.565 0.0737 65.5    0.418    0.712
##  2     ICS95  0.783 0.0737 65.5    0.636    0.930
##  5     ICS95  0.710 0.0737 65.5    0.562    0.857
##  6     ICS95  0.937 0.0737 65.5    0.790    1.085
##  0     TCS01  0.448 0.0737 65.5    0.301    0.595
##  2     TCS01  0.586 0.0737 65.5    0.439    0.733
##  5     TCS01  0.904 0.0737 65.5    0.757    1.051
##  6     TCS01  1.259 0.0737 65.5    1.112    1.406
## 
## 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.28238 0.0942 54.0  -2.997  0.1377
##  0 CCN51 - 5 CCN51 -0.88730 0.0942 54.0  -9.419  <.0001
##  0 CCN51 - 6 CCN51 -1.23785 0.0942 54.0 -13.140  <.0001
##  0 CCN51 - 0 ICS95 -0.04295 0.1042 65.5  -0.412  1.0000
##  0 CCN51 - 2 ICS95 -0.30317 0.1042 65.5  -2.910  0.1616
##  0 CCN51 - 5 ICS95 -0.79033 0.1042 65.5  -7.587  <.0001
##  0 CCN51 - 6 ICS95 -1.03628 0.1042 65.5  -9.948  <.0001
##  0 CCN51 - 0 TCS01  0.13495 0.1042 65.5   1.295  0.9769
##  0 CCN51 - 2 TCS01 -0.17206 0.1042 65.5  -1.652  0.8827
##  0 CCN51 - 5 TCS01 -0.46335 0.1042 65.5  -4.448  0.0019
##  0 CCN51 - 6 TCS01 -0.68502 0.1042 65.5  -6.576  <.0001
##  2 CCN51 - 5 CCN51 -0.60493 0.0942 54.0  -6.421  <.0001
##  2 CCN51 - 6 CCN51 -0.95547 0.0942 54.0 -10.142  <.0001
##  2 CCN51 - 0 ICS95  0.23942 0.1042 65.5   2.298  0.4882
##  2 CCN51 - 2 ICS95 -0.02080 0.1042 65.5  -0.200  1.0000
##  2 CCN51 - 5 ICS95 -0.50795 0.1042 65.5  -4.876  0.0004
##  2 CCN51 - 6 ICS95 -0.75390 0.1042 65.5  -7.237  <.0001
##  2 CCN51 - 0 TCS01  0.41732 0.1042 65.5   4.006  0.0082
##  2 CCN51 - 2 TCS01  0.11031 0.1042 65.5   1.059  0.9954
##  2 CCN51 - 5 TCS01 -0.18097 0.1042 65.5  -1.737  0.8442
##  2 CCN51 - 6 TCS01 -0.40264 0.1042 65.5  -3.865  0.0127
##  5 CCN51 - 6 CCN51 -0.35054 0.0942 54.0  -3.721  0.0217
##  5 CCN51 - 0 ICS95  0.84435 0.1042 65.5   8.105  <.0001
##  5 CCN51 - 2 ICS95  0.58413 0.1042 65.5   5.607  <.0001
##  5 CCN51 - 5 ICS95  0.09698 0.1042 65.5   0.931  0.9985
##  5 CCN51 - 6 ICS95 -0.14898 0.1042 65.5  -1.430  0.9530
##  5 CCN51 - 0 TCS01  1.02225 0.1042 65.5   9.813  <.0001
##  5 CCN51 - 2 TCS01  0.71524 0.1042 65.5   6.866  <.0001
##  5 CCN51 - 5 TCS01  0.42396 0.1042 65.5   4.070  0.0067
##  5 CCN51 - 6 TCS01  0.20229 0.1042 65.5   1.942  0.7290
##  6 CCN51 - 0 ICS95  1.19489 0.1042 65.5  11.470  <.0001
##  6 CCN51 - 2 ICS95  0.93468 0.1042 65.5   8.972  <.0001
##  6 CCN51 - 5 ICS95  0.44752 0.1042 65.5   4.296  0.0032
##  6 CCN51 - 6 ICS95  0.20157 0.1042 65.5   1.935  0.7334
##  6 CCN51 - 0 TCS01  1.37280 0.1042 65.5  13.178  <.0001
##  6 CCN51 - 2 TCS01  1.06579 0.1042 65.5  10.231  <.0001
##  6 CCN51 - 5 TCS01  0.77450 0.1042 65.5   7.435  <.0001
##  6 CCN51 - 6 TCS01  0.55283 0.1042 65.5   5.307  0.0001
##  0 ICS95 - 2 ICS95 -0.26022 0.0942 54.0  -2.762  0.2255
##  0 ICS95 - 5 ICS95 -0.74737 0.0942 54.0  -7.933  <.0001
##  0 ICS95 - 6 ICS95 -0.99333 0.0942 54.0 -10.544  <.0001
##  0 ICS95 - 0 TCS01  0.17790 0.1042 65.5   1.708  0.8582
##  0 ICS95 - 2 TCS01 -0.12911 0.1042 65.5  -1.239  0.9835
##  0 ICS95 - 5 TCS01 -0.42039 0.1042 65.5  -4.035  0.0074
##  0 ICS95 - 6 TCS01 -0.64206 0.1042 65.5  -6.163  <.0001
##  2 ICS95 - 5 ICS95 -0.48715 0.0942 54.0  -5.171  0.0002
##  2 ICS95 - 6 ICS95 -0.73311 0.0942 54.0  -7.782  <.0001
##  2 ICS95 - 0 TCS01  0.43812 0.1042 65.5   4.206  0.0043
##  2 ICS95 - 2 TCS01  0.13111 0.1042 65.5   1.259  0.9814
##  2 ICS95 - 5 TCS01 -0.16017 0.1042 65.5  -1.538  0.9242
##  2 ICS95 - 6 TCS01 -0.38185 0.1042 65.5  -3.665  0.0230
##  5 ICS95 - 6 ICS95 -0.24595 0.0942 54.0  -2.611  0.2995
##  5 ICS95 - 0 TCS01  0.92527 0.1042 65.5   8.882  <.0001
##  5 ICS95 - 2 TCS01  0.61826 0.1042 65.5   5.935  <.0001
##  5 ICS95 - 5 TCS01  0.32698 0.1042 65.5   3.139  0.0950
##  5 ICS95 - 6 TCS01  0.10531 0.1042 65.5   1.011  0.9969
##  6 ICS95 - 0 TCS01  1.17123 0.1042 65.5  11.243  <.0001
##  6 ICS95 - 2 TCS01  0.86422 0.1042 65.5   8.296  <.0001
##  6 ICS95 - 5 TCS01  0.57293 0.1042 65.5   5.500  <.0001
##  6 ICS95 - 6 TCS01  0.35126 0.1042 65.5   3.372  0.0523
##  0 TCS01 - 2 TCS01 -0.30701 0.0942 54.0  -3.259  0.0744
##  0 TCS01 - 5 TCS01 -0.59829 0.0942 54.0  -6.351  <.0001
##  0 TCS01 - 6 TCS01 -0.81997 0.0942 54.0  -8.704  <.0001
##  2 TCS01 - 5 TCS01 -0.29128 0.0942 54.0  -3.092  0.1111
##  2 TCS01 - 6 TCS01 -0.51296 0.0942 54.0  -5.445  0.0001
##  5 TCS01 - 6 TCS01 -0.22167 0.0942 54.0  -2.353  0.4540
## 
## curva = T1:
##  contrast          estimate     SE   df t.ratio p.value
##  0 CCN51 - 2 CCN51 -0.43709 0.0942 54.0  -4.640  0.0013
##  0 CCN51 - 5 CCN51 -1.08440 0.0942 54.0 -11.511  <.0001
##  0 CCN51 - 6 CCN51 -1.16457 0.0942 54.0 -12.362  <.0001
##  0 CCN51 - 0 ICS95 -0.00727 0.1042 65.5  -0.070  1.0000
##  0 CCN51 - 2 ICS95 -0.16649 0.1042 65.5  -1.598  0.9036
##  0 CCN51 - 5 ICS95 -0.37542 0.1042 65.5  -3.604  0.0275
##  0 CCN51 - 6 ICS95 -0.46057 0.1042 65.5  -4.421  0.0021
##  0 CCN51 - 0 TCS01  0.13689 0.1042 65.5   1.314  0.9743
##  0 CCN51 - 2 TCS01 -0.11700 0.1042 65.5  -1.123  0.9925
##  0 CCN51 - 5 TCS01 -0.37061 0.1042 65.5  -3.558  0.0314
##  0 CCN51 - 6 TCS01 -0.50424 0.1042 65.5  -4.840  0.0005
##  2 CCN51 - 5 CCN51 -0.64731 0.0942 54.0  -6.871  <.0001
##  2 CCN51 - 6 CCN51 -0.72748 0.0942 54.0  -7.722  <.0001
##  2 CCN51 - 0 ICS95  0.42982 0.1042 65.5   4.126  0.0056
##  2 CCN51 - 2 ICS95  0.27059 0.1042 65.5   2.598  0.3024
##  2 CCN51 - 5 ICS95  0.06167 0.1042 65.5   0.592  1.0000
##  2 CCN51 - 6 ICS95 -0.02348 0.1042 65.5  -0.225  1.0000
##  2 CCN51 - 0 TCS01  0.57398 0.1042 65.5   5.510  <.0001
##  2 CCN51 - 2 TCS01  0.32009 0.1042 65.5   3.073  0.1115
##  2 CCN51 - 5 TCS01  0.06647 0.1042 65.5   0.638  1.0000
##  2 CCN51 - 6 TCS01 -0.06715 0.1042 65.5  -0.645  1.0000
##  5 CCN51 - 6 CCN51 -0.08017 0.0942 54.0  -0.851  0.9993
##  5 CCN51 - 0 ICS95  1.07713 0.1042 65.5  10.340  <.0001
##  5 CCN51 - 2 ICS95  0.91790 0.1042 65.5   8.811  <.0001
##  5 CCN51 - 5 ICS95  0.70898 0.1042 65.5   6.806  <.0001
##  5 CCN51 - 6 ICS95  0.62383 0.1042 65.5   5.988  <.0001
##  5 CCN51 - 0 TCS01  1.22129 0.1042 65.5  11.724  <.0001
##  5 CCN51 - 2 TCS01  0.96740 0.1042 65.5   9.286  <.0001
##  5 CCN51 - 5 TCS01  0.71378 0.1042 65.5   6.852  <.0001
##  5 CCN51 - 6 TCS01  0.58016 0.1042 65.5   5.569  <.0001
##  6 CCN51 - 0 ICS95  1.15729 0.1042 65.5  11.109  <.0001
##  6 CCN51 - 2 ICS95  0.99807 0.1042 65.5   9.581  <.0001
##  6 CCN51 - 5 ICS95  0.78915 0.1042 65.5   7.575  <.0001
##  6 CCN51 - 6 ICS95  0.70399 0.1042 65.5   6.758  <.0001
##  6 CCN51 - 0 TCS01  1.30146 0.1042 65.5  12.493  <.0001
##  6 CCN51 - 2 TCS01  1.04757 0.1042 65.5  10.056  <.0001
##  6 CCN51 - 5 TCS01  0.79395 0.1042 65.5   7.621  <.0001
##  6 CCN51 - 6 TCS01  0.66033 0.1042 65.5   6.339  <.0001
##  0 ICS95 - 2 ICS95 -0.15922 0.0942 54.0  -1.690  0.8648
##  0 ICS95 - 5 ICS95 -0.36815 0.0942 54.0  -3.908  0.0126
##  0 ICS95 - 6 ICS95 -0.45330 0.0942 54.0  -4.812  0.0007
##  0 ICS95 - 0 TCS01  0.14417 0.1042 65.5   1.384  0.9626
##  0 ICS95 - 2 TCS01 -0.10973 0.1042 65.5  -1.053  0.9956
##  0 ICS95 - 5 TCS01 -0.36334 0.1042 65.5  -3.488  0.0382
##  0 ICS95 - 6 TCS01 -0.49697 0.1042 65.5  -4.771  0.0006
##  2 ICS95 - 5 ICS95 -0.20893 0.0942 54.0  -2.218  0.5447
##  2 ICS95 - 6 ICS95 -0.29408 0.0942 54.0  -3.122  0.1036
##  2 ICS95 - 0 TCS01  0.30339 0.1042 65.5   2.912  0.1608
##  2 ICS95 - 2 TCS01  0.04949 0.1042 65.5   0.475  1.0000
##  2 ICS95 - 5 TCS01 -0.20412 0.1042 65.5  -1.959  0.7179
##  2 ICS95 - 6 TCS01 -0.33775 0.1042 65.5  -3.242  0.0734
##  5 ICS95 - 6 ICS95 -0.08515 0.0942 54.0  -0.904  0.9988
##  5 ICS95 - 0 TCS01  0.51232 0.1042 65.5   4.918  0.0004
##  5 ICS95 - 2 TCS01  0.25842 0.1042 65.5   2.481  0.3701
##  5 ICS95 - 5 TCS01  0.00481 0.1042 65.5   0.046  1.0000
##  5 ICS95 - 6 TCS01 -0.12882 0.1042 65.5  -1.237  0.9838
##  6 ICS95 - 0 TCS01  0.59747 0.1042 65.5   5.735  <.0001
##  6 ICS95 - 2 TCS01  0.34357 0.1042 65.5   3.298  0.0636
##  6 ICS95 - 5 TCS01  0.08996 0.1042 65.5   0.864  0.9993
##  6 ICS95 - 6 TCS01 -0.04367 0.1042 65.5  -0.419  1.0000
##  0 TCS01 - 2 TCS01 -0.25390 0.0942 54.0  -2.695  0.2566
##  0 TCS01 - 5 TCS01 -0.50751 0.0942 54.0  -5.387  0.0001
##  0 TCS01 - 6 TCS01 -0.64114 0.0942 54.0  -6.806  <.0001
##  2 TCS01 - 5 TCS01 -0.25361 0.0942 54.0  -2.692  0.2581
##  2 TCS01 - 6 TCS01 -0.38724 0.0942 54.0  -4.111  0.0068
##  5 TCS01 - 6 TCS01 -0.13363 0.0942 54.0  -1.418  0.9546
## 
## curva = T2:
##  contrast          estimate     SE   df t.ratio p.value
##  0 CCN51 - 2 CCN51 -0.03978 0.0942 54.0  -0.422  1.0000
##  0 CCN51 - 5 CCN51 -0.81218 0.0942 54.0  -8.621  <.0001
##  0 CCN51 - 6 CCN51 -0.82726 0.0942 54.0  -8.781  <.0001
##  0 CCN51 - 0 ICS95  0.13754 0.1042 65.5   1.320  0.9734
##  0 CCN51 - 2 ICS95 -0.08084 0.1042 65.5  -0.776  0.9997
##  0 CCN51 - 5 ICS95 -0.00730 0.1042 65.5  -0.070  1.0000
##  0 CCN51 - 6 ICS95 -0.23523 0.1042 65.5  -2.258  0.5157
##  0 CCN51 - 0 TCS01  0.25429 0.1042 65.5   2.441  0.3946
##  0 CCN51 - 2 TCS01  0.11624 0.1042 65.5   1.116  0.9929
##  0 CCN51 - 5 TCS01 -0.20175 0.1042 65.5  -1.937  0.7323
##  0 CCN51 - 6 TCS01 -0.55691 0.1042 65.5  -5.346  0.0001
##  2 CCN51 - 5 CCN51 -0.77240 0.0942 54.0  -8.199  <.0001
##  2 CCN51 - 6 CCN51 -0.78748 0.0942 54.0  -8.359  <.0001
##  2 CCN51 - 0 ICS95  0.17732 0.1042 65.5   1.702  0.8607
##  2 CCN51 - 2 ICS95 -0.04106 0.1042 65.5  -0.394  1.0000
##  2 CCN51 - 5 ICS95  0.03248 0.1042 65.5   0.312  1.0000
##  2 CCN51 - 6 ICS95 -0.19545 0.1042 65.5  -1.876  0.7691
##  2 CCN51 - 0 TCS01  0.29407 0.1042 65.5   2.823  0.1948
##  2 CCN51 - 2 TCS01  0.15602 0.1042 65.5   1.498  0.9360
##  2 CCN51 - 5 TCS01 -0.16197 0.1042 65.5  -1.555  0.9186
##  2 CCN51 - 6 TCS01 -0.51713 0.1042 65.5  -4.964  0.0003
##  5 CCN51 - 6 CCN51 -0.01508 0.0942 54.0  -0.160  1.0000
##  5 CCN51 - 0 ICS95  0.94972 0.1042 65.5   9.117  <.0001
##  5 CCN51 - 2 ICS95  0.73134 0.1042 65.5   7.020  <.0001
##  5 CCN51 - 5 ICS95  0.80488 0.1042 65.5   7.726  <.0001
##  5 CCN51 - 6 ICS95  0.57695 0.1042 65.5   5.538  <.0001
##  5 CCN51 - 0 TCS01  1.06647 0.1042 65.5  10.237  <.0001
##  5 CCN51 - 2 TCS01  0.92842 0.1042 65.5   8.912  <.0001
##  5 CCN51 - 5 TCS01  0.61043 0.1042 65.5   5.860  <.0001
##  5 CCN51 - 6 TCS01  0.25527 0.1042 65.5   2.450  0.3888
##  6 CCN51 - 0 ICS95  0.96480 0.1042 65.5   9.261  <.0001
##  6 CCN51 - 2 ICS95  0.74642 0.1042 65.5   7.165  <.0001
##  6 CCN51 - 5 ICS95  0.81996 0.1042 65.5   7.871  <.0001
##  6 CCN51 - 6 ICS95  0.59204 0.1042 65.5   5.683  <.0001
##  6 CCN51 - 0 TCS01  1.08156 0.1042 65.5  10.382  <.0001
##  6 CCN51 - 2 TCS01  0.94351 0.1042 65.5   9.057  <.0001
##  6 CCN51 - 5 TCS01  0.62551 0.1042 65.5   6.004  <.0001
##  6 CCN51 - 6 TCS01  0.27035 0.1042 65.5   2.595  0.3037
##  0 ICS95 - 2 ICS95 -0.21838 0.0942 54.0  -2.318  0.4770
##  0 ICS95 - 5 ICS95 -0.14484 0.0942 54.0  -1.537  0.9230
##  0 ICS95 - 6 ICS95 -0.37276 0.0942 54.0  -3.957  0.0109
##  0 ICS95 - 0 TCS01  0.11676 0.1042 65.5   1.121  0.9926
##  0 ICS95 - 2 TCS01 -0.02130 0.1042 65.5  -0.204  1.0000
##  0 ICS95 - 5 TCS01 -0.33929 0.1042 65.5  -3.257  0.0707
##  0 ICS95 - 6 TCS01 -0.69445 0.1042 65.5  -6.666  <.0001
##  2 ICS95 - 5 ICS95  0.07354 0.0942 54.0   0.781  0.9997
##  2 ICS95 - 6 ICS95 -0.15439 0.0942 54.0  -1.639  0.8866
##  2 ICS95 - 0 TCS01  0.33513 0.1042 65.5   3.217  0.0783
##  2 ICS95 - 2 TCS01  0.19708 0.1042 65.5   1.892  0.7597
##  2 ICS95 - 5 TCS01 -0.12091 0.1042 65.5  -1.161  0.9902
##  2 ICS95 - 6 TCS01 -0.47607 0.1042 65.5  -4.570  0.0013
##  5 ICS95 - 6 ICS95 -0.22793 0.0942 54.0  -2.419  0.4113
##  5 ICS95 - 0 TCS01  0.26159 0.1042 65.5   2.511  0.3517
##  5 ICS95 - 2 TCS01  0.12354 0.1042 65.5   1.186  0.9883
##  5 ICS95 - 5 TCS01 -0.19445 0.1042 65.5  -1.867  0.7747
##  5 ICS95 - 6 TCS01 -0.54961 0.1042 65.5  -5.276  0.0001
##  6 ICS95 - 0 TCS01  0.48952 0.1042 65.5   4.699  0.0008
##  6 ICS95 - 2 TCS01  0.35147 0.1042 65.5   3.374  0.0521
##  6 ICS95 - 5 TCS01  0.03347 0.1042 65.5   0.321  1.0000
##  6 ICS95 - 6 TCS01 -0.32169 0.1042 65.5  -3.088  0.1075
##  0 TCS01 - 2 TCS01 -0.13805 0.0942 54.0  -1.465  0.9435
##  0 TCS01 - 5 TCS01 -0.45605 0.0942 54.0  -4.841  0.0006
##  0 TCS01 - 6 TCS01 -0.81121 0.0942 54.0  -8.611  <.0001
##  2 TCS01 - 5 TCS01 -0.31799 0.0942 54.0  -3.376  0.0554
##  2 TCS01 - 6 TCS01 -0.67315 0.0942 54.0  -7.146  <.0001
##  5 TCS01 - 6 TCS01 -0.35516 0.0942 54.0  -3.770  0.0189
## 
## P value adjustment: tukey method for comparing a family of 12 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(tf)
##  [1] gen          diam2        ids          curva        trat        
##  [6] muestra      id           dia          cd.testa     cd.grano    
## [11] pdcd.grano   picd.testa   pdph.grano   piph.testa   ph.testa    
## [16] acidez.testa ph.grano     acidez.grano tf           pi.tf       
## [21] 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(tf)
norm1 %>% as_tibble() %>% print(n=Inf)
## # A tibble: 12 × 5
##    gen   diam2 variable statistic     p
##    <fct> <fct> <chr>        <dbl> <dbl>
##  1 CCN51 0     tf           0.834 0.198
##  2 CCN51 2     tf           0.994 0.851
##  3 CCN51 5     tf           0.834 0.199
##  4 CCN51 6     tf           0.866 0.285
##  5 ICS95 0     tf           0.984 0.755
##  6 ICS95 2     tf           0.830 0.188
##  7 ICS95 5     tf           0.903 0.396
##  8 ICS95 6     tf           0.985 0.762
##  9 TCS01 0     tf           0.964 0.637
## 10 TCS01 2     tf           0.991 0.817
## 11 TCS01 5     tf           0.972 0.681
## 12 TCS01 6     tf           0.921 0.456
##Create QQ plot for each cell of design:

ggqqplot(datos.curve1, "tf", 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(tf ~ 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.702  0.532
## 2 2         2     6    0.0665 0.936
## 3 5         2     6    0.420  0.675
## 4 6         2     6    0.487  0.637
##Computation

res.aov1 <- anova_test(
  data = datos.curve1, dv = tf, 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.00 6.00  31.412 6.63e-04     * 0.636
## 2     diam2 1.24 7.46 111.736 6.23e-06     * 0.939
## 3 gen:diam2 2.49 7.46   2.154 1.80e-01       0.374
#CCN51
datos.ccn<-filter(datos.curve1, gen=="CCN51")
res.aov.ccn1 <- anova_test(
  data = datos.ccn, dv = tf, 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 41.746 0.000205     * 0.947
#ICS95
datos.ics<-filter(datos.curve1, gen=="ICS95")
res.aov.ics1 <- anova_test(
  data = datos.ics, dv = tf, 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 77.505 3.45e-05     * 0.974
#TCS01
datos.tcs<-filter(datos.curve1, gen=="TCS01")
res.aov.tcs1 <- anova_test(
  data = datos.tcs, dv = tf, 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 19.445 0.002     * 0.881
## Protocol 1 (T1)

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

##Check assumptions
##Outliers

datos.curve2 %>%
  group_by(gen, diam2) %>%
  identify_outliers(tf)
##  [1] gen          diam2        ids          curva        trat        
##  [6] muestra      id           dia          cd.testa     cd.grano    
## [11] pdcd.grano   picd.testa   pdph.grano   piph.testa   ph.testa    
## [16] acidez.testa ph.grano     acidez.grano tf           pi.tf       
## [21] 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(tf)
norm2 %>% as_tibble() %>% print(n=Inf)
## # A tibble: 12 × 5
##    gen   diam2 variable statistic      p
##    <fct> <fct> <chr>        <dbl>  <dbl>
##  1 CCN51 0     tf           0.834 0.199 
##  2 CCN51 2     tf           0.787 0.0832
##  3 CCN51 5     tf           0.834 0.198 
##  4 CCN51 6     tf           1.00  0.985 
##  5 ICS95 0     tf           0.894 0.368 
##  6 ICS95 2     tf           0.931 0.494 
##  7 ICS95 5     tf           0.974 0.690 
##  8 ICS95 6     tf           0.966 0.646 
##  9 TCS01 0     tf           1.00  0.988 
## 10 TCS01 2     tf           0.978 0.715 
## 11 TCS01 5     tf           0.885 0.339 
## 12 TCS01 6     tf           0.989 0.798
##Create QQ plot for each cell of design:

ggqqplot(datos.curve2, "tf", 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(tf ~ 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.557 0.600
## 2 2         2     6     0.743 0.515
## 3 5         2     6     0.546 0.605
## 4 6         2     6     0.129 0.882
##Computation

res.aov2 <- anova_test(
  data = datos.curve2, dv = tf, 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 18.077 3.00e-03     * 0.751
## 2     diam2   3  18 76.291 1.98e-10     * 0.864
## 3 gen:diam2   6  18  7.253 4.70e-04     * 0.546
#CCN51
datos.ccn<-filter(datos.curve2, gen=="CCN51")
res.aov.ccn2 <- anova_test(
  data = datos.ccn, dv = tf, 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 33.695 0.000377     * 0.873
#ICS95
datos.ics<-filter(datos.curve2, gen=="ICS95")
res.aov.ics2 <- anova_test(
  data = datos.ics, dv = tf, 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 55.863 8.92e-05     * 0.925
#TCS01
datos.tcs<-filter(datos.curve2, gen=="TCS01")
res.aov.tcs2 <- anova_test(
  data = datos.tcs, dv = tf, 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 18.603 0.002     * 0.901
## Protocol 2 (T2)

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

##Check assumptions
##Outliers

datos.curve3 %>%
  group_by(gen, diam2) %>%
  identify_outliers(tf)
##  [1] gen          diam2        ids          curva        trat        
##  [6] muestra      id           dia          cd.testa     cd.grano    
## [11] pdcd.grano   picd.testa   pdph.grano   piph.testa   ph.testa    
## [16] acidez.testa ph.grano     acidez.grano tf           pi.tf       
## [21] 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(tf)
norm2 %>% as_tibble() %>% print(n=Inf)
## # A tibble: 12 × 5
##    gen   diam2 variable statistic      p
##    <fct> <fct> <chr>        <dbl>  <dbl>
##  1 CCN51 0     tf           0.756 0.0142
##  2 CCN51 2     tf           0.954 0.588 
##  3 CCN51 5     tf           0.963 0.628 
##  4 CCN51 6     tf           0.877 0.316 
##  5 ICS95 0     tf           0.992 0.825 
##  6 ICS95 2     tf           0.759 0.0202
##  7 ICS95 5     tf           0.966 0.647 
##  8 ICS95 6     tf           0.811 0.141 
##  9 TCS01 0     tf           0.934 0.505 
## 10 TCS01 2     tf           0.986 0.777 
## 11 TCS01 5     tf           0.884 0.337 
## 12 TCS01 6     tf           1.00  0.967
##Create QQ plot for each cell of design:

ggqqplot(datos.curve3, "tf", 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(tf ~ 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.0639 0.939
## 2 2         2     6    0.173  0.846
## 3 5         2     6    0.823  0.483
## 4 6         2     6    0.665  0.549
##Computation

res.aov2 <- anova_test(
  data = datos.curve3, dv = tf, 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.0 6.00 21.676 2.00e-03     * 0.767
## 2     diam2 1.6 9.61 94.187 8.35e-07     * 0.895
## 3 gen:diam2 3.2 9.61 14.091 6.73e-04     * 0.719
#CCN51
datos.ccn<-filter(datos.curve3, gen=="CCN51")
res.aov.ccn2 <- anova_test(
  data = datos.ccn, dv = tf, 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 64.702 5.83e-05     * 0.96
#ICS95
datos.ics<-filter(datos.curve3, gen=="ICS95")
res.aov.ics2 <- anova_test(
  data = datos.ics, dv = tf, 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 22.804 0.001     * 0.784
#TCS01
datos.tcs<-filter(datos.curve3, gen=="TCS01")
res.aov.tcs2 <- anova_test(
  data = datos.tcs, dv = tf, 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 27.949 0.000635     * 0.881
## 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=tf)) +
  geom_point(aes(y=tf)) +
  scale_y_continuous(name = expression("ITF")) +  # 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 = "tf", 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=tf-ci, ymax=tf+ci), width=.1) +
  geom_line(aes(y=tf)) +
  geom_point(aes(y=tf)) +
  scale_y_continuous(name = expression("ITF")) +  # 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