PARA EL PARCIAL 2:

  1. FACTORIAL COMPLETO EN ARREGLO COMPLETAMENTE AL AZAR
  2. FACTORIAL COMPLETO EN BLOQUES
  3. FACTORIAL COMPLETO EN PARCELAS DIVIDIDAS (Hoy)
  4. FACTORIAL INCOMPLETO AL AZAR (Prox. Martes)

TRABAJO parcial:

  1. Factorial incompleto en bloques y con coovariables.
  2. Investigar: strip plot desing

TRABAJO FINAL QUIZ:

FACTORIAL COMPLETO EN PARCELAS DIVIDIDAS. (SPLIT PLOT(=parcela) DESING)

Requiere 2 factores como minimo Dos veces el experimento: (2 aleatorizaciones)

FACTOR1: Parcela - Es más un bloqueo, ya que un factor debe ser algo que se puede controlar- (s1, s2, s3) FACTOR2: Fertilización (f0 (0=sin f), f1, f2)

CORRECTAMENTE:

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

AJUSTADO

library(dplyr)
xy = expand.grid(x = seq(6), y = seq(4))
f2 = gl(3, 2, 24, paste0('R',1:3))
f1 = c(
  rep(sample(paste0('V',1:4)), 2),
  rep(sample(paste0('V',1:4)), 2),
  rep(sample(paste0('V',1:4)), 2))
  
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())
## Warning in Ops.factor(f2): '-' not meaningful for factors

Aleatorizacion completamente al azar.

Parcela principal: riego. Subparcela: variedad

MODELO DEL DISEÑO =

Tiene 2 errores por la primera y segunda aleotarización.

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

ANALISI DESCRIPTIVO:

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

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

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

*Interacción: la variedad no es la misma en todos los riegos, la variedad 2 en una variacion de riego no es la mejor.

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
## f2     2 0.4767 0.23835
## f1     2 0.1729 0.08644
## f2:f1  1 0.0158 0.01578
## 
## Error: Within
##           Df Sum Sq Mean Sq F value Pr(>F)
## f1         3   6.39   2.131   0.420  0.743
## f2:f1      6  31.91   5.318   1.049  0.455
## Residuals  9  45.62   5.069