Tipos de diseƱo

Diselo 1 factorial en arreglos completamente al azar DiseƱo 2 factoeial completo en bloques DiseƱo 3 factorial completo en parcelas divididas = factorial completo en parcelas DiseƱo 4 Factorial imcompleto al azar

Trabajo

Factorial imcompleto en bloques y covariables DiseƱo en franjas se hace en R se puede en pareja

Ultimo parcial - trabajo con un quiz de lo que es un diseƱo en medidas repetidas

DiseƱo lattice Analisis de perfiles

DiseƱo de efectos aleatorios y mixtos

DiseƱo 3 factorial completo en parcelas divididas = factorial completo en parcelas - Minimo requiere dos factores - Parecido a hacer dos veces el experimento por las 2 aleatorizaciones - Riego, fertilizacion, densidad de siembra, maquinaria (labranza)

SPLIT PLOT DESING: podria necesitar bloques

Factor 1: la parcela (suelo 1, 2 y 3) Factor 2: Fertilizacion (control, fertilizacion 1 y fertilizacion 2)

ejemplo

Factor 1: Variedad (v1, v1. v3, v4) Factor 2: riego (r1, r2, r3) Tratamientos 12 (4*3) x 2 rep: 24 unidades experimentales

completamente al azar

library(dplyr)
## Warning: package 'dplyr' was built under R version 4.2.3
## 
## 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  2 4 V1 R1  r1 V1R1r1
## 2  4 3 V1 R1  r2 V1R1r2
## 3  6 2 V1 R2  r1 V1R2r1
## 4  5 1 V1 R2  r2 V1R2r2
## 5  1 3 V1 R3  r1 V1R3r1
## 6  6 3 V1 R3  r2 V1R3r2
## 7  3 4 V2 R1  r1 V2R1r1
## 8  6 1 V2 R1  r2 V2R1r2
## 9  6 4 V2 R2  r1 V2R2r1
## 10 3 1 V2 R2  r2 V2R2r2
## 11 5 3 V2 R3  r1 V2R3r1
## 12 1 2 V2 R3  r2 V2R3r2
## 13 1 4 V3 R1  r1 V3R1r1
## 14 5 2 V3 R1  r2 V3R1r2
## 15 5 4 V3 R2  r1 V3R2r1
## 16 2 3 V3 R2  r2 V3R2r2
## 17 2 2 V3 R3  r1 V3R3r1
## 18 4 1 V3 R3  r2 V3R3r2
## 19 4 4 V4 R1  r1 V4R1r1
## 20 3 3 V4 R1  r2 V4R1r2
## 21 3 2 V4 R2  r1 V4R2r1
## 22 2 1 V4 R2  r2 V4R2r2
## 23 4 2 V4 R3  r1 V4R3r1
## 24 1 1 V4 R3  r2 V4R3r2
library(ggplot2)
## Warning: package 'ggplot2' was built under R version 4.2.3
ggplot(xy)+
  aes(x,y,label=name, fill=f2)+
  geom_tile(color='white')+
  geom_label(fill='white')+
  labs(title = 'completamente al azar')

Aleatorizacion completamente al azar

Parcela principal: riego
Subarcela: variedad

ajuste

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))

plot(xy)

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())

##Modelo estadistico aparece un doble error, uno por el primer factor y otro por la interaccion de ambos factores (subparcela)

set.seed(123)
data$biom = rnorm(24, 8, 2)

###Analisis descriptivo

ggplot(data)+
  aes(f2, biom)+
  geom_boxplot()

ggplot(data)+
  aes(f1, biom)+
  geom_boxplot()

ggplot(data)+
  aes(f2, biom, fill=f1)+
  geom_boxplot()

library(lme4)
## Warning: package 'lme4' was built under R version 4.2.3
## Loading required package: Matrix
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  15.55   5.183   1.026  0.426
## f2:f1      6   7.78   1.296   0.257  0.944
## Residuals  9  45.46   5.051