Diseños del segundo parcial:
Factorial simple completamente al azar
Diseño factorial completo en arreglo completamente al azar (grafico de interaccion)
Diseño Factorial completo en bloques.
Diseño factorial completo en parcelas divididas.
Diseño Factorial incompleto al azar.
Para el trabajo factorial incompleto en bloques con covariables. Script plot design, buscar para el trabajo
Parcial 3: trabajo + quiz: diseño de medidas repetidas
DISEÑO FACTORIAL COMPLETO EN PARCELAS DIVIDIDAS
Es factorial completo porque todos lo tratamientos se utiliza, en este usamos Split plot design
En común en problemas de riego por goteo y fertilización, estudios de densidad de siembra, labraza, uso de maquinaria
Requiere:
dos factores o mas 2 factores
Dos aleatorizaciones
Podría necesitar bloques
MODELO ESTADISTICO
\[Y_{ijk} = \mu + \alpha_{i} + n_{k(i)} + \beta{i} + (\alpha\beta)_{ij} + \epsilon_{k(ij)}\]
media.
F1
error 1.
F2
Interacción
Error 2.
La primera aleatorizacion tiene su propio error.
Se tiene en cuenta la interaccion entre los dos factores.
la segunda aleatorización tiene también su propio error.
Por tanto el anova debe tener dos errores.
Ejemplo:
factor 1: variedad (4 niveles: V1, V2, V3, V4)
factor 2: riego (3 niveles: R1, R2, R3)
Tratamientos: 4*3 = 12
Diagrama:
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
xy= expand.grid(x=seq(6), y = seq(4))
xy = sample_frac(xy)
xy$f1 = gl (4, 6, 24, paste0 ("V", 1:4))
xy$f2 = gl (3 , 2, 24, paste0 ("R", 1:3))
xy$rep = gl (2 , 1, 24, paste0 ("r", 1:2))
xy$name = paste0 (xy$f1 , xy$f2 , xy$rep)
xy
## x y f1 f2 rep name
## 1 3 4 V1 R1 r1 V1R1r1
## 2 6 3 V1 R1 r2 V1R1r2
## 3 5 2 V1 R2 r1 V1R2r1
## 4 1 4 V1 R2 r2 V1R2r2
## 5 1 3 V1 R3 r1 V1R3r1
## 6 3 1 V1 R3 r2 V1R3r2
## 7 6 2 V2 R1 r1 V2R1r1
## 8 4 4 V2 R1 r2 V2R1r2
## 9 2 4 V2 R2 r1 V2R2r1
## 10 2 3 V2 R2 r2 V2R2r2
## 11 5 1 V2 R3 r1 V2R3r1
## 12 2 2 V2 R3 r2 V2R3r2
## 13 3 2 V3 R1 r1 V3R1r1
## 14 1 2 V3 R1 r2 V3R1r2
## 15 5 3 V3 R2 r1 V3R2r1
## 16 3 3 V3 R2 r2 V3R2r2
## 17 4 1 V3 R3 r1 V3R3r1
## 18 1 1 V3 R3 r2 V3R3r2
## 19 4 3 V4 R1 r1 V4R1r1
## 20 5 4 V4 R1 r2 V4R1r2
## 21 4 2 V4 R2 r1 V4R2r1
## 22 2 1 V4 R2 r2 V4R2r2
## 23 6 4 V4 R3 r1 V4R3r1
## 24 6 1 V4 R3 r2 V4R3r2
library(ggplot2)
ggplot(xy)+
aes(x,y, label = name, fill = f2)+
geom_tile(colourl ='white')+
geom_label(fill = 'white')+
labs(title = 'completamente al azar')
## Warning in geom_tile(colourl = "white"): Ignoring unknown parameters: `colourl`
Sin embargo el modelo anterior no nos funciona, porque primer pone la variedad y no tiene en cuenta que los sistemas de riego son mas dificiles de aleatorizar.
Para parcelas divididas organizamos el segundo factor (riego) en la parcela principal y luego aleatorizamos la variedad, que es el segundo.
Parcela principal: riego.
Subparcela: variedad.
library(dplyr)
xy = expand.grid(y = seq(4), x = seq(6))
f2 = gl(3, 8, 24, paste0('R',1:3))
lf1 = paste0('V',1:4)
f1 = c(sample(lf1),sample(lf1),
sample(lf1),sample(lf1),
sample(lf1),sample(lf1))
rep = rep(rep(paste0('r',1:2), each=4), 3)
data = data.frame(xy, f1, f2, rep)
data$name = with(data, paste0(f1, rep))
library(ggplot2)
ggplot(data)+
aes(x,y,label=name, fill=f1)+
geom_tile(color='white')+
geom_text()+
facet_wrap(~f2, scales = 'free')+
theme(axis.text = element_blank())
set.seed(123)
data$biom = rnorm(24, 8, 2)
ANALISIS DESCRIPTIVO
ggplot(data)+
aes(f1, biom, fill = f2)+
geom_boxplot()
ggplot(data)+
aes(f1, biom)+
geom_boxplot()
ggplot(data)+
aes(f2, biom, fill = f1)+
geom_boxplot()
Desde el grafico se observa la interacción
Por ahora vamos a correr el anova normal…
mod1 = aov(biom ~ f2 * f1 + Error(f2:rep), data)
## Warning in aov(biom ~ f2 * f1 + Error(f2:rep), data): Error() model is singular
summary(mod1)
##
## Error: f2:rep
## Df Sum Sq Mean Sq F value Pr(>F)
## f2 2 13.327 6.664 8.078 0.062 .
## Residuals 3 2.475 0.825
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Error: Within
## Df Sum Sq Mean Sq F value Pr(>F)
## f1 3 6.08 2.028 0.560 0.655
## f2:f1 6 30.10 5.017 1.385 0.317
## Residuals 9 32.60 3.622
En este estudio no hay interacción, no hay efecto por ninguno de los factores, El riego no tuvo diferencia en la biomasa porque el p- valor es mayor al 5%