setwd("~/Library/CloudStorage/GoogleDrive-icarounam@gmail.com/Mi unidad/Agrosavia/Colaboraciones/René/1er_Cd/data")
datos<-read.table("percentage_7.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)
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)
## ITF
##Summary statistics
summ<-datos %>%
group_by(curva, gen) %>%
get_summary_stats(tf, type = "mean_sd")
summ %>% as_tibble() %>% print(n=Inf)
## # A tibble: 9 × 6
## curva gen variable n mean sd
## <fct> <fct> <chr> <dbl> <dbl> <dbl>
## 1 T3 CCN51 tf 3 1.67 0.117
## 2 T3 ICS95 tf 3 1.47 0.062
## 3 T3 TCS01 tf 3 1.12 0.19
## 4 T1 CCN51 tf 3 1.80 0.066
## 5 T1 ICS95 tf 3 1.09 0.066
## 6 T1 TCS01 tf 3 1.14 0.091
## 7 T2 CCN51 tf 3 1.53 0.105
## 8 T2 ICS95 tf 3 0.937 0.147
## 9 T2 TCS01 tf 3 1.26 0.27
##Visualization
bxp <- ggboxplot(
datos, x = "curva", y = "tf",
palette = "jco",
color = "gen", xlab = "Treatment", ylab = "ITF", legend.title = "Genotype"
)
bxp

##Check assumptions
##Outliers
datos %>%
group_by(curva, gen) %>%
identify_outliers(tf)
## [1] curva gen ids trat muestra
## [6] id dia diam2 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) %>%
shapiro_test(tf)
norm %>% as_tibble() %>% print(n=Inf)
## # A tibble: 9 × 5
## curva gen variable statistic p
## <fct> <fct> <chr> <dbl> <dbl>
## 1 T3 CCN51 tf 0.866 0.285
## 2 T3 ICS95 tf 0.985 0.762
## 3 T3 TCS01 tf 0.921 0.456
## 4 T1 CCN51 tf 1.00 0.985
## 5 T1 ICS95 tf 0.966 0.646
## 6 T1 TCS01 tf 0.989 0.798
## 7 T2 CCN51 tf 0.877 0.316
## 8 T2 ICS95 tf 0.811 0.141
## 9 T2 TCS01 tf 1.00 0.967
##Create QQ plot for each cell of design:
ggqqplot(datos, "tf", ggtheme = theme_bw()) +
facet_grid(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?

##Homogneity of variance assumption
##Compute the Levene’s test at each level of the within-subjects factor, here time variable:
lev<-datos %>%
group_by(curva) %>%
levene_test(tf ~ gen)
lev %>% as_tibble() %>% print(n=Inf)
## # A tibble: 3 × 5
## curva df1 df2 statistic p
## <fct> <int> <int> <dbl> <dbl>
## 1 T3 2 6 0.487 0.637
## 2 T1 2 6 0.129 0.882
## 3 T2 2 6 0.665 0.549
#Table by error
res.aov.error <- aov(tf ~ curva*gen, datos)
summary(res.aov.error)
## Df Sum Sq Mean Sq F value Pr(>F)
## curva 2 0.1383 0.0692 3.535 0.05071 .
## gen 2 1.4813 0.7406 37.850 3.56e-07 ***
## curva:gen 4 0.4490 0.1122 5.736 0.00371 **
## Residuals 18 0.3522 0.0196
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## Emmeans
emmip(res.aov.error, gen ~ curva)

emm_curva <- emmeans(res.aov.error, pairwise ~ curva)
## NOTE: Results may be misleading due to involvement in interactions
emm_curva
## $emmeans
## curva emmean SE df lower.CL upper.CL
## T3 1.42 0.0466 18 1.32 1.51
## T1 1.34 0.0466 18 1.24 1.44
## T2 1.24 0.0466 18 1.14 1.34
##
## Results are averaged over the levels of: gen
## Confidence level used: 0.95
##
## $contrasts
## contrast estimate SE df t.ratio p.value
## T3 - T1 0.0756 0.0659 18 1.147 0.4988
## T3 - T2 0.1748 0.0659 18 2.651 0.0410
## T1 - T2 0.0992 0.0659 18 1.504 0.3125
##
## Results are averaged over the levels of: gen
## P value adjustment: tukey method for comparing a family of 3 estimates
emm_gen_curva <- emmeans(res.aov.error, pairwise ~ gen | curva)
emm_gen_curva
## $emmeans
## curva = T3:
## gen emmean SE df lower.CL upper.CL
## CCN51 1.668 0.0808 18 1.499 1.84
## ICS95 1.467 0.0808 18 1.297 1.64
## TCS01 1.115 0.0808 18 0.946 1.29
##
## curva = T1:
## gen emmean SE df lower.CL upper.CL
## CCN51 1.796 0.0808 18 1.626 1.97
## ICS95 1.092 0.0808 18 0.922 1.26
## TCS01 1.136 0.0808 18 0.966 1.31
##
## curva = T2:
## gen emmean SE df lower.CL upper.CL
## CCN51 1.529 0.0808 18 1.360 1.70
## ICS95 0.937 0.0808 18 0.768 1.11
## TCS01 1.259 0.0808 18 1.089 1.43
##
## Confidence level used: 0.95
##
## $contrasts
## curva = T3:
## contrast estimate SE df t.ratio p.value
## CCN51 - ICS95 0.2016 0.114 18 1.765 0.2095
## CCN51 - TCS01 0.5528 0.114 18 4.840 0.0004
## ICS95 - TCS01 0.3513 0.114 18 3.075 0.0171
##
## curva = T1:
## contrast estimate SE df t.ratio p.value
## CCN51 - ICS95 0.7040 0.114 18 6.164 <.0001
## CCN51 - TCS01 0.6603 0.114 18 5.781 0.0001
## ICS95 - TCS01 -0.0437 0.114 18 -0.382 0.9229
##
## curva = T2:
## contrast estimate SE df t.ratio p.value
## CCN51 - ICS95 0.5920 0.114 18 5.184 0.0002
## CCN51 - TCS01 0.2704 0.114 18 2.367 0.0718
## ICS95 - TCS01 -0.3217 0.114 18 -2.816 0.0293
##
## P value adjustment: tukey method for comparing a family of 3 estimates
emm_gen_diam2 <- emmeans(res.aov.error, pairwise ~ curva*gen)
emm_gen_diam2
## $emmeans
## curva gen emmean SE df lower.CL upper.CL
## T3 CCN51 1.668 0.0808 18 1.499 1.84
## T1 CCN51 1.796 0.0808 18 1.626 1.97
## T2 CCN51 1.529 0.0808 18 1.360 1.70
## T3 ICS95 1.467 0.0808 18 1.297 1.64
## T1 ICS95 1.092 0.0808 18 0.922 1.26
## T2 ICS95 0.937 0.0808 18 0.768 1.11
## T3 TCS01 1.115 0.0808 18 0.946 1.29
## T1 TCS01 1.136 0.0808 18 0.966 1.31
## T2 TCS01 1.259 0.0808 18 1.089 1.43
##
## Confidence level used: 0.95
##
## $contrasts
## contrast estimate SE df t.ratio p.value
## T3 CCN51 - T1 CCN51 -0.1277 0.114 18 -1.118 0.9636
## T3 CCN51 - T2 CCN51 0.1388 0.114 18 1.215 0.9426
## T3 CCN51 - T3 ICS95 0.2016 0.114 18 1.765 0.7024
## T3 CCN51 - T1 ICS95 0.5763 0.114 18 5.046 0.0021
## T3 CCN51 - T2 ICS95 0.7308 0.114 18 6.399 0.0001
## T3 CCN51 - T3 TCS01 0.5528 0.114 18 4.840 0.0033
## T3 CCN51 - T1 TCS01 0.5326 0.114 18 4.664 0.0047
## T3 CCN51 - T2 TCS01 0.4092 0.114 18 3.582 0.0429
## T1 CCN51 - T2 CCN51 0.2665 0.114 18 2.333 0.3733
## T1 CCN51 - T3 ICS95 0.3292 0.114 18 2.883 0.1581
## T1 CCN51 - T1 ICS95 0.7040 0.114 18 6.164 0.0002
## T1 CCN51 - T2 ICS95 0.8585 0.114 18 7.517 <.0001
## T1 CCN51 - T3 TCS01 0.6805 0.114 18 5.958 0.0003
## T1 CCN51 - T1 TCS01 0.6603 0.114 18 5.781 0.0005
## T1 CCN51 - T2 TCS01 0.5368 0.114 18 4.700 0.0044
## T2 CCN51 - T3 ICS95 0.0628 0.114 18 0.549 0.9997
## T2 CCN51 - T1 ICS95 0.4375 0.114 18 3.831 0.0261
## T2 CCN51 - T2 ICS95 0.5920 0.114 18 5.184 0.0016
## T2 CCN51 - T3 TCS01 0.4140 0.114 18 3.625 0.0394
## T2 CCN51 - T1 TCS01 0.3938 0.114 18 3.448 0.0557
## T2 CCN51 - T2 TCS01 0.2704 0.114 18 2.367 0.3563
## T3 ICS95 - T1 ICS95 0.3747 0.114 18 3.281 0.0768
## T3 ICS95 - T2 ICS95 0.5293 0.114 18 4.634 0.0050
## T3 ICS95 - T3 TCS01 0.3513 0.114 18 3.075 0.1124
## T3 ICS95 - T1 TCS01 0.3311 0.114 18 2.899 0.1538
## T3 ICS95 - T2 TCS01 0.2076 0.114 18 1.818 0.6715
## T1 ICS95 - T2 ICS95 0.1545 0.114 18 1.353 0.9012
## T1 ICS95 - T3 TCS01 -0.0235 0.114 18 -0.206 1.0000
## T1 ICS95 - T1 TCS01 -0.0437 0.114 18 -0.382 1.0000
## T1 ICS95 - T2 TCS01 -0.1672 0.114 18 -1.464 0.8579
## T2 ICS95 - T3 TCS01 -0.1780 0.114 18 -1.559 0.8140
## T2 ICS95 - T1 TCS01 -0.1982 0.114 18 -1.735 0.7194
## T2 ICS95 - T2 TCS01 -0.3217 0.114 18 -2.816 0.1771
## T3 TCS01 - T1 TCS01 -0.0202 0.114 18 -0.177 1.0000
## T3 TCS01 - T2 TCS01 -0.1437 0.114 18 -1.258 0.9313
## T1 TCS01 - T2 TCS01 -0.1235 0.114 18 -1.081 0.9699
##
## P value adjustment: tukey method for comparing a family of 9 estimates
emm_gen_diam2_trend <- emmeans(res.aov.error, pairwise ~ gen)
## NOTE: Results may be misleading due to involvement in interactions
emm_gen_diam2_trend
## $emmeans
## gen emmean SE df lower.CL upper.CL
## CCN51 1.66 0.0466 18 1.57 1.76
## ICS95 1.17 0.0466 18 1.07 1.26
## TCS01 1.17 0.0466 18 1.07 1.27
##
## Results are averaged over the levels of: curva
## Confidence level used: 0.95
##
## $contrasts
## contrast estimate SE df t.ratio p.value
## CCN51 - ICS95 0.4992 0.0659 18 7.570 <.0001
## CCN51 - TCS01 0.4945 0.0659 18 7.499 <.0001
## ICS95 - TCS01 -0.0047 0.0659 18 -0.071 0.9972
##
## Results are averaged over the levels of: curva
## P value adjustment: tukey method for comparing a family of 3 estimates
## PI-ITF
##Summary statistics
summ<-datos %>%
group_by(curva, gen) %>%
get_summary_stats(pi.tf, type = "mean_sd")
summ %>% as_tibble() %>% print(n=Inf)
## # A tibble: 9 × 6
## curva gen variable n mean sd
## <fct> <fct> <chr> <dbl> <dbl> <dbl>
## 1 T3 CCN51 pi.tf 3 2.90 0.49
## 2 T3 ICS95 pi.tf 3 2.14 0.538
## 3 T3 TCS01 pi.tf 3 2.77 0.546
## 4 T1 CCN51 pi.tf 3 2.19 1.44
## 5 T1 ICS95 pi.tf 3 0.713 0.058
## 6 T1 TCS01 pi.tf 3 1.36 0.569
## 7 T2 CCN51 pi.tf 3 1.18 0.027
## 8 T2 ICS95 pi.tf 3 0.655 0.171
## 9 T2 TCS01 pi.tf 3 1.8 0.499
##Visualization
bxp <- ggboxplot(
datos, x = "curva", y = "pi.tf",
palette = "jco",
color = "gen", xlab = "Treatment", ylab = "PI-ITF", legend.title = "Genotype"
)
bxp

##Check assumptions
##Outliers
datos %>%
group_by(curva, gen) %>%
identify_outliers(pi.tf)
## [1] curva gen ids trat muestra
## [6] id dia diam2 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) %>%
shapiro_test(pi.tf)
norm %>% as_tibble() %>% print(n=Inf)
## # A tibble: 9 × 5
## curva gen variable statistic p
## <fct> <fct> <chr> <dbl> <dbl>
## 1 T3 CCN51 pi.tf 0.998 0.922
## 2 T3 ICS95 pi.tf 0.982 0.743
## 3 T3 TCS01 pi.tf 0.960 0.615
## 4 T1 CCN51 pi.tf 0.840 0.213
## 5 T1 ICS95 pi.tf 0.793 0.0980
## 6 T1 TCS01 pi.tf 0.844 0.225
## 7 T2 CCN51 pi.tf 0.975 0.700
## 8 T2 ICS95 pi.tf 0.978 0.715
## 9 T2 TCS01 pi.tf 0.939 0.522
##Create QQ plot for each cell of design:
ggqqplot(datos, "pi.tf", ggtheme = theme_bw()) +
facet_grid(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?

##Homogneity of variance assumption
##Compute the Levene’s test at each level of the within-subjects factor, here time variable:
lev<-datos %>%
group_by(curva) %>%
levene_test(pi.tf ~ gen)
lev %>% as_tibble() %>% print(n=Inf)
## # A tibble: 3 × 5
## curva df1 df2 statistic p
## <fct> <int> <int> <dbl> <dbl>
## 1 T3 2 6 0.00808 0.992
## 2 T1 2 6 0.900 0.455
## 3 T2 2 6 1.61 0.275
#Table by error
res.aov.error <- aov(pi.tf ~ curva*gen, datos)
summary(res.aov.error)
## Df Sum Sq Mean Sq F value Pr(>F)
## curva 2 10.145 5.073 13.072 0.000312 ***
## gen 2 4.505 2.252 5.804 0.011343 *
## curva:gen 4 1.716 0.429 1.106 0.384207
## Residuals 18 6.985 0.388
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## Emmeans
emmip(res.aov.error, gen ~ curva)

emm_curva <- emmeans(res.aov.error, pairwise ~ curva)
## NOTE: Results may be misleading due to involvement in interactions
emm_curva
## $emmeans
## curva emmean SE df lower.CL upper.CL
## T3 2.60 0.208 18 2.167 3.04
## T1 1.42 0.208 18 0.984 1.86
## T2 1.21 0.208 18 0.775 1.65
##
## Results are averaged over the levels of: gen
## Confidence level used: 0.95
##
## $contrasts
## contrast estimate SE df t.ratio p.value
## T3 - T1 1.183 0.294 18 4.029 0.0022
## T3 - T2 1.392 0.294 18 4.741 0.0005
## T1 - T2 0.209 0.294 18 0.711 0.7601
##
## Results are averaged over the levels of: gen
## P value adjustment: tukey method for comparing a family of 3 estimates
emm_gen_curva <- emmeans(res.aov.error, pairwise ~ gen | curva)
emm_gen_curva
## $emmeans
## curva = T3:
## gen emmean SE df lower.CL upper.CL
## CCN51 2.895 0.36 18 2.1398 3.65
## ICS95 2.144 0.36 18 1.3880 2.90
## TCS01 2.771 0.36 18 2.0153 3.53
##
## curva = T1:
## gen emmean SE df lower.CL upper.CL
## CCN51 2.187 0.36 18 1.4318 2.94
## ICS95 0.713 0.36 18 -0.0423 1.47
## TCS01 1.359 0.36 18 0.6038 2.12
##
## curva = T2:
## gen emmean SE df lower.CL upper.CL
## CCN51 1.178 0.36 18 0.4227 1.93
## ICS95 0.655 0.36 18 -0.1004 1.41
## TCS01 1.800 0.36 18 1.0444 2.56
##
## Confidence level used: 0.95
##
## $contrasts
## curva = T3:
## contrast estimate SE df t.ratio p.value
## CCN51 - ICS95 0.752 0.509 18 1.478 0.3243
## CCN51 - TCS01 0.125 0.509 18 0.245 0.9676
## ICS95 - TCS01 -0.627 0.509 18 -1.233 0.4496
##
## curva = T1:
## contrast estimate SE df t.ratio p.value
## CCN51 - ICS95 1.474 0.509 18 2.898 0.0247
## CCN51 - TCS01 0.828 0.509 18 1.628 0.2599
## ICS95 - TCS01 -0.646 0.509 18 -1.270 0.4293
##
## curva = T2:
## contrast estimate SE df t.ratio p.value
## CCN51 - ICS95 0.523 0.509 18 1.028 0.5691
## CCN51 - TCS01 -0.622 0.509 18 -1.222 0.4557
## ICS95 - TCS01 -1.145 0.509 18 -2.251 0.0894
##
## P value adjustment: tukey method for comparing a family of 3 estimates
emm_gen_diam2 <- emmeans(res.aov.error, pairwise ~ curva*gen)
emm_gen_diam2
## $emmeans
## curva gen emmean SE df lower.CL upper.CL
## T3 CCN51 2.895 0.36 18 2.1398 3.65
## T1 CCN51 2.187 0.36 18 1.4318 2.94
## T2 CCN51 1.178 0.36 18 0.4227 1.93
## T3 ICS95 2.144 0.36 18 1.3880 2.90
## T1 ICS95 0.713 0.36 18 -0.0423 1.47
## T2 ICS95 0.655 0.36 18 -0.1004 1.41
## T3 TCS01 2.771 0.36 18 2.0153 3.53
## T1 TCS01 1.359 0.36 18 0.6038 2.12
## T2 TCS01 1.800 0.36 18 1.0444 2.56
##
## Confidence level used: 0.95
##
## $contrasts
## contrast estimate SE df t.ratio p.value
## T3 CCN51 - T1 CCN51 0.7081 0.509 18 1.392 0.8869
## T3 CCN51 - T2 CCN51 1.7172 0.509 18 3.376 0.0641
## T3 CCN51 - T3 ICS95 0.7519 0.509 18 1.478 0.8515
## T3 CCN51 - T1 ICS95 2.1821 0.509 18 4.290 0.0102
## T3 CCN51 - T2 ICS95 2.2402 0.509 18 4.404 0.0081
## T3 CCN51 - T3 TCS01 0.1245 0.509 18 0.245 1.0000
## T3 CCN51 - T1 TCS01 1.5361 0.509 18 3.020 0.1242
## T3 CCN51 - T2 TCS01 1.0954 0.509 18 2.154 0.4712
## T1 CCN51 - T2 CCN51 1.0091 0.509 18 1.984 0.5714
## T1 CCN51 - T3 ICS95 0.0438 0.509 18 0.086 1.0000
## T1 CCN51 - T1 ICS95 1.4741 0.509 18 2.898 0.1540
## T1 CCN51 - T2 ICS95 1.5322 0.509 18 3.012 0.1259
## T1 CCN51 - T3 TCS01 -0.5835 0.509 18 -1.147 0.9580
## T1 CCN51 - T1 TCS01 0.8280 0.509 18 1.628 0.7787
## T1 CCN51 - T2 TCS01 0.3873 0.509 18 0.762 0.9967
## T2 CCN51 - T3 ICS95 -0.9653 0.509 18 -1.898 0.6234
## T2 CCN51 - T1 ICS95 0.4650 0.509 18 0.914 0.9891
## T2 CCN51 - T2 ICS95 0.5231 0.509 18 1.028 0.9775
## T2 CCN51 - T3 TCS01 -1.5926 0.509 18 -3.131 0.1015
## T2 CCN51 - T1 TCS01 -0.1811 0.509 18 -0.356 1.0000
## T2 CCN51 - T2 TCS01 -0.6218 0.509 18 -1.222 0.9408
## T3 ICS95 - T1 ICS95 1.4303 0.509 18 2.812 0.1785
## T3 ICS95 - T2 ICS95 1.4884 0.509 18 2.926 0.1466
## T3 ICS95 - T3 TCS01 -0.6274 0.509 18 -1.233 0.9379
## T3 ICS95 - T1 TCS01 0.7842 0.509 18 1.542 0.8222
## T3 ICS95 - T2 TCS01 0.3435 0.509 18 0.675 0.9986
## T1 ICS95 - T2 ICS95 0.0581 0.509 18 0.114 1.0000
## T1 ICS95 - T3 TCS01 -2.0576 0.509 18 -4.045 0.0169
## T1 ICS95 - T1 TCS01 -0.6461 0.509 18 -1.270 0.9277
## T1 ICS95 - T2 TCS01 -1.0867 0.509 18 -2.137 0.4810
## T2 ICS95 - T3 TCS01 -2.1157 0.509 18 -4.160 0.0133
## T2 ICS95 - T1 TCS01 -0.7042 0.509 18 -1.384 0.8897
## T2 ICS95 - T2 TCS01 -1.1448 0.509 18 -2.251 0.4168
## T3 TCS01 - T1 TCS01 1.4115 0.509 18 2.775 0.1899
## T3 TCS01 - T2 TCS01 0.9709 0.509 18 1.909 0.6168
## T1 TCS01 - T2 TCS01 -0.4407 0.509 18 -0.866 0.9922
##
## P value adjustment: tukey method for comparing a family of 9 estimates
emm_gen_diam2_trend <- emmeans(res.aov.error, pairwise ~ gen)
## NOTE: Results may be misleading due to involvement in interactions
emm_gen_diam2_trend
## $emmeans
## gen emmean SE df lower.CL upper.CL
## CCN51 2.09 0.208 18 1.651 2.52
## ICS95 1.17 0.208 18 0.734 1.61
## TCS01 1.98 0.208 18 1.541 2.41
##
## Results are averaged over the levels of: curva
## Confidence level used: 0.95
##
## $contrasts
## contrast estimate SE df t.ratio p.value
## CCN51 - ICS95 0.916 0.294 18 3.120 0.0155
## CCN51 - TCS01 0.110 0.294 18 0.375 0.9256
## ICS95 - TCS01 -0.806 0.294 18 -2.745 0.0339
##
## Results are averaged over the levels of: curva
## P value adjustment: tukey method for comparing a family of 3 estimates
## PD-Cd
##Summary statistics
summ<-datos %>%
group_by(curva, gen) %>%
get_summary_stats(pdcd.grano, type = "mean_sd")
summ %>% as_tibble() %>% print(n=Inf)
## # A tibble: 9 × 6
## curva gen variable n mean sd
## <fct> <fct> <chr> <dbl> <dbl> <dbl>
## 1 T3 CCN51 pdcd.grano 3 -0.153 0.063
## 2 T3 ICS95 pdcd.grano 3 -0.131 0.086
## 3 T3 TCS01 pdcd.grano 3 -0.26 0.098
## 4 T1 CCN51 pdcd.grano 3 -0.193 0.05
## 5 T1 ICS95 pdcd.grano 3 -0.128 0.055
## 6 T1 TCS01 pdcd.grano 3 -0.154 0.139
## 7 T2 CCN51 pdcd.grano 3 -0.216 0.079
## 8 T2 ICS95 pdcd.grano 3 -0.113 0.061
## 9 T2 TCS01 pdcd.grano 3 -0.256 0.018
##Visualization
bxp <- ggboxplot(
datos, x = "curva", y = "pdcd.grano",
palette = "jco",
color = "gen", xlab = "Treatment", ylab = "PD-Cd", legend.title = "Genotype"
)
bxp

##Check assumptions
##Outliers
datos %>%
group_by(curva, gen) %>%
identify_outliers(pdcd.grano)
## [1] curva gen ids trat muestra
## [6] id dia diam2 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) %>%
shapiro_test(pdcd.grano)
norm %>% as_tibble() %>% print(n=Inf)
## # A tibble: 9 × 5
## curva gen variable statistic p
## <fct> <fct> <chr> <dbl> <dbl>
## 1 T3 CCN51 pdcd.grano 0.990 0.805
## 2 T3 ICS95 pdcd.grano 0.907 0.407
## 3 T3 TCS01 pdcd.grano 1.00 0.996
## 4 T1 CCN51 pdcd.grano 0.952 0.580
## 5 T1 ICS95 pdcd.grano 0.998 0.909
## 6 T1 TCS01 pdcd.grano 0.975 0.698
## 7 T2 CCN51 pdcd.grano 0.957 0.600
## 8 T2 ICS95 pdcd.grano 0.803 0.121
## 9 T2 TCS01 pdcd.grano 0.994 0.853
##Create QQ plot for each cell of design:
ggqqplot(datos, "pdcd.grano", ggtheme = theme_bw()) +
facet_grid(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?

##Homogneity of variance assumption
##Compute the Levene’s test at each level of the within-subjects factor, here time variable:
lev<-datos %>%
group_by(curva) %>%
levene_test(pdcd.grano ~ gen)
lev %>% as_tibble() %>% print(n=Inf)
## # A tibble: 3 × 5
## curva df1 df2 statistic p
## <fct> <int> <int> <dbl> <dbl>
## 1 T3 2 6 0.139 0.873
## 2 T1 2 6 0.999 0.422
## 3 T2 2 6 0.582 0.588
#Table by error
res.aov.error <- aov(pdcd.grano ~ curva*gen, datos)
summary(res.aov.error)
## Df Sum Sq Mean Sq F value Pr(>F)
## curva 2 0.00610 0.003048 0.491 0.6199
## gen 2 0.04541 0.022703 3.658 0.0464 *
## curva:gen 4 0.02227 0.005568 0.897 0.4860
## Residuals 18 0.11170 0.006206
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## Emmeans
emmip(res.aov.error, gen ~ curva)

emm_curva <- emmeans(res.aov.error, pairwise ~ curva)
## NOTE: Results may be misleading due to involvement in interactions
emm_curva
## $emmeans
## curva emmean SE df lower.CL upper.CL
## T3 -0.181 0.0263 18 -0.236 -0.126
## T1 -0.158 0.0263 18 -0.213 -0.103
## T2 -0.195 0.0263 18 -0.250 -0.140
##
## Results are averaged over the levels of: gen
## Confidence level used: 0.95
##
## $contrasts
## contrast estimate SE df t.ratio p.value
## T3 - T1 -0.0228 0.0371 18 -0.614 0.8145
## T3 - T2 0.0136 0.0371 18 0.367 0.9287
## T1 - T2 0.0364 0.0371 18 0.981 0.5979
##
## Results are averaged over the levels of: gen
## P value adjustment: tukey method for comparing a family of 3 estimates
emm_gen_curva <- emmeans(res.aov.error, pairwise ~ gen | curva)
emm_gen_curva
## $emmeans
## curva = T3:
## gen emmean SE df lower.CL upper.CL
## CCN51 -0.153 0.0455 18 -0.248 -0.0572
## ICS95 -0.131 0.0455 18 -0.226 -0.0351
## TCS01 -0.260 0.0455 18 -0.355 -0.1642
##
## curva = T1:
## gen emmean SE df lower.CL upper.CL
## CCN51 -0.193 0.0455 18 -0.288 -0.0973
## ICS95 -0.128 0.0455 18 -0.224 -0.0328
## TCS01 -0.154 0.0455 18 -0.249 -0.0582
##
## curva = T2:
## gen emmean SE df lower.CL upper.CL
## CCN51 -0.216 0.0455 18 -0.312 -0.1205
## ICS95 -0.113 0.0455 18 -0.208 -0.0170
## TCS01 -0.256 0.0455 18 -0.351 -0.1600
##
## Confidence level used: 0.95
##
## $contrasts
## curva = T3:
## contrast estimate SE df t.ratio p.value
## CCN51 - ICS95 -0.0221 0.0643 18 -0.343 0.9373
## CCN51 - TCS01 0.1070 0.0643 18 1.664 0.2460
## ICS95 - TCS01 0.1291 0.0643 18 2.007 0.1392
##
## curva = T1:
## contrast estimate SE df t.ratio p.value
## CCN51 - ICS95 -0.0645 0.0643 18 -1.003 0.5847
## CCN51 - TCS01 -0.0391 0.0643 18 -0.607 0.8179
## ICS95 - TCS01 0.0254 0.0643 18 0.395 0.9179
##
## curva = T2:
## contrast estimate SE df t.ratio p.value
## CCN51 - ICS95 -0.1036 0.0643 18 -1.610 0.2670
## CCN51 - TCS01 0.0395 0.0643 18 0.614 0.8146
## ICS95 - TCS01 0.1430 0.0643 18 2.224 0.0940
##
## P value adjustment: tukey method for comparing a family of 3 estimates
emm_gen_diam2 <- emmeans(res.aov.error, pairwise ~ curva*gen)
emm_gen_diam2
## $emmeans
## curva gen emmean SE df lower.CL upper.CL
## T3 CCN51 -0.153 0.0455 18 -0.248 -0.0572
## T1 CCN51 -0.193 0.0455 18 -0.288 -0.0973
## T2 CCN51 -0.216 0.0455 18 -0.312 -0.1205
## T3 ICS95 -0.131 0.0455 18 -0.226 -0.0351
## T1 ICS95 -0.128 0.0455 18 -0.224 -0.0328
## T2 ICS95 -0.113 0.0455 18 -0.208 -0.0170
## T3 TCS01 -0.260 0.0455 18 -0.355 -0.1642
## T1 TCS01 -0.154 0.0455 18 -0.249 -0.0582
## T2 TCS01 -0.256 0.0455 18 -0.351 -0.1600
##
## Confidence level used: 0.95
##
## $contrasts
## contrast estimate SE df t.ratio p.value
## T3 CCN51 - T1 CCN51 0.040036 0.0643 18 0.622 0.9992
## T3 CCN51 - T2 CCN51 0.063310 0.0643 18 0.984 0.9827
## T3 CCN51 - T3 ICS95 -0.022077 0.0643 18 -0.343 1.0000
## T3 CCN51 - T1 ICS95 -0.024452 0.0643 18 -0.380 1.0000
## T3 CCN51 - T2 ICS95 -0.040265 0.0643 18 -0.626 0.9992
## T3 CCN51 - T3 TCS01 0.107009 0.0643 18 1.664 0.7595
## T3 CCN51 - T1 TCS01 0.000965 0.0643 18 0.015 1.0000
## T3 CCN51 - T2 TCS01 0.102773 0.0643 18 1.598 0.7943
## T1 CCN51 - T2 CCN51 0.023274 0.0643 18 0.362 1.0000
## T1 CCN51 - T3 ICS95 -0.062113 0.0643 18 -0.966 0.9846
## T1 CCN51 - T1 ICS95 -0.064488 0.0643 18 -1.003 0.9807
## T1 CCN51 - T2 ICS95 -0.080301 0.0643 18 -1.248 0.9339
## T1 CCN51 - T3 TCS01 0.066973 0.0643 18 1.041 0.9758
## T1 CCN51 - T1 TCS01 -0.039071 0.0643 18 -0.607 0.9993
## T1 CCN51 - T2 TCS01 0.062737 0.0643 18 0.975 0.9837
## T2 CCN51 - T3 ICS95 -0.085387 0.0643 18 -1.328 0.9099
## T2 CCN51 - T1 ICS95 -0.087762 0.0643 18 -1.364 0.8971
## T2 CCN51 - T2 ICS95 -0.103575 0.0643 18 -1.610 0.7879
## T2 CCN51 - T3 TCS01 0.043699 0.0643 18 0.679 0.9985
## T2 CCN51 - T1 TCS01 -0.062345 0.0643 18 -0.969 0.9843
## T2 CCN51 - T2 TCS01 0.039463 0.0643 18 0.614 0.9993
## T3 ICS95 - T1 ICS95 -0.002375 0.0643 18 -0.037 1.0000
## T3 ICS95 - T2 ICS95 -0.018188 0.0643 18 -0.283 1.0000
## T3 ICS95 - T3 TCS01 0.129086 0.0643 18 2.007 0.5576
## T3 ICS95 - T1 TCS01 0.023042 0.0643 18 0.358 1.0000
## T3 ICS95 - T2 TCS01 0.124850 0.0643 18 1.941 0.5973
## T1 ICS95 - T2 ICS95 -0.015813 0.0643 18 -0.246 1.0000
## T1 ICS95 - T3 TCS01 0.131461 0.0643 18 2.044 0.5355
## T1 ICS95 - T1 TCS01 0.025417 0.0643 18 0.395 1.0000
## T1 ICS95 - T2 TCS01 0.127225 0.0643 18 1.978 0.5750
## T2 ICS95 - T3 TCS01 0.147274 0.0643 18 2.290 0.3960
## T2 ICS95 - T1 TCS01 0.041230 0.0643 18 0.641 0.9990
## T2 ICS95 - T2 TCS01 0.143038 0.0643 18 2.224 0.4316
## T3 TCS01 - T1 TCS01 -0.106044 0.0643 18 -1.649 0.7676
## T3 TCS01 - T2 TCS01 -0.004236 0.0643 18 -0.066 1.0000
## T1 TCS01 - T2 TCS01 0.101808 0.0643 18 1.583 0.8019
##
## P value adjustment: tukey method for comparing a family of 9 estimates
emm_gen_diam2_trend <- emmeans(res.aov.error, pairwise ~ gen)
## NOTE: Results may be misleading due to involvement in interactions
emm_gen_diam2_trend
## $emmeans
## gen emmean SE df lower.CL upper.CL
## CCN51 -0.187 0.0263 18 -0.242 -0.1321
## ICS95 -0.124 0.0263 18 -0.179 -0.0687
## TCS01 -0.223 0.0263 18 -0.278 -0.1679
##
## Results are averaged over the levels of: curva
## Confidence level used: 0.95
##
## $contrasts
## contrast estimate SE df t.ratio p.value
## CCN51 - ICS95 -0.0634 0.0371 18 -1.707 0.2299
## CCN51 - TCS01 0.0358 0.0371 18 0.964 0.6081
## ICS95 - TCS01 0.0992 0.0371 18 2.671 0.0394
##
## Results are averaged over the levels of: curva
## P value adjustment: tukey method for comparing a family of 3 estimates
## PI-Cd
##Summary statistics
summ<-datos %>%
group_by(curva, gen) %>%
get_summary_stats(picd.testa, type = "mean_sd")
summ %>% as_tibble() %>% print(n=Inf)
## # A tibble: 9 × 6
## curva gen variable n mean sd
## <fct> <fct> <chr> <dbl> <dbl> <dbl>
## 1 T3 CCN51 picd.testa 3 2.28 0.171
## 2 T3 ICS95 picd.testa 3 1.70 0.243
## 3 T3 TCS01 picd.testa 3 1.80 0.597
## 4 T1 CCN51 picd.testa 3 1.54 1.01
## 5 T1 ICS95 picd.testa 3 0.493 0.104
## 6 T1 TCS01 picd.testa 3 0.945 0.137
## 7 T2 CCN51 picd.testa 3 0.707 0.159
## 8 T2 ICS95 picd.testa 3 0.462 0.062
## 9 T2 TCS01 picd.testa 3 1.08 0.319
##Visualization
bxp <- ggboxplot(
datos, x = "curva", y = "picd.testa",
palette = "jco",
color = "gen", xlab = "Treatment", ylab = "PI-Cd", legend.title = "Genotype"
)
bxp

##Check assumptions
##Outliers
datos %>%
group_by(curva, gen) %>%
identify_outliers(picd.testa)
## [1] curva gen ids trat muestra
## [6] id dia diam2 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) %>%
shapiro_test(picd.testa)
norm %>% as_tibble() %>% print(n=Inf)
## # A tibble: 9 × 5
## curva gen variable statistic p
## <fct> <fct> <chr> <dbl> <dbl>
## 1 T3 CCN51 picd.testa 0.977 0.711
## 2 T3 ICS95 picd.testa 0.761 0.0243
## 3 T3 TCS01 picd.testa 0.867 0.287
## 4 T1 CCN51 picd.testa 0.794 0.101
## 5 T1 ICS95 picd.testa 0.803 0.121
## 6 T1 TCS01 picd.testa 0.948 0.561
## 7 T2 CCN51 picd.testa 0.991 0.814
## 8 T2 ICS95 picd.testa 0.809 0.137
## 9 T2 TCS01 picd.testa 0.932 0.496
##Create QQ plot for each cell of design:
ggqqplot(datos, "picd.testa", ggtheme = theme_bw()) +
facet_grid(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?

##Homogneity of variance assumption
##Compute the Levene’s test at each level of the within-subjects factor, here time variable:
lev<-datos %>%
group_by(curva) %>%
levene_test(picd.testa ~ gen)
lev %>% as_tibble() %>% print(n=Inf)
## # A tibble: 3 × 5
## curva df1 df2 statistic p
## <fct> <int> <int> <dbl> <dbl>
## 1 T3 2 6 0.573 0.592
## 2 T1 2 6 0.901 0.455
## 3 T2 2 6 0.991 0.425
#Table by error
res.aov.error <- aov(picd.testa ~ curva*gen, datos)
summary(res.aov.error)
## Df Sum Sq Mean Sq F value Pr(>F)
## curva 2 6.991 3.496 19.376 3.25e-05 ***
## gen 2 1.768 0.884 4.900 0.020 *
## curva:gen 4 1.013 0.253 1.404 0.272
## Residuals 18 3.247 0.180
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## Emmeans
emmip(res.aov.error, gen ~ curva)

emm_curva <- emmeans(res.aov.error, pairwise ~ curva)
## NOTE: Results may be misleading due to involvement in interactions
emm_curva
## $emmeans
## curva emmean SE df lower.CL upper.CL
## T3 1.929 0.142 18 1.632 2.23
## T1 0.991 0.142 18 0.694 1.29
## T2 0.749 0.142 18 0.452 1.05
##
## Results are averaged over the levels of: gen
## Confidence level used: 0.95
##
## $contrasts
## contrast estimate SE df t.ratio p.value
## T3 - T1 0.938 0.2 18 4.685 0.0005
## T3 - T2 1.180 0.2 18 5.893 <.0001
## T1 - T2 0.242 0.2 18 1.208 0.4639
##
## Results are averaged over the levels of: gen
## P value adjustment: tukey method for comparing a family of 3 estimates
emm_gen_curva <- emmeans(res.aov.error, pairwise ~ gen | curva)
emm_gen_curva
## $emmeans
## curva = T3:
## gen emmean SE df lower.CL upper.CL
## CCN51 2.280 0.245 18 1.7646 2.795
## ICS95 1.705 0.245 18 1.1898 2.220
## TCS01 1.802 0.245 18 1.2873 2.318
##
## curva = T1:
## gen emmean SE df lower.CL upper.CL
## CCN51 1.535 0.245 18 1.0194 2.050
## ICS95 0.493 0.245 18 -0.0219 1.008
## TCS01 0.945 0.245 18 0.4303 1.461
##
## curva = T2:
## gen emmean SE df lower.CL upper.CL
## CCN51 0.707 0.245 18 0.1916 1.222
## ICS95 0.462 0.245 18 -0.0528 0.978
## TCS01 1.079 0.245 18 0.5634 1.594
##
## Confidence level used: 0.95
##
## $contrasts
## curva = T3:
## contrast estimate SE df t.ratio p.value
## CCN51 - ICS95 0.5748 0.347 18 1.657 0.2483
## CCN51 - TCS01 0.4773 0.347 18 1.376 0.3736
## ICS95 - TCS01 -0.0975 0.347 18 -0.281 0.9575
##
## curva = T1:
## contrast estimate SE df t.ratio p.value
## CCN51 - ICS95 1.0413 0.347 18 3.003 0.0199
## CCN51 - TCS01 0.5891 0.347 18 1.699 0.2329
## ICS95 - TCS01 -0.4522 0.347 18 -1.304 0.4111
##
## curva = T2:
## contrast estimate SE df t.ratio p.value
## CCN51 - ICS95 0.2444 0.347 18 0.705 0.7637
## CCN51 - TCS01 -0.3718 0.347 18 -1.072 0.5429
## ICS95 - TCS01 -0.6162 0.347 18 -1.777 0.2054
##
## P value adjustment: tukey method for comparing a family of 3 estimates
emm_gen_diam2 <- emmeans(res.aov.error, pairwise ~ curva*gen)
emm_gen_diam2
## $emmeans
## curva gen emmean SE df lower.CL upper.CL
## T3 CCN51 2.280 0.245 18 1.7646 2.795
## T1 CCN51 1.535 0.245 18 1.0194 2.050
## T2 CCN51 0.707 0.245 18 0.1916 1.222
## T3 ICS95 1.705 0.245 18 1.1898 2.220
## T1 ICS95 0.493 0.245 18 -0.0219 1.008
## T2 ICS95 0.462 0.245 18 -0.0528 0.978
## T3 TCS01 1.802 0.245 18 1.2873 2.318
## T1 TCS01 0.945 0.245 18 0.4303 1.461
## T2 TCS01 1.079 0.245 18 0.5634 1.594
##
## Confidence level used: 0.95
##
## $contrasts
## contrast estimate SE df t.ratio p.value
## T3 CCN51 - T1 CCN51 0.7453 0.347 18 2.149 0.4738
## T3 CCN51 - T2 CCN51 1.5730 0.347 18 4.536 0.0061
## T3 CCN51 - T3 ICS95 0.5748 0.347 18 1.657 0.7628
## T3 CCN51 - T1 ICS95 1.7866 0.347 18 5.152 0.0017
## T3 CCN51 - T2 ICS95 1.8174 0.347 18 5.241 0.0014
## T3 CCN51 - T3 TCS01 0.4773 0.347 18 1.376 0.8927
## T3 CCN51 - T1 TCS01 1.3343 0.347 18 3.848 0.0252
## T3 CCN51 - T2 TCS01 1.2012 0.347 18 3.464 0.0541
## T1 CCN51 - T2 CCN51 0.8277 0.347 18 2.387 0.3465
## T1 CCN51 - T3 ICS95 -0.1704 0.347 18 -0.491 0.9999
## T1 CCN51 - T1 ICS95 1.0413 0.347 18 3.003 0.1281
## T1 CCN51 - T2 ICS95 1.0722 0.347 18 3.092 0.1091
## T1 CCN51 - T3 TCS01 -0.2679 0.347 18 -0.773 0.9964
## T1 CCN51 - T1 TCS01 0.5891 0.347 18 1.699 0.7402
## T1 CCN51 - T2 TCS01 0.4560 0.347 18 1.315 0.9141
## T2 CCN51 - T3 ICS95 -0.9982 0.347 18 -2.878 0.1593
## T2 CCN51 - T1 ICS95 0.2136 0.347 18 0.616 0.9992
## T2 CCN51 - T2 ICS95 0.2444 0.347 18 0.705 0.9981
## T2 CCN51 - T3 TCS01 -1.0956 0.347 18 -3.159 0.0964
## T2 CCN51 - T1 TCS01 -0.2387 0.347 18 -0.688 0.9984
## T2 CCN51 - T2 TCS01 -0.3718 0.347 18 -1.072 0.9714
## T3 ICS95 - T1 ICS95 1.2118 0.347 18 3.494 0.0510
## T3 ICS95 - T2 ICS95 1.2426 0.347 18 3.583 0.0428
## T3 ICS95 - T3 TCS01 -0.0975 0.347 18 -0.281 1.0000
## T3 ICS95 - T1 TCS01 0.7595 0.347 18 2.190 0.4504
## T3 ICS95 - T2 TCS01 0.6264 0.347 18 1.806 0.6781
## T1 ICS95 - T2 ICS95 0.0309 0.347 18 0.089 1.0000
## T1 ICS95 - T3 TCS01 -1.3092 0.347 18 -3.775 0.0292
## T1 ICS95 - T1 TCS01 -0.4522 0.347 18 -1.304 0.9175
## T1 ICS95 - T2 TCS01 -0.5853 0.347 18 -1.688 0.7462
## T2 ICS95 - T3 TCS01 -1.3401 0.347 18 -3.864 0.0244
## T2 ICS95 - T1 TCS01 -0.4831 0.347 18 -1.393 0.8865
## T2 ICS95 - T2 TCS01 -0.6162 0.347 18 -1.777 0.6954
## T3 TCS01 - T1 TCS01 0.8570 0.347 18 2.471 0.3067
## T3 TCS01 - T2 TCS01 0.7239 0.347 18 2.087 0.5097
## T1 TCS01 - T2 TCS01 -0.1331 0.347 18 -0.384 1.0000
##
## P value adjustment: tukey method for comparing a family of 9 estimates
emm_gen_diam2_trend <- emmeans(res.aov.error, pairwise ~ gen)
## NOTE: Results may be misleading due to involvement in interactions
emm_gen_diam2_trend
## $emmeans
## gen emmean SE df lower.CL upper.CL
## CCN51 1.507 0.142 18 1.210 1.80
## ICS95 0.887 0.142 18 0.589 1.18
## TCS01 1.276 0.142 18 0.978 1.57
##
## Results are averaged over the levels of: curva
## Confidence level used: 0.95
##
## $contrasts
## contrast estimate SE df t.ratio p.value
## CCN51 - ICS95 0.620 0.2 18 3.097 0.0163
## CCN51 - TCS01 0.232 0.2 18 1.156 0.4932
## ICS95 - TCS01 -0.389 0.2 18 -1.941 0.1561
##
## Results are averaged over the levels of: curva
## P value adjustment: tukey method for comparing a family of 3 estimates