Diseño factorial completo completamente al azar

Foliar brassinosteroid analogue (DI-31) sprays increase drought tolerance by improving plant growth and photosynthetic efficiency in lulo plants

library(collapsibleTree)
set.seed(2022)
riego=gl(2,60,120,c("Sequia","Normal")) 
hormona=gl(5,12,120,c("0","1","2","4","8"))
gs=c(rnorm(60,60,5),rnorm(60,250,6))  #Conductancia estomatica
df=data.frame(riego,hormona,gs)

Arbol colapsable

collapsibleTree(df,hierarchy = c("riego","hormona","gs"))

Gráfica

library(ggplot2)
library(dplyr)
## 
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
## 
##     filter, lag
## The following objects are masked from 'package:base':
## 
##     intersect, setdiff, setequal, union
df %>% 
  ggplot(aes(x=hormona,y=gs,fill=hormona))+
  facet_wrap(~riego)+
  geom_boxplot(color="black")

Separación por tratamiento segun el tipo de riego

df %>% 
  ggplot(aes(x=riego,y=gs,fill=riego))+
  facet_wrap(~hormona)+
  geom_boxplot(color="black")

Linealización del comportamiento de cada tratamiento

df %>% 
  group_by(hormona,riego) %>% 
  summarise(mean=mean(gs)) %>% 
  ggplot(aes(x=hormona,y=mean,group=riego,color=riego))+
  geom_point(size=3)+
  geom_line(size=1)
## `summarise()` has grouped output by 'hormona'. You can override using the
## `.groups` argument.

Buscando interacción entre ambos

df1=df
df1$gs=c(sort(rnorm(60,140,5)),sort(rnorm(60,150,9),decreasing = T)) 

df1 %>% 
  group_by(hormona,riego) %>% 
  summarise(mean=mean(gs)) %>% 
  ggplot(aes(x=hormona,y=mean,group=riego,color=riego))+
  geom_point(size=4)+
  geom_line(size=1)
## `summarise()` has grouped output by 'hormona'. You can override using the
## `.groups` argument.

Análisis de Varianza \[y_{ijk} = \mu+\tau_i+\theta_j+\tau\theta_{ij}+\epsilon_{ijk} \\ i: 1,2~ \text{Niveles del riego} \\ j: 1\cdots5 ~ \text{Niveles de la hormona}\\k: 1\cdots 12 ~ \text{Repeticiones} \] \[H_{01}: \mu_{riego} = \mu_{sequia}\] \[H_{02}: \mu_{0} = \mu_{1} = \mu_{2} =\mu_{4} =\mu_{8}\] \[H_{03}: \text{No hay interacción}\] Analisis de varianza sin interacción

mod1=aov(gs~riego*hormona,data = df)
summary(mod1)
##                Df  Sum Sq Mean Sq   F value Pr(>F)    
## riego           1 1097105 1097105 35485.757 <2e-16 ***
## hormona         4     164      41     1.329  0.264    
## riego:hormona   4     197      49     1.595  0.181    
## Residuals     110    3401      31                     
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
mod2=aov(gs~riego*hormona,data = df1)
summary(mod2)
##                Df Sum Sq Mean Sq F value   Pr(>F)    
## riego           1   3853    3853  1031.7  < 2e-16 ***
## hormona         4    220      55    14.7 1.19e-09 ***
## riego:hormona   4   5179    1295   346.7  < 2e-16 ***
## Residuals     110    411       4                     
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Supuestos Normalidad de residuales

shapiro.test(mod1$residuals)
## 
##  Shapiro-Wilk normality test
## 
## data:  mod1$residuals
## W = 0.98808, p-value = 0.3794
# Se cumplio el supuesto de normalidad

Homoceasticidad de varianza

plot(mod1$residuals)

# Heteroceasticidad

Ejercicio!

Variable respuesta: Aceite en semilla de uva

set.seed(2022)
asu=c(rnorm(24,5,0.8),rnorm(24,6,0.8),rnorm(24,8,0.9))
variedad=gl(3,24,72,c("v1","v2","v3"))
metodo = gl(3,8,72,c("m1","m2","m3"))
dfu= data.frame(variedad,metodo,asu)

Intente correr el análisis de varianza

collapsibleTree(dfu,hierarchy = c("variedad","metodo","asu"))
collapsibleTree(dfu,hierarchy = c("metodo","variedad","asu"))