require(readxl)
## Loading required package: readxl
## Warning: package 'readxl' was built under R version 4.0.4
require(ggplot2)
## Loading required package: ggplot2
## Warning: package 'ggplot2' was built under R version 4.0.5
require(plotly)
## Loading required package: plotly
##
## Attaching package: 'plotly'
## The following object is masked from 'package:ggplot2':
##
## last_plot
## The following object is masked from 'package:stats':
##
## filter
## The following object is masked from 'package:graphics':
##
## layout
require(emmeans)
## Loading required package: emmeans
require(multcomp)
## Loading required package: multcomp
## Warning: package 'multcomp' was built under R version 4.0.5
## Loading required package: mvtnorm
## Loading required package: survival
## Loading required package: TH.data
## Warning: package 'TH.data' was built under R version 4.0.5
## Loading required package: MASS
##
## Attaching package: 'MASS'
## The following object is masked from 'package:plotly':
##
## select
##
## Attaching package: 'TH.data'
## The following object is masked from 'package:MASS':
##
## geyser
require(tidyverse)
## Loading required package: tidyverse
## Warning: package 'tidyverse' was built under R version 4.0.5
## Error: package or namespace load failed for 'tidyverse' in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]):
## namespace 'tidyr' 1.1.2 is already loaded, but >= 1.1.3 is required
require(ggpubr)
## Loading required package: ggpubr
## Warning: package 'ggpubr' was built under R version 4.0.5
require(rstatix)
## Loading required package: rstatix
## Warning: package 'rstatix' was built under R version 4.0.5
##
## Attaching package: 'rstatix'
## The following object is masked from 'package:MASS':
##
## select
## The following object is masked from 'package:stats':
##
## filter
require(lmerTest)
## Loading required package: lmerTest
## Warning: package 'lmerTest' was built under R version 4.0.5
## Loading required package: lme4
## Loading required package: Matrix
## Registered S3 methods overwritten by 'lme4':
## method from
## cooks.distance.influence.merMod car
## influence.merMod car
## dfbeta.influence.merMod car
## dfbetas.influence.merMod car
##
## Attaching package: 'lmerTest'
## The following object is masked from 'package:lme4':
##
## lmer
## The following object is masked from 'package:stats':
##
## step
require(Rmisc)
## Loading required package: Rmisc
## Warning: package 'Rmisc' was built under R version 4.0.5
## Loading required package: lattice
## Loading required package: plyr
## Warning: package 'plyr' was built under R version 4.0.5
##
## Attaching package: 'plyr'
## The following objects are masked from 'package:rstatix':
##
## desc, mutate
## The following object is masked from 'package:ggpubr':
##
## mutate
## The following objects are masked from 'package:plotly':
##
## arrange, mutate, rename, summarise
data=read_excel("C:/Users/Valentina/Desktop/YDRAY-Dat3Way.xlsx")
data$CO2=as.factor(data$CO2)
data$id=as.factor(paste(data$Cab,"_",data$Obvs,sep=""))
names(data)[4]="Genotype"
require(ggplot2)
g1= ggplot(data,aes(CO2,y=Flushing,fill=Temp))+geom_boxplot()+facet_grid(~Genotype)+theme_bw()
g1
En la gráfica se observan diferencias entre las temperaturas principales y genotipos. Sin embargo entre losdos niveles del \(CO_2\) no se logran evidenciar fuertes diferencias.
anova=aov(Flushing~Temp*CO2*Genotype+Error(id/Genotype),data=data)
summary(anova)
##
## Error: id
## Df Sum Sq Mean Sq F value Pr(>F)
## Temp 2 698.7 349.3 61.892 2.25e-11 ***
## CO2 1 0.5 0.5 0.089 0.768
## Temp:CO2 2 16.6 8.3 1.469 0.246
## Residuals 30 169.3 5.6
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Error: id:Genotype
## Df Sum Sq Mean Sq F value Pr(>F)
## Genotype 1 88.89 88.89 12.945 0.00114 **
## Temp:Genotype 2 30.53 15.26 2.223 0.12583
## CO2:Genotype 1 0.50 0.50 0.073 0.78913
## Temp:CO2:Genotype 2 36.08 18.04 2.627 0.08882 .
## Residuals 30 206.00 6.87
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
El anova nos confirma que efectivamente existen diferencias significativas entre los niveles de la temperatura y el genotipo anidado.
bxp = ggboxplot(
data, x= "Temp", y = "Flushing",
xlab="Temp", ylab = "Flushing",
color="Temp", palette = "lancet",
facet.by = "CO2"
)
pwc = data %>%
group_by(CO2) %>%
pairwise_t_test(
Flushing~Temp, paired = TRUE,
p.adjust.method = "bonferroni"
)
pwc= pwc %>% add_xy_position(x="Temp")
bxp +
stat_pvalue_manual(pwc,tip.length = 0, hide.ns = TRUE) + labs(
subtitle = paste("Anova,","F(2)",".", "61.892,","p",".","<0.00001"),
caption = get_pwc_label(pwc)
)
Se observa en general que existen diferencias entre los niveles de temperatura indicando que a menor temperatura el Flushing disminuye. Sin embargo es más marcado esta diferencia en el nivel 700 de \(CO_2\) a pesar de que la interacción no es significativa.
bxp = ggboxplot(
data, x= "Genotype", y = "Flushing",
title= "Flushing",
xlab="Genotype", ylab = "Flushing",
color="Genotype", palette = "lancet"
)
pwc = data %>%
group_by() %>%
pairwise_t_test(
Flushing~Temp, paired = TRUE,
p.adjust.method = "bonferroni"
)
pwc= pwc %>% add_xy_position(x="Genotype")
bxp +
stat_pvalue_manual(pwc,tip.length = 0, hide.ns = TRUE) + labs(
subtitle = paste("Anova,","F(2)",".", "12.945,","p",".","<0.00114"),
caption = get_pwc_label(pwc)
)
## Warning: Removed 3 rows containing non-finite values (stat_bracket).
Se observan diferencias significativas entre los genotipos indicando que el SCA06 presenta mayor niver de Flushing.
data %>%
group_by(Temp,CO2) %>%
shapiro_test(Flushing)
g1= ggplot(data,aes(x=CO2, y=NLFlush, fill=Temp))+geom_boxplot()+facet_grid(~Genotype)+ theme_bw()
g1
En la gráfica se observan diferencias entre las temperaturas principalmente y también en los Genotipos. Sin embargo entre los niveles del \(CO_2\) no se logran evidenciar fuertes diferencias.
anova=aov(NLFlush~Temp*CO2*Genotype+Error(id/Genotype),data=data)
summary(anova)
##
## Error: id
## Df Sum Sq Mean Sq F value Pr(>F)
## Temp 2 179.9 89.93 6.212 0.00553 **
## CO2 1 9.4 9.39 0.649 0.42699
## Temp:CO2 2 38.9 19.43 1.342 0.27654
## Residuals 30 434.3 14.48
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Error: id:Genotype
## Df Sum Sq Mean Sq F value Pr(>F)
## Genotype 1 117.56 117.56 13.529 0.000917 ***
## Temp:Genotype 2 46.86 23.43 2.697 0.083756 .
## CO2:Genotype 1 34.72 34.72 3.996 0.054734 .
## Temp:CO2:Genotype 2 20.19 10.10 1.162 0.326519
## Residuals 30 260.67 8.69
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
El anova nos confirma que efectivamente existen diferencias significativas entre los niveles de la temperatura y el genotipo anidado.
bxp = ggboxplot(
data, x= "Temp", y = "NLFlush",
title= "NLFlush",
xlab="Temp", ylab = "NLFlush",
color= "Temp", palette = "lancet",
facet.by= "CO2"
)
pwc = data %>%
group_by(CO2) %>%
pairwise_t_test(
NLFlush~Temp, paired = TRUE,
p.adjust.method = "bonferroni"
)
pwc= pwc %>% add_xy_position(x="Temp")
bxp +
stat_pvalue_manual(pwc,tip.length = 0, hide.ns = TRUE) + labs(
subtitle = paste("Anova,","F(2)",".", "6.212,","p",".","0.005534"),
caption = get_pwc_label(pwc)
)
Se observa en general que existen diferencias entre los niveles de temperatura indicando que a mayor temperatura el NLFlush aumenta. Sin embargo es más marcado esta diferencia en el nivel 700 de CO2 y en el otro nivel 400 no se presentan diferencias.
bxp = ggboxplot(
data, x= "Genotype", y = "NLFlush",
title= "NLFlush",
xlab="Genotype", ylab = "NLFlush",
color= "Genotype", palette = "lancet"
)
pwc = data %>%
group_by() %>%
pairwise_t_test(
NLFlush~Temp, paired = TRUE,
p.adjust.method = "bonferroni"
)
pwc= pwc %>% add_xy_position(x="Genotype")
bxp +
stat_pvalue_manual(pwc,tip.length = 0, hide.ns = TRUE) + labs(
subtitle = paste("Anova,","F(2)",".", "13.529,","p",".","0.000917"),
caption = get_pwc_label(pwc)
)
## Warning: Removed 2 rows containing non-finite values (stat_bracket).
Se observan diferencias significativas entre los genotipos indicando que el SCA06 presentan mayor nivel de NLFlush.
data %>%
group_by(Temp,CO2) %>%
shapiro_test(NLFlush)
g1=ggplot(data,aes(x=CO2,y=SD,fill=Temp))+geom_boxplot()+facet_grid(~Genotype)+ theme_bw()
g1
En la gráfica se observan diferecias entre las temperaturas en los 3 factores: temp, CO2 y Genotipo.
anova=aov(SD~Temp*CO2*Genotype+Error(id/Genotype),data=data)
summary(anova)
##
## Error: id
## Df Sum Sq Mean Sq F value Pr(>F)
## Temp 2 527672 263836 44.296 1.11e-09 ***
## CO2 1 203456 203456 34.159 2.15e-06 ***
## Temp:CO2 2 8428 4214 0.707 0.501
## Residuals 30 178687 5956
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Error: id:Genotype
## Df Sum Sq Mean Sq F value Pr(>F)
## Genotype 1 1797092 1797092 184.539 2.37e-14 ***
## Temp:Genotype 2 51165 25583 2.627 0.0889 .
## CO2:Genotype 1 2768 2768 0.284 0.5979
## Temp:CO2:Genotype 2 21846 10923 1.122 0.3390
## Residuals 30 292148 9738
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
El anova nos confirma que efectivamente existen diferencias significativas entre los niveres de los tres factores.
bxp = ggboxplot(
data, x= "CO2", y = "SD",
title= "SD",
xlab="CO2", ylab = "SD",
color= "Temp", palette = "lancet",
facet.by = "Genotype"
)
pwc = data %>%
group_by(CO2,Genotype) %>%
pairwise_t_test(
NLFlush~Temp, paired = TRUE,
p.adjust.method = "bonferroni"
)
pwc= pwc %>% add_xy_position(x="CO2")
bxp +
stat_pvalue_manual(pwc,tip.length = 0, hide.ns = TRUE) + labs(
subtitle = paste("Anova,","F(2)",".", "44.296,","p",".","<0.00001"),
caption = get_pwc_label(pwc)
)
Se observar en general que existen diferencias entre los niveles de temperatura indicando que la temperatura intermedia 33.5 presenta los mayores niveles de SD.
bxp = ggboxplot(
data, x= "Genotype", y = "SD",
title= "SD",
xlab="Genotype", ylab = "SD",
color= "Genotype", palette = "lancet"
)
pwc = data %>%
group_by() %>%
pairwise_t_test(
NLFlush~Temp, paired = TRUE,
p.adjust.method = "bonferroni"
)
pwc= pwc %>% add_xy_position(x="Genotype")
bxp +
stat_pvalue_manual(pwc,tip.length = 0, hide.ns = TRUE) + labs(
subtitle = paste("Anova,","F(2)",".", "184.539,","p",".","<0.00001"),
caption = get_pwc_label(pwc)
)
## Warning: Removed 2 rows containing non-finite values (stat_bracket).
Se observan diferencias significativas entre los genotipos indicando que el SCA06 presenta mayor nivel de SD.
data %>%
group_by(Temp,CO2) %>%
shapiro_test(SD)