%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

CURSO DE DISEƑO DE EXPERIMENTOS - 2023

Profe: Julio Hurtado Marquez

Email:

(a) Presentación

(b) Bienvenida a la U

(c) Presentación del Docente y Estudiantes

(d) Presentación del curso

(e) Contenidos en Savio

(f) Evaluaciones: Talleres en google drive y Savio

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

1.0. Introducción al DOE: Generalidades

1.1. Video 1: Introducción al DOE

embed_youtube("h9nY-1iM0dY")

2.0. DiseƱos Completos Aleatorizados (DCA): Generalidades

2.1. Video 2: DiseƱos Completos Aleatorizados (DCA): Generalidades

embed_youtube("bQdvpi6WZYc")

2.2. Video 3: DCA Ejemplos prƔcticos usando Statgraphics

embed_youtube("F_KEL5IPS0s")

2.3 Tema 1: DiseƱos Completos Aleatorizados - DCA usando RStudio

Ejemplo 2.3. (Texto Analisis y Diseno de Experimentos_Humberto-Roman_2da Ed_McGrawHill, pƔg. 63)

Problema: Un fabricante de calzado desea mejorar la calidad de las suelas, las cuales se pueden hacer con uno de los cuatro tipos de cuero A, B, C y D disponibles en el mercado. Para ello, prueba los cueros con una mÔquina que hace pasar los zapatos por una superficie abrasiva. La suela de los zapatos se desgasta al pasarla por dicha superficie. Como criterio de desgaste se usa la pérrdida de peso después de un número fijo de ciclos. Se prueban en orden aleatorio 24 zapatos, seis de cada tipo de cuero. Al hacer las pruebas en orden completamente al azar se evitan sesgos y las mediciones en un tipo de cuero resultan independiente de las demÔs. Los datos (en mg) sobre el desgaste de cada tipo de cuero se muestran en la tabla siguiente:.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

Tabla de datos

Tipos de Cuero Desgaste
A 264 260 258 241 262 255
B 208 220 216 200 213 206
C 220 263 219 225 230 228
D 217 226 215 224 220 222

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

2.4 Usando RStudio - DCA

(a) Vector de Datos en R

# Datos del Problema Tipos de Cuero T.CUERO
A<-c(264, 260, 258, 241, 262, 255)
B<-c(208, 220, 216, 200, 213, 206)
C<-c(220, 263, 219, 225, 230, 228)
D<-c(217, 226, 215, 224, 220, 222)

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

(b) Creando matriz a partir de los vectores

T.CUERO <-matrix(c(A, B, C, D),nrow = 6,ncol = 4)
T.CUERO
##      [,1] [,2] [,3] [,4]
## [1,]  264  208  220  217
## [2,]  260  220  263  226
## [3,]  258  216  219  215
## [4,]  241  200  225  224
## [5,]  262  213  230  220
## [6,]  255  206  228  222

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

(c) Agregar nombres de columnas

colnames(T.CUERO)<-c("A", "B", "C", "D")
T.CUERO
##        A   B   C   D
## [1,] 264 208 220 217
## [2,] 260 220 263 226
## [3,] 258 216 219 215
## [4,] 241 200 225 224
## [5,] 262 213 230 220
## [6,] 255 206 228 222

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

(d) agregar nombres de filas/renglones

rownames(T.CUERO)<-c("1","2","3","4","5","6")
T.CUERO
##     A   B   C   D
## 1 264 208 220 217
## 2 260 220 263 226
## 3 258 216 219 215
## 4 241 200 225 224
## 5 262 213 230 220
## 6 255 206 228 222
summary(T.CUERO)
##        A               B               C               D        
##  Min.   :241.0   Min.   :200.0   Min.   :219.0   Min.   :215.0  
##  1st Qu.:255.8   1st Qu.:206.5   1st Qu.:221.2   1st Qu.:217.8  
##  Median :259.0   Median :210.5   Median :226.5   Median :221.0  
##  Mean   :256.7   Mean   :210.5   Mean   :230.8   Mean   :220.7  
##  3rd Qu.:261.5   3rd Qu.:215.2   3rd Qu.:229.5   3rd Qu.:223.5  
##  Max.   :264.0   Max.   :220.0   Max.   :263.0   Max.   :226.0

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

(e) El primer paso es graficar los datos; los diagramas de caja son Ćŗtiles:

boxplot(T.CUERO, col=c("red", "blue", "yellow", "orange"))

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

2.5 Usando RStudio forma 2 - DCA

(a) DCA de una mejor forma :Creando el data.frame

set.seed(7638)
T.CUERO2 <- factor( rep( c("A", "B", "C","D" ), each = 6))
Desgaste <- c(264,  260,    258,    241,    262,    255, 208,   220,    216,    200,    213,    206, 220,   263,    219,    225,    230,    228, 217,   226,    215,    224,    220,    222)
DCA <- data.frame( T.CUERO2, Desgaste )
DCA

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

(b) Resumen estadĆ­stico

summary(DCA, f=TRUE)
##  T.CUERO2    Desgaste    
##  A:6      Min.   :200.0  
##  B:6      1st Qu.:216.8  
##  C:6      Median :223.0  
##  D:6      Mean   :229.7  
##           3rd Qu.:244.5  
##           Max.   :264.0

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

span style=ā€œcolor:redā€>(c) El primer paso es graficar los datos; los diagramas de caja son Ćŗtiles:

plot(Desgaste ~ T.CUERO2, data=DCA, col=c("red", "blue", "yellow", "orange"))

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

2.6. Modelo Lineal - DCA

(a) Ahora ajustemos el modelo lineal (lm en R).

\[lm: y_{ij} = \mu+\tau_i+\epsilon_{ij}= \mu_i+\epsilon_{ij}\] donde \(\mu\) es la media real del desgaste con los diferentes tipos de cuero, \(\tau_i\) es el efecto medio sobre el desgaste de los tipos de cuero y \(\epsilon_ij\) es el arror aleatorio

g <- lm(Desgaste ~ T.CUERO2, data=DCA)

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

(b) Resumen estadĆ­stico: el modelo lineal (lm en R). Anote las conclusiones

summary(g)
## 
## Call:
## lm(formula = Desgaste ~ T.CUERO2, data = DCA)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -15.667  -4.792  -0.750   3.833  32.167 
## 
## Coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  256.667      4.112  62.419  < 2e-16 ***
## T.CUERO2B    -46.167      5.815  -7.939 1.31e-07 ***
## T.CUERO2C    -25.833      5.815  -4.442  0.00025 ***
## T.CUERO2D    -36.000      5.815  -6.191 4.78e-06 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 10.07 on 20 degrees of freedom
## Multiple R-squared:  0.7771, Adjusted R-squared:  0.7436 
## F-statistic: 23.24 on 3 and 20 DF,  p-value: 1.002e-06

(c) Anova: el modelo lineal (lm en R). Anote las conclusiones*

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

anova(g)

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

(d) Examinemos la matriz del diseño para comprender la codificación

model.matrix(g)
##    (Intercept) T.CUERO2B T.CUERO2C T.CUERO2D
## 1            1         0         0         0
## 2            1         0         0         0
## 3            1         0         0         0
## 4            1         0         0         0
## 5            1         0         0         0
## 6            1         0         0         0
## 7            1         1         0         0
## 8            1         1         0         0
## 9            1         1         0         0
## 10           1         1         0         0
## 11           1         1         0         0
## 12           1         1         0         0
## 13           1         0         1         0
## 14           1         0         1         0
## 15           1         0         1         0
## 16           1         0         1         0
## 17           1         0         1         0
## 18           1         0         1         0
## 19           1         0         0         1
## 20           1         0         0         1
## 21           1         0         0         1
## 22           1         0         0         1
## 23           1         0         0         1
## 24           1         0         0         1
## attr(,"assign")
## [1] 0 1 1 1
## attr(,"contrasts")
## attr(,"contrasts")$T.CUERO2
## [1] "contr.treatment"

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

(e) Examinemos la matriz del diseño para comprender la codificación: Podemos ajustar el modelo sin el término de intersección

gi <- lm(Desgaste ~ T.CUERO2 -1, data=DCA)
model.matrix(gi)
##    T.CUERO2A T.CUERO2B T.CUERO2C T.CUERO2D
## 1          1         0         0         0
## 2          1         0         0         0
## 3          1         0         0         0
## 4          1         0         0         0
## 5          1         0         0         0
## 6          1         0         0         0
## 7          0         1         0         0
## 8          0         1         0         0
## 9          0         1         0         0
## 10         0         1         0         0
## 11         0         1         0         0
## 12         0         1         0         0
## 13         0         0         1         0
## 14         0         0         1         0
## 15         0         0         1         0
## 16         0         0         1         0
## 17         0         0         1         0
## 18         0         0         1         0
## 19         0         0         0         1
## 20         0         0         0         1
## 21         0         0         0         1
## 22         0         0         0         1
## 23         0         0         0         1
## 24         0         0         0         1
## attr(,"assign")
## [1] 1 1 1 1
## attr(,"contrasts")
## attr(,"contrasts")$T.CUERO2
## [1] "contr.treatment"
summary(gi)
## 
## Call:
## lm(formula = Desgaste ~ T.CUERO2 - 1, data = DCA)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -15.667  -4.792  -0.750   3.833  32.167 
## 
## Coefficients:
##           Estimate Std. Error t value Pr(>|t|)    
## T.CUERO2A  256.667      4.112   62.42   <2e-16 ***
## T.CUERO2B  210.500      4.112   51.19   <2e-16 ***
## T.CUERO2C  230.833      4.112   56.14   <2e-16 ***
## T.CUERO2D  220.667      4.112   53.66   <2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 10.07 on 20 degrees of freedom
## Multiple R-squared:  0.9984, Adjusted R-squared:  0.9981 
## F-statistic:  3137 on 4 and 20 DF,  p-value: < 2.2e-16
  • Podemos leer directamente las medias de nivel pero las pruebas no son Ćŗtiles ya que implican comparaciones con cero. Tenga en cuenta el error de cĆ”lculo de \(R^2\).

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

f) Variables que contiene nuestro modelo: usando names(g)

names(g)
##  [1] "coefficients"  "residuals"     "effects"       "rank"         
##  [5] "fitted.values" "assign"        "qr"            "df.residual"  
##  [9] "contrasts"     "xlevels"       "call"          "terms"        
## [13] "model"

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

2.7. Supuestos del Modelo Lineal - DCA

(a) Examinando la normalidad de los datos: GrƔfico QQ

qqnorm(g$res, main = "Distribución de residuos para la variable Desgaste",col="red", lwd=3)
qqline(g$res, col="blue", lwd=3)

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

(b) Media y desviación de los residuos

mean(g$res)
## [1] 3.330669e-16
sd(g$res)
## [1] 9.392411

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

(c) Tabla de residuos

g$res
##           1           2           3           4           5           6 
##   7.3333333   3.3333333   1.3333333 -15.6666667   5.3333333  -1.6666667 
##           7           8           9          10          11          12 
##  -2.5000000   9.5000000   5.5000000 -10.5000000   2.5000000  -4.5000000 
##          13          14          15          16          17          18 
## -10.8333333  32.1666667 -11.8333333  -5.8333333  -0.8333333  -2.8333333 
##          19          20          21          22          23          24 
##  -3.6666667   5.3333333  -5.6666667   3.3333333  -0.6666667   1.3333333

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

(d) Examinando la Homocedasticidad de los datos: Residuos vs Predichos

plot(g$fit,g$res,xlab="Predichos",ylab="Residuos",
main="GrƔfico Residuos-Predichos", col="blue", lwd=3)

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

(e) Examinando la Homocedasticidad de los datos: Residuos vs Predichos

plot(jitter(g$fit),g$res,xlab="Predichos",ylab="Residuos",
main="Jittered plot", col="blue", lwd=3)

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

2.8. Comparaciones MĆŗltiples - DCA

(a) Comparaciones multiples

g <- lm(Desgaste ~ T.CUERO2, data=DCA)
summary(g)
## 
## Call:
## lm(formula = Desgaste ~ T.CUERO2, data = DCA)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -15.667  -4.792  -0.750   3.833  32.167 
## 
## Coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  256.667      4.112  62.419  < 2e-16 ***
## T.CUERO2B    -46.167      5.815  -7.939 1.31e-07 ***
## T.CUERO2C    -25.833      5.815  -4.442  0.00025 ***
## T.CUERO2D    -36.000      5.815  -6.191 4.78e-06 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 10.07 on 20 degrees of freedom
## Multiple R-squared:  0.7771, Adjusted R-squared:  0.7436 
## F-statistic: 23.24 on 3 and 20 DF,  p-value: 1.002e-06

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

(b) Una forma alternativa en la que podemos hacer el mismo cƔlculo es recodificar el factor con B como nivel de referencia y reajustar el modelo:

DCA$T.CUERO2 <- relevel(DCA$T.CUERO2,ref="B")
g <- lm(Desgaste ~ T.CUERO2, data=DCA)
summary(g)
## 
## Call:
## lm(formula = Desgaste ~ T.CUERO2, data = DCA)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -15.667  -4.792  -0.750   3.833  32.167 
## 
## Coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  210.500      4.112  51.192  < 2e-16 ***
## T.CUERO2A     46.167      5.815   7.939 1.31e-07 ***
## T.CUERO2C     20.333      5.815   3.497  0.00227 ** 
## T.CUERO2D     10.167      5.815   1.748  0.09575 .  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 10.07 on 20 degrees of freedom
## Multiple R-squared:  0.7771, Adjusted R-squared:  0.7436 
## F-statistic: 23.24 on 3 and 20 DF,  p-value: 1.002e-06

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

(c) Anova del modelo

anova(g)

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

(d) Tukey: Rangos mĆŗltiples

z = TukeyHSD(aov(Desgaste ~ T.CUERO2, data=DCA))
z
##   Tukey multiple comparisons of means
##     95% family-wise confidence level
## 
## Fit: aov(formula = Desgaste ~ T.CUERO2, data = DCA)
## 
## $T.CUERO2
##          diff        lwr        upr     p adj
## A-B  46.16667  29.890265  62.443068 0.0000007
## C-B  20.33333   4.056932  36.609735 0.0112174
## D-B  10.16667  -6.109735  26.443068 0.3263417
## C-A -25.83333 -42.109735  -9.556932 0.0013189
## D-A -36.00000 -52.276401 -19.723599 0.0000265
## D-C -10.16667 -26.443068   6.109735 0.3263417
plot(z)

El método de Tukey supone lo peor centrÔndose en la diferencia mÔs grande. Hay otros competidores como el Newman-Keuls, el rango múltiple de Duncan y el procedimiento de Waller-Duncan. Para una descripción detallada de las muchas alternativas disponibles ver Hsu (1996).

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

2.9. Prueba de homogeneidad de varianza - DCA

(z) Resumen estadĆ­stico

summary(lm( abs(g$res) ~ DCA$T.CUERO2))
## 
## Call:
## lm(formula = abs(g$res) ~ DCA$T.CUERO2)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -9.8889 -3.3333 -0.3889  1.6667 21.4444 
## 
## Coefficients:
##               Estimate Std. Error t value Pr(>|t|)  
## (Intercept)    5.83333    2.68960   2.169   0.0423 *
## DCA$T.CUERO2A -0.05556    3.80367  -0.015   0.9885  
## DCA$T.CUERO2C  4.88889    3.80367   1.285   0.2134  
## DCA$T.CUERO2D -2.50000    3.80367  -0.657   0.5185  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 6.588 on 20 degrees of freedom
## Multiple R-squared:  0.166,  Adjusted R-squared:  0.04088 
## F-statistic: 1.327 on 3 and 20 DF,  p-value: 0.2936

Dado que el valor p es grande, concluimos que no hay evidencia de una varianza no constante.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

2.10. Ejemplo de DiseƱo de Experimentos con Python

Iniciando un DiseƱo sencillo con Python. Si el enlace no lo lleva directamente, por favor copielo y peguelo directamente en su navegador <span

https://github.com/JSEFERINO/JSEFERINO/blob/main/DOEJH.ipynb

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

2.11. DCA con Python

Ejemplo - DCA. Si el enlace no lo lleva directamente, por favor copielo y peguelo directamente en su navegador <span

https://github.com/JSEFERINO/JSEFERINO/blob/main/DOEJH2Cipynb.ipynb

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

2.12. DCA-2 con Python

Ejemplo - DCA. Si el enlace no lo lleva directamente, por favor copielo y peguelo directamente en su navegador <span

https://github.com/JSEFERINO/JSEFERINO/blob/main/DOEJH0.ipynb

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

2.13. DCA-3 con Python

Ejemplo - DCA. Si el enlace no lo lleva directamente, por favor copielo y peguelo directamente en su navegador <span

https://github.com/JSEFERINO/JSEFERINO/blob/main/DOEJH7.ipynb

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

2.14. Evaluación 1. DCA - PARTE I

Ejemplo - DCA. Si el enlace no lo lleva directamente, por favor copielo y peguelo directamente en su navegador <span

https://forms.gle/hSNWpv8EiRGFRdqL8

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

2.15. Evaluación 2. DCA - PARTE II

Ejemplo - DCA. Si el enlace no lo lleva directamente, por favor copielo y peguelo directamente en su navegador <span

https://forms.gle/Guicic1XUFHH7oPNA

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

3.0 Tema 3: DiseƱos en Bloques Completos al Azar DBCA: Generalidades

3.1 Video 3: DiseƱos en Bloques Completos al Azar DBCA: Generalidades**

embed_youtube("--GzYcmlk5o")

3.2 Tema 3: DiseƱos en Bloques Completos al Azar DBCA

Ejemplo 3.2. (Texto Analisis y Diseno de Experimentos_Humberto-Roman_2da Ed_McGrawHill, pƔg. 63)

Se evalúa la eficacia de sulfato ferroso a 4 diferentes concentraciones A=2, B=2.5, C=3, y D=4 mg/kg/día para combatir la anemia en personas con desnutrición. Dada la variabilidad de pesos y sexos, se decidió agrupar en bloque de personas por pesos lo mÔs semejantes posibles. Se les dio el tratamiento durante 4 meses y se procedió a determinar su volumen sanguíneo dando los siguientes resultados:

Tratamientos A B C D
I 4.1 6.5 4.1 4.9
II 4.1 5.3 4.0 6.2
Bloques III 6.5 6.9 4.5 4.8
IV 4.3 6.8 4.3 4.2
V 6.0 6.5 4.1 6.9

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

3.3 Ingresando los datos en RStudio

(a) Primero creamos los vectores teniendo en cuenta que los factores se deben crear como factor.

V.sanguĆ­neo =c(4.1, 6.5,4.1, 4.9,
               4.1, 5.3, 4.0, 6.2, 
               6.5, 6.9, 4.5,  4.8, 
               4.3, 6.8, 4.3,4.2, 
               6.0, 6.5,4.1, 6.9)

Tratamientos =factor( c(rep("A",1), 
                rep("B",1), 
                rep("C",1), 
                rep("D",1)))

Bloques = factor(c(rep("I",4),
                    rep("II",4),
                    rep("III",4),
                    rep("IV",4),
                    rep("V",4))) 

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

(b) Se obtiene ahora la nueva tabla de datos del modelo

DBCA1 = data.frame(Bloques,Tratamientos, V.sanguĆ­neo)

DBCA1

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

3.4 Analizando los datos en RStudio

(a) Para el próximo paso debemos descargar los siguientes paquetes (gridExtra) y (ggplot2)

library(gridExtra)
library(ggplot2)
## Warning: replacing previous import 'ellipsis::check_dots_unnamed' by
## 'rlang::check_dots_unnamed' when loading 'tibble'
## Warning: replacing previous import 'ellipsis::check_dots_used' by
## 'rlang::check_dots_used' when loading 'tibble'
## Warning: replacing previous import 'ellipsis::check_dots_empty' by
## 'rlang::check_dots_empty' when loading 'tibble'
## Warning: replacing previous import 'ellipsis::check_dots_unnamed' by
## 'rlang::check_dots_unnamed' when loading 'pillar'
## Warning: replacing previous import 'ellipsis::check_dots_used' by
## 'rlang::check_dots_used' when loading 'pillar'
## Warning: replacing previous import 'ellipsis::check_dots_empty' by
## 'rlang::check_dots_empty' when loading 'pillar'

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

(b) Diagramas de caja: Los siguientes son grƔficos descriptivos de los factores con la variable respuesta

Tratamientos2 <- ggplot(DBCA1, aes(x = Tratamientos, y = V.sanguĆ­neo, fill=Tratamientos)) +
  geom_boxplot() + theme(legend.position = "none")
Bloques2 <- ggplot(DBCA1, aes(x = Bloques, y = V.sanguĆ­neo, fill=Bloques)) +
  geom_boxplot() + theme(legend.position = "none")
grid.arrange(Tratamientos2,Bloques2, nrow=1, ncol=2)

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

(c) El Modelo linal y tabla ANOVA

modeloDBCA1= lm(V.sanguĆ­neo ~ Tratamientos + Bloques, DBCA1)
anovaDBCA1=aov(modeloDBCA1)
anovaDBCA1
## Call:
##    aov(formula = modeloDBCA1)
## 
## Terms:
##                 Tratamientos Bloques Residuals
## Sum of Squares        12.550   3.755     8.345
## Deg. of Freedom            3       4        12
## 
## Residual standard error: 0.8339165
## Estimated effects may be unbalanced
summary(anovaDBCA1)
##              Df Sum Sq Mean Sq F value  Pr(>F)   
## Tratamientos  3 12.550   4.183   6.016 0.00964 **
## Bloques       4  3.755   0.939   1.350 0.30797   
## Residuals    12  8.345   0.695                   
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

(d) Comparaciones mĆŗltiples: HSD de Tukey

TukeyHSD(anovaDBCA1)
##   Tukey multiple comparisons of means
##     95% family-wise confidence level
## 
## Fit: aov(formula = modeloDBCA1)
## 
## $Tratamientos
##     diff        lwr        upr     p adj
## B-A  1.4 -0.1658432  2.9658432 0.0854565
## C-A -0.8 -2.3658432  0.7658432 0.4580868
## D-A  0.4 -1.1658432  1.9658432 0.8713824
## C-B -2.2 -3.7658432 -0.6341568 0.0061420
## D-B -1.0 -2.5658432  0.5658432 0.2800111
## D-C  1.2 -0.3658432  2.7658432 0.1586223
## 
## $Bloques
##                 diff        lwr      upr     p adj
## II-I    0.000000e+00 -1.8795268 1.879527 1.0000000
## III-I   7.750000e-01 -1.1045268 2.654527 0.6881671
## IV-I   -8.881784e-16 -1.8795268 1.879527 1.0000000
## V-I     9.750000e-01 -0.9045268 2.854527 0.4944147
## III-II  7.750000e-01 -1.1045268 2.654527 0.6881671
## IV-II  -8.881784e-16 -1.8795268 1.879527 1.0000000
## V-II    9.750000e-01 -0.9045268 2.854527 0.4944147
## IV-III -7.750000e-01 -2.6545268 1.104527 0.6881671
## V-III   2.000000e-01 -1.6795268 2.079527 0.9967411
## V-IV    9.750000e-01 -0.9045268 2.854527 0.4944147

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

(e) Comparaciones múltiples: grÔfico HSD de Tukey

plot(TukeyHSD(anovaDBCA1))

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

3.5 Pruebas de Medias por comparaciones MĆŗltiples

(a) (Prueba LSD). Instale el paquete ā€œagricolae

library(agricolae)
## Warning: replacing previous import 'ellipsis::check_dots_unnamed' by
## 'rlang::check_dots_unnamed' when loading 'hms'
## Warning: replacing previous import 'ellipsis::check_dots_used' by
## 'rlang::check_dots_used' when loading 'hms'
## Warning: replacing previous import 'ellipsis::check_dots_empty' by
## 'rlang::check_dots_empty' when loading 'hms'

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

(b) Prueba LSD para Tratamientos

LSD.test(anovaDBCA1,"Tratamientos",console=TRUE)
## 
## Study: anovaDBCA1 ~ "Tratamientos"
## 
## LSD t Test for V.sanguĆ­neo 
## 
## Mean Square Error:  0.6954167 
## 
## Tratamientos,  means and individual ( 95 %) CI
## 
##   V.sanguĆ­neo       std r      LCL      UCL Min Max
## A         5.0 1.1575837 5 4.187436 5.812564 4.1 6.5
## B         6.4 0.6403124 5 5.587436 7.212564 5.3 6.9
## C         4.2 0.2000000 5 3.387436 5.012564 4.0 4.5
## D         5.4 1.1113055 5 4.587436 6.212564 4.2 6.9
## 
## Alpha: 0.05 ; DF Error: 12
## Critical Value of t: 2.178813 
## 
## least Significant Difference: 1.149139 
## 
## Treatments with the same letter are not significantly different.
## 
##   V.sanguĆ­neo groups
## B         6.4      a
## D         5.4     ab
## A         5.0     bc
## C         4.2      c
plot(LSD.test(anovaDBCA1,"Tratamientos",console=TRUE))
## 
## Study: anovaDBCA1 ~ "Tratamientos"
## 
## LSD t Test for V.sanguĆ­neo 
## 
## Mean Square Error:  0.6954167 
## 
## Tratamientos,  means and individual ( 95 %) CI
## 
##   V.sanguĆ­neo       std r      LCL      UCL Min Max
## A         5.0 1.1575837 5 4.187436 5.812564 4.1 6.5
## B         6.4 0.6403124 5 5.587436 7.212564 5.3 6.9
## C         4.2 0.2000000 5 3.387436 5.012564 4.0 4.5
## D         5.4 1.1113055 5 4.587436 6.212564 4.2 6.9
## 
## Alpha: 0.05 ; DF Error: 12
## Critical Value of t: 2.178813 
## 
## least Significant Difference: 1.149139 
## 
## Treatments with the same letter are not significantly different.
## 
##   V.sanguĆ­neo groups
## B         6.4      a
## D         5.4     ab
## A         5.0     bc
## C         4.2      c

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

(c) Prueba LSD para Bloques

LSD.test(anovaDBCA1,"Bloques",console=TRUE)
## 
## Study: anovaDBCA1 ~ "Bloques"
## 
## LSD t Test for V.sanguĆ­neo 
## 
## Mean Square Error:  0.6954167 
## 
## Bloques,  means and individual ( 95 %) CI
## 
##     V.sanguĆ­neo      std r      LCL      UCL Min Max
## I         4.900 1.131371 4 3.991526 5.808474 4.1 6.5
## II        4.900 1.048809 4 3.991526 5.808474 4.0 6.2
## III       5.675 1.201041 4 4.766526 6.583474 4.5 6.9
## IV        4.900 1.267544 4 3.991526 5.808474 4.2 6.8
## V         5.875 1.239287 4 4.966526 6.783474 4.1 6.9
## 
## Alpha: 0.05 ; DF Error: 12
## Critical Value of t: 2.178813 
## 
## least Significant Difference: 1.284776 
## 
## Treatments with the same letter are not significantly different.
## 
##     V.sanguĆ­neo groups
## V         5.875      a
## III       5.675      a
## I         4.900      a
## II        4.900      a
## IV        4.900      a
plot(LSD.test(anovaDBCA1,"Bloques",console=TRUE))
## 
## Study: anovaDBCA1 ~ "Bloques"
## 
## LSD t Test for V.sanguĆ­neo 
## 
## Mean Square Error:  0.6954167 
## 
## Bloques,  means and individual ( 95 %) CI
## 
##     V.sanguĆ­neo      std r      LCL      UCL Min Max
## I         4.900 1.131371 4 3.991526 5.808474 4.1 6.5
## II        4.900 1.048809 4 3.991526 5.808474 4.0 6.2
## III       5.675 1.201041 4 4.766526 6.583474 4.5 6.9
## IV        4.900 1.267544 4 3.991526 5.808474 4.2 6.8
## V         5.875 1.239287 4 4.966526 6.783474 4.1 6.9
## 
## Alpha: 0.05 ; DF Error: 12
## Critical Value of t: 2.178813 
## 
## least Significant Difference: 1.284776 
## 
## Treatments with the same letter are not significantly different.
## 
##     V.sanguĆ­neo groups
## V         5.875      a
## III       5.675      a
## I         4.900      a
## II        4.900      a
## IV        4.900      a

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

(f) Prueba de Tukey: Tratamientos

HSD.test(anovaDBCA1, "Tratamientos",console=TRUE)
## 
## Study: anovaDBCA1 ~ "Tratamientos"
## 
## HSD Test for V.sanguĆ­neo 
## 
## Mean Square Error:  0.6954167 
## 
## Tratamientos,  means
## 
##   V.sanguĆ­neo       std r Min Max
## A         5.0 1.1575837 5 4.1 6.5
## B         6.4 0.6403124 5 5.3 6.9
## C         4.2 0.2000000 5 4.0 4.5
## D         5.4 1.1113055 5 4.2 6.9
## 
## Alpha: 0.05 ; DF Error: 12 
## Critical Value of Studentized Range: 4.19866 
## 
## Minimun Significant Difference: 1.565843 
## 
## Treatments with the same letter are not significantly different.
## 
##   V.sanguĆ­neo groups
## B         6.4      a
## D         5.4     ab
## A         5.0     ab
## C         4.2      b
plot(HSD.test(anovaDBCA1, "Tratamientos",console=TRUE))
## 
## Study: anovaDBCA1 ~ "Tratamientos"
## 
## HSD Test for V.sanguĆ­neo 
## 
## Mean Square Error:  0.6954167 
## 
## Tratamientos,  means
## 
##   V.sanguĆ­neo       std r Min Max
## A         5.0 1.1575837 5 4.1 6.5
## B         6.4 0.6403124 5 5.3 6.9
## C         4.2 0.2000000 5 4.0 4.5
## D         5.4 1.1113055 5 4.2 6.9
## 
## Alpha: 0.05 ; DF Error: 12 
## Critical Value of Studentized Range: 4.19866 
## 
## Minimun Significant Difference: 1.565843 
## 
## Treatments with the same letter are not significantly different.
## 
##   V.sanguĆ­neo groups
## B         6.4      a
## D         5.4     ab
## A         5.0     ab
## C         4.2      b

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

(g) Prueba de Tukey: Bloques

HSD.test(anovaDBCA1, "Bloques",console=TRUE)
## 
## Study: anovaDBCA1 ~ "Bloques"
## 
## HSD Test for V.sanguĆ­neo 
## 
## Mean Square Error:  0.6954167 
## 
## Bloques,  means
## 
##     V.sanguĆ­neo      std r Min Max
## I         4.900 1.131371 4 4.1 6.5
## II        4.900 1.048809 4 4.0 6.2
## III       5.675 1.201041 4 4.5 6.9
## IV        4.900 1.267544 4 4.2 6.8
## V         5.875 1.239287 4 4.1 6.9
## 
## Alpha: 0.05 ; DF Error: 12 
## Critical Value of Studentized Range: 4.50771 
## 
## Minimun Significant Difference: 1.879527 
## 
## Treatments with the same letter are not significantly different.
## 
##     V.sanguĆ­neo groups
## V         5.875      a
## III       5.675      a
## I         4.900      a
## II        4.900      a
## IV        4.900      a

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

(h) Prueba de Student-Newman-Keuls (SNK)

SNK.test(anovaDBCA1, "Tratamientos",console=TRUE)
## 
## Study: anovaDBCA1 ~ "Tratamientos"
## 
## Student Newman Keuls Test
## for V.sanguĆ­neo 
## 
## Mean Square Error:  0.6954167 
## 
## Tratamientos,  means
## 
##   V.sanguĆ­neo       std r Min Max
## A         5.0 1.1575837 5 4.1 6.5
## B         6.4 0.6403124 5 5.3 6.9
## C         4.2 0.2000000 5 4.0 4.5
## D         5.4 1.1113055 5 4.2 6.9
## 
## Alpha: 0.05 ; DF Error: 12 
## 
## Critical Range
##        2        3        4 
## 1.149139 1.407072 1.565843 
## 
## Means with the same letter are not significantly different.
## 
##   V.sanguĆ­neo groups
## B         6.4      a
## D         5.4     ab
## A         5.0     ab
## C         4.2      b
plot(SNK.test(anovaDBCA1, "Tratamientos",console=TRUE))
## 
## Study: anovaDBCA1 ~ "Tratamientos"
## 
## Student Newman Keuls Test
## for V.sanguĆ­neo 
## 
## Mean Square Error:  0.6954167 
## 
## Tratamientos,  means
## 
##   V.sanguĆ­neo       std r Min Max
## A         5.0 1.1575837 5 4.1 6.5
## B         6.4 0.6403124 5 5.3 6.9
## C         4.2 0.2000000 5 4.0 4.5
## D         5.4 1.1113055 5 4.2 6.9
## 
## Alpha: 0.05 ; DF Error: 12 
## 
## Critical Range
##        2        3        4 
## 1.149139 1.407072 1.565843 
## 
## Means with the same letter are not significantly different.
## 
##   V.sanguĆ­neo groups
## B         6.4      a
## D         5.4     ab
## A         5.0     ab
## C         4.2      b

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

(i) Prueba de ScheffƩ

scheffe.test(anovaDBCA1, "Bloques",console=TRUE)
## 
## Study: anovaDBCA1 ~ "Bloques"
## 
## Scheffe Test for V.sanguĆ­neo 
## 
## Mean Square Error  : 0.6954167 
## 
## Bloques,  means
## 
##     V.sanguĆ­neo      std r Min Max
## I         4.900 1.131371 4 4.1 6.5
## II        4.900 1.048809 4 4.0 6.2
## III       5.675 1.201041 4 4.5 6.9
## IV        4.900 1.267544 4 4.2 6.8
## V         5.875 1.239287 4 4.1 6.9
## 
## Alpha: 0.05 ; DF Error: 12 
## Critical Value of F: 3.259167 
## 
## Minimum Significant Difference: 2.129074 
## 
## Means with the same letter are not significantly different.
## 
##     V.sanguĆ­neo groups
## V         5.875      a
## III       5.675      a
## I         4.900      a
## II        4.900      a
## IV        4.900      a
plot(scheffe.test(anovaDBCA1, "Bloques",console=TRUE))
## 
## Study: anovaDBCA1 ~ "Bloques"
## 
## Scheffe Test for V.sanguĆ­neo 
## 
## Mean Square Error  : 0.6954167 
## 
## Bloques,  means
## 
##     V.sanguĆ­neo      std r Min Max
## I         4.900 1.131371 4 4.1 6.5
## II        4.900 1.048809 4 4.0 6.2
## III       5.675 1.201041 4 4.5 6.9
## IV        4.900 1.267544 4 4.2 6.8
## V         5.875 1.239287 4 4.1 6.9
## 
## Alpha: 0.05 ; DF Error: 12 
## Critical Value of F: 3.259167 
## 
## Minimum Significant Difference: 2.129074 
## 
## Means with the same letter are not significantly different.
## 
##     V.sanguĆ­neo groups
## V         5.875      a
## III       5.675      a
## I         4.900      a
## II        4.900      a
## IV        4.900      a

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

(j) Prueba de Duncan

duncan.test(anovaDBCA1, "Tratamientos",console=TRUE)
## 
## Study: anovaDBCA1 ~ "Tratamientos"
## 
## Duncan's new multiple range test
## for V.sanguĆ­neo 
## 
## Mean Square Error:  0.6954167 
## 
## Tratamientos,  means
## 
##   V.sanguĆ­neo       std r Min Max
## A         5.0 1.1575837 5 4.1 6.5
## B         6.4 0.6403124 5 5.3 6.9
## C         4.2 0.2000000 5 4.0 4.5
## D         5.4 1.1113055 5 4.2 6.9
## 
## Alpha: 0.05 ; DF Error: 12 
## 
## Critical Range
##        2        3        4 
## 1.149139 1.202818 1.235342 
## 
## Means with the same letter are not significantly different.
## 
##   V.sanguĆ­neo groups
## B         6.4      a
## D         5.4     ab
## A         5.0      b
## C         4.2      b
plot(duncan.test(anovaDBCA1, "Tratamientos",console=TRUE))
## 
## Study: anovaDBCA1 ~ "Tratamientos"
## 
## Duncan's new multiple range test
## for V.sanguĆ­neo 
## 
## Mean Square Error:  0.6954167 
## 
## Tratamientos,  means
## 
##   V.sanguĆ­neo       std r Min Max
## A         5.0 1.1575837 5 4.1 6.5
## B         6.4 0.6403124 5 5.3 6.9
## C         4.2 0.2000000 5 4.0 4.5
## D         5.4 1.1113055 5 4.2 6.9
## 
## Alpha: 0.05 ; DF Error: 12 
## 
## Critical Range
##        2        3        4 
## 1.149139 1.202818 1.235342 
## 
## Means with the same letter are not significantly different.
## 
##   V.sanguĆ­neo groups
## B         6.4      a
## D         5.4     ab
## A         5.0      b
## C         4.2      b

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

(k) Prueba de Bonferroni

LSD.test(anovaDBCA1, "Tratamientos", p.adj= "bon",console=TRUE)
## 
## Study: anovaDBCA1 ~ "Tratamientos"
## 
## LSD t Test for V.sanguĆ­neo 
## P value adjustment method: bonferroni 
## 
## Mean Square Error:  0.6954167 
## 
## Tratamientos,  means and individual ( 95 %) CI
## 
##   V.sanguĆ­neo       std r      LCL      UCL Min Max
## A         5.0 1.1575837 5 4.187436 5.812564 4.1 6.5
## B         6.4 0.6403124 5 5.587436 7.212564 5.3 6.9
## C         4.2 0.2000000 5 3.387436 5.012564 4.0 4.5
## D         5.4 1.1113055 5 4.587436 6.212564 4.2 6.9
## 
## Alpha: 0.05 ; DF Error: 12
## Critical Value of t: 3.152681 
## 
## Minimum Significant Difference: 1.662772 
## 
## Treatments with the same letter are not significantly different.
## 
##   V.sanguĆ­neo groups
## B         6.4      a
## D         5.4     ab
## A         5.0     ab
## C         4.2      b
plot(LSD.test(anovaDBCA1, "Tratamientos", p.adj= "bon",console=TRUE))
## 
## Study: anovaDBCA1 ~ "Tratamientos"
## 
## LSD t Test for V.sanguĆ­neo 
## P value adjustment method: bonferroni 
## 
## Mean Square Error:  0.6954167 
## 
## Tratamientos,  means and individual ( 95 %) CI
## 
##   V.sanguĆ­neo       std r      LCL      UCL Min Max
## A         5.0 1.1575837 5 4.187436 5.812564 4.1 6.5
## B         6.4 0.6403124 5 5.587436 7.212564 5.3 6.9
## C         4.2 0.2000000 5 3.387436 5.012564 4.0 4.5
## D         5.4 1.1113055 5 4.587436 6.212564 4.2 6.9
## 
## Alpha: 0.05 ; DF Error: 12
## Critical Value of t: 3.152681 
## 
## Minimum Significant Difference: 1.662772 
## 
## Treatments with the same letter are not significantly different.
## 
##   V.sanguĆ­neo groups
## B         6.4      a
## D         5.4     ab
## A         5.0     ab
## C         4.2      b

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

3.6 Supuestos del Modelo en RStudio: Normalidad

(a) Normalidad de los residuos

shapiro.test(anovaDBCA1$res)
## 
##  Shapiro-Wilk normality test
## 
## data:  anovaDBCA1$res
## W = 0.95529, p-value = 0.4545

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

(b) Supuesto del modelo:Normalidad de los residuos

summary(anovaDBCA1$residuals)
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##  -1.025  -0.550  -0.025   0.000   0.450   1.150
sd((anovaDBCA1$residuals))
## [1] 0.6627296

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

(c) Supuesto del modelo:Normalidad de los residuos

boxplot(anovaDBCA1$residuals,col="lightblue") 

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

(d) Supuesto del modelo:Normalidad de los residuos

hist(anovaDBCA1$residuals, col="lightgreen", main = "Histograma de los Residuos",
     freq = F, xlab="Residuos",ylab="Densidad")
lines(density(anovaDBCA1$residuals), col="red", lwd=3)

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

(e) ** Prueba de Normalidad con Q-Q Plot**

qqnorm(anovaDBCA1$residuals,col="blue", lwd=3) 
qqline(anovaDBCA1$residuals,col="red", lwd=3)

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ## 3.7. Supuestos del Modelo en RStudio: Supuesto de Independencia

(a) Supuesto de Independencia

plot(anovaDBCA1$residuals,main = "Residuos vs Observaciones",col="red", lwd=3) 

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ## 3.8. Supuestos del Modelo en RStudio: Supuesto de Homocedasticidad

(a) Homocedasticidad

boxplot(anovaDBCA1$residuals~Bloques, xlab="Bloques",ylab="Residuos",
        col = c("yellow", "blue", "white","green", "red")) 

names(anovaDBCA1)
##  [1] "coefficients"  "residuals"     "effects"       "rank"         
##  [5] "fitted.values" "assign"        "qr"            "df.residual"  
##  [9] "contrasts"     "xlevels"       "call"          "terms"        
## [13] "model"

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

(d) Homocedasticidad: GrƔfico de predichos contra residuos estandarizados

pred=fitted(anovaDBCA1)
resid=rstandard(anovaDBCA1)
plot(pred,resid,xlab="Valores predichos", ylab="Residuos estandarizados",abline(h=0),col="red", lwd=3)

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

(e) Homocedasticidad: Prueba de Bartlett para Lisina

bartlett.test(anovaDBCA1$residuals ~ Bloques)
## 
##  Bartlett test of homogeneity of variances
## 
## data:  anovaDBCA1$residuals by Bloques
## Bartlett's K-squared = 1.2802, df = 4, p-value = 0.8647

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

3.9. Evaluación 3. DBCA

Ejemplo - DBCA. Si el enlace no lo lleva directamente, por favor copielo y peguelo directamente en su navegador <span

https://forms.gle/m2CFT2heKXeskHe28

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

4.0 Tema 4: DiseƱos en Cuadrados Latino - DCL: Generalidades

4.1 Video 4. DiseƱos en Cuadrados Latino - DCL: Generalidades

embed_youtube("-7Yh4KTkDoo")

4.2. Tema 4: DiseƱos en Cuadrados Latino - DCL: Usando RStudio

Ejemplo 4.2 (Texto Analisis y Diseno de Experimentos_Humberto-Roman_2da Ed_McGrawHill, pƔg. 63)

Ejemplo 4.2 Se desea evaluar el funcionamiento hepÔtico en perros con diferentes patologías hepÔticas que se encuentran con tratamiento de vitaminas B a 4 diferentes concentraciones. Por lo que se hace un doble arreglo en base a las patologías y razas, y se procedió a la medición de la Transaminasa GlutÔmico Pirúvica (TGP)

Razas Ā Patologias 1:Isquemia 2:Tumor 3:Hepatitis 4:Hemocromatosis
1:Cocker A=10 B=9 C=25 D=8
2:Pastor D=9 A=5 B=17 C=26
3:Boxer C=24 D=9 A=8 B=19
4:Schnauzer B=20 C=22 D=8 A=5

ĀæExisten diferencias en la diferentes concentraciones de vitamina B con respecto a TGP?

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

4.3 Ingresando los datos en RStudio

(a) Usando RSTUDIO

set.seed(7638)
PATOLOGIAS <- factor( rep( c("P1", "P2", "P3","P4" ), each = 1))
RAZAS <- factor( rep( c("R1", "R2", "R3", "R4" ), each = 4))
VITAMINAS <- factor(c("A", "B", "C","D","D", "A", "B", "C","C", "D", "A", "B", "B", "C", "D", "A" ))
f = TGP <- c(10, 9, 25, 8, 9, 5, 17, 26, 24, 9, 8, 19, 20, 22, 8 ,5)
DCL <- data.frame( RAZAS, PATOLOGIAS, VITAMINAS, f)
DCL

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

(b) Acerca del DiseƱo

Factor de interƩs: Concentraciones de Vitamina B

####Niveles del Factor: A, B, C y D (cuatro niveles I=4).

Otros factores:

Patologias con cuatro niveles (J=4)

Razas con cuatro niveles (K=4)

Variable de interƩs: Y= Medicion de la TGP.

Replicas por nivel: n=1.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

4.4 Analizando los datos en RStudio

(a) DCL Diagrama de cajas

plot(f ~RAZAS + PATOLOGIAS +VITAMINAS, data=DCL, col=c("red2", "blue2", "yellow2", "orange2"))

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

(b) Anova

g <- lm(f ~RAZAS + PATOLOGIAS +VITAMINAS, data=DCL)
summary(g)
## 
## Call:
## lm(formula = f ~ RAZAS + PATOLOGIAS + VITAMINAS, data = DCL)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -3.5000 -0.9375  0.2500  1.2500  2.2500 
## 
## Coefficients:
##              Estimate Std. Error t value Pr(>|t|)    
## (Intercept)     7.750      2.271   3.413 0.014266 *  
## RAZASR2         1.250      2.031   0.615 0.560856    
## RAZASR3         2.000      2.031   0.985 0.362784    
## RAZASR4         0.750      2.031   0.369 0.724605    
## PATOLOGIASP2   -4.500      2.031  -2.216 0.068608 .  
## PATOLOGIASP3   -1.250      2.031  -0.615 0.560856    
## PATOLOGIASP4   -1.250      2.031  -0.615 0.560856    
## VITAMINASB      9.250      2.031   4.554 0.003874 ** 
## VITAMINASC     17.250      2.031   8.493 0.000146 ***
## VITAMINASD      1.500      2.031   0.739 0.488053    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 2.872 on 6 degrees of freedom
## Multiple R-squared:  0.9424, Adjusted R-squared:  0.8561 
## F-statistic: 10.92 on 9 and 6 DF,  p-value: 0.004384
anova(g)

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

(c) Anova del modelo

g2<-aov(f ~RAZAS + PATOLOGIAS +VITAMINAS, data=DCL)
g2
## Call:
##    aov(formula = f ~ RAZAS + PATOLOGIAS + VITAMINAS, data = DCL)
## 
## Terms:
##                 RAZAS PATOLOGIAS VITAMINAS Residuals
## Sum of Squares    8.5       44.5     757.5      49.5
## Deg. of Freedom     3          3         3         6
## 
## Residual standard error: 2.872281
## Estimated effects may be unbalanced

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

(d) Anova

summary(g2)
##             Df Sum Sq Mean Sq F value   Pr(>F)    
## RAZAS        3    8.5    2.83   0.343 0.795455    
## PATOLOGIAS   3   44.5   14.83   1.798 0.247633    
## VITAMINAS    3  757.5  252.50  30.606 0.000493 ***
## Residuals    6   49.5    8.25                     
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

4.5 Pruebas de Medias por comparaciones MĆŗltiples

(a) HSD Tukey

TukeyHSD(g2)
##   Tukey multiple comparisons of means
##     95% family-wise confidence level
## 
## Fit: aov(formula = f ~ RAZAS + PATOLOGIAS + VITAMINAS, data = DCL)
## 
## $RAZAS
##        diff       lwr      upr     p adj
## R2-R1  1.25 -5.780769 8.280769 0.9234780
## R3-R1  2.00 -5.030769 9.030769 0.7632815
## R4-R1  0.75 -6.280769 7.780769 0.9812251
## R3-R2  0.75 -6.280769 7.780769 0.9812251
## R4-R2 -0.50 -7.530769 6.530769 0.9942013
## R4-R3 -1.25 -8.280769 5.780769 0.9234780
## 
## $PATOLOGIAS
##                diff        lwr       upr    p adj
## P2-P1 -4.500000e+00 -11.530769  2.530769 0.221112
## P3-P1 -1.250000e+00  -8.280769  5.780769 0.923478
## P4-P1 -1.250000e+00  -8.280769  5.780769 0.923478
## P3-P2  3.250000e+00  -3.780769 10.280769 0.443965
## P4-P2  3.250000e+00  -3.780769 10.280769 0.443965
## P4-P3  1.776357e-15  -7.030769  7.030769 1.000000
## 
## $VITAMINAS
##       diff         lwr        upr     p adj
## B-A   9.25   2.2192309 16.2807691 0.0151908
## C-A  17.25  10.2192309 24.2807691 0.0006054
## D-A   1.50  -5.5307691  8.5307691 0.8783266
## C-B   8.00   0.9692309 15.0307691 0.0291977
## D-B  -7.75 -14.7807691 -0.7192309 0.0334590
## D-C -15.75 -22.7807691 -8.7192309 0.0009991

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

(b) HSD Tukey

plot(TukeyHSD(g2))

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

4.6 Supuestos del Modelo en RStudio

(a) Supuestos del Modelo

Los cuatro grÔficos usados para verificar las suposiciones del modelo lineal se pueden hacer fÔcilmente usando R. El siguiente código produce estos grÔficos.

par( mfrow = c(2,2) )
plot(g2, which=5)
plot(g2, which=1)
plot(g2, which=2)
plot(residuals(g2) ~ f, main="Residuals vs corridas", font.main=1, DCL)
abline(h = 0, lty = 2)

par(mfrow=c(2,2)) divide la región en cuatro subregiones.

plot(g2, which=5) produce un grƔfico de los residuos estandarizados vs niveles de los factores

plot(g2, which=1) produce la grƔfica de residuos vs valores predichos

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

4.7 Supuestos del Modelo en RStudio: Homocedasticidad

(j) DCL Homogeneidad de la Varianza Prueba de Levene

summary(lm( abs(g$res) ~DCL$PATOLOGIAS))
## 
## Call:
## lm(formula = abs(g$res) ~ DCL$PATOLOGIAS)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -1.2500 -0.6562  0.0000  0.5312  1.7500 
## 
## Coefficients:
##                  Estimate Std. Error t value Pr(>|t|)    
## (Intercept)        2.2500     0.4649   4.840 0.000405 ***
## DCL$PATOLOGIASP2  -0.5000     0.6575  -0.760 0.461656    
## DCL$PATOLOGIASP3  -1.6250     0.6575  -2.472 0.029411 *  
## DCL$PATOLOGIASP4  -1.1250     0.6575  -1.711 0.112772    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.9298 on 12 degrees of freedom
## Multiple R-squared:  0.3688, Adjusted R-squared:  0.211 
## F-statistic: 2.337 on 3 and 12 DF,  p-value: 0.1252

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

4.8. Evaluación 4. DCL

Ejemplo - DCL. Si el enlace no lo lleva directamente, por favor copielo y peguelo directamente en su navegador <span

https://forms.gle/Nr16va6hK9q5UAGx9

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

5.0 Tema 5: DiseƱos en Cuadrados Greco Latino - DCGL: Generalidades

5.1 Video 5: DiseƱos en Cuadrados Greco Latino - DCGL: Generalidades

embed_youtube("H9MfiJVrDK0")

5.2 Ejemplo 4. (Texto Analisis y Diseno de Experimentos_Humberto-Roman_2da Ed_McGrawHill, pƔg. 63)

Ejemplo 5.2. Un investigador estÔ interesado en el efecto del porcentaje de lisina y del porcentaje de proteína en la producción de vacas lecheras. Se consideran siete niveles en cada factor.

% de lisina: 0.0 (A), 0.1 (B), 0.2 (C), 0.3 (D), 0.4 (E), 0.5 (F ), 0.6 (G).

% de proteĆ­na: 2 (\(\alpha\)), 4(\(\beta\)), 6( \(\chi\)), 8(\(\delta\)), 10(\(\epsilon\)), 12(\(\phi\)), 14(\(\gamma\)).

Para el estudio, se seleccionan siete vacas al azar, a las cuales se les da un seguimiento de siete periodos de tres meses. Los datos en galones de leche fueron los siguientes:

Cows Ā Period 1 2 3 4 5 6 7
1 304 436 350 504 417 519 432
(A\(\alpha\)) (B\(\epsilon\)) (C\(\beta\)) (D\(\phi\)) (E\(\chi\)) (F\(\gamma\)) (G\(\delta\))
2 381 505 425 564 494 350 413
(B\(\beta\)) (C\(\phi\)) (D\(\chi\)) (E\(\gamma\)) (F\(\delta\)) (G\(\alpha\)) (A\(\epsilon\))
3 432 566 479 357 461 340 502
(C\(\chi\)) (D\(\gamma\)) (E\(\delta\)) (F\(\alpha\)) (G\(\epsilon\)) (A\(\beta\)) (B\(\phi\))
4 442 372 536 366 495 425 507
(D\(\delta\)) (E\(\alpha\)) (F\(\epsilon\)) (G\(\beta\)) (A\(\phi\)) (B\(\chi\)) (C\(\gamma\))
5 496 449 493 345 509 481 380
(E\(\epsilon\)) (F\(\beta\)) (G\(\phi\)) (A\(\chi\)) (B\(\gamma\)) (C\(\delta\)) (D\(\alpha\))
6 534 421 452 427 346 478 397
(F\(\phi\)) (G\(\chi\)) (A\(\gamma\)) (B\(\delta\)) (C\(\alpha\)) (D\(\epsilon\)) (E\(\beta\))
7 543 386 435 485 406 554 410
(G\(\gamma\)) (A\(\delta\)) (B\(\alpha\)) (C\(\epsilon\)) (D\(\beta\)) (E\(\phi\)) (F\(\chi\))

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ## 5.3 Ingresando los datos en RStudio

(a) Primero creamos los vectores teniendo en cuenta que los factores se deben crear como factor.

Lisina = factor(c("A","B","C","D","E","F","G",
                       "B","C","D","E","F","G","A",
                       "C","D","E","F","G","A","B",
                       "D","E","F","G","A","B","C",
                       "E","F","G","A","B","C","D",
                       "F","G","A","B","C","D", "E",
                       "G","A","B","C","D", "E","F"))

Producción =c(304, 381, 432, 442, 496, 534, 543,
           436, 505, 566, 372, 449, 421, 386, 
           350, 425, 479, 536, 493, 452, 435,
           504, 564, 357, 366, 345, 427, 485,
           417, 494, 461, 495, 509, 346, 406,
           519, 350, 340, 425, 481, 478, 554,
           432, 413, 502, 507, 380, 397, 410)

Vaca =factor( c(rep("1",1), 
                rep("2",1), 
                rep("3",1), 
                rep("4",1), 
                rep("5",1),
                rep("6",1), 
                rep("7",1)))

Periodo = factor(c(rep("1",7),
                    rep("2",7),
                    rep("3",7),
                    rep("4",7),
                    rep("5",7),
                   rep("6",7),
                    rep("7",7)))
ProteĆ­na =factor(c("a","b","c","d","e", "f", "g", 
               "e","f","g","a","b", "c", "d",
               "b","c","d","e","f", "g", "a",
               "f", "g", "a","b","c","d","e",
               "c","d","e", "f", "g","a","b",
                "g","a","b","c","d","e", "f",
               "d","e", "f", "g","a","b","c")) 

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

(b) Se obtiene ahora la nueva tabla de datos del modelo

dataGreco = data.frame(Vaca,Periodo, Lisina, Proteína, Producción)

dataGreco

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

5.4 Analizando los datos en RStudio

(a) Para el próximo paso debemos descargar los siguientes paquetes (gridExtra) y (ggplot2)

library(gridExtra)
library(ggplot2)

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

(b) Diagramas de caja: Los siguientes son grƔficos descriptivos de los factores con la variable respuesta

Lisina2 <- ggplot(dataGreco, aes(x = Lisina, y = Producción, fill=Lisina)) +
  geom_boxplot() + theme(legend.position = "none")
Proteína2 <- ggplot(dataGreco, aes(x = Proteína, y = Producción, fill=Proteína)) +
  geom_boxplot() + theme(legend.position = "none")
Vaca2 <- ggplot(dataGreco, aes(x = Vaca, y = Producción, fill=Vaca)) +
  geom_boxplot() + theme(legend.position = "none")
Periodo2 <- ggplot(dataGreco, aes(x = Periodo, y = Producción, fill=Periodo)) +
  geom_boxplot() + theme(legend.position = "none")
grid.arrange(Lisina2,ProteĆ­na2,Vaca2,Periodo2, nrow=2,ncol=2)

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

(c) El Modelo linal y tabla ANOVA

modeloGreco= lm(Producción ~ Lisina + Vaca + Periodo  + Proteína, dataGreco)
anovaGreco=aov(modeloGreco)
anovaGreco
## Call:
##    aov(formula = modeloGreco)
## 
## Terms:
##                    Lisina      Vaca   Periodo  ProteĆ­na Residuals
## Sum of Squares   30718.24   5831.96   2124.24 160242.82  15544.41
## Deg. of Freedom         6         6         6         6        24
## 
## Residual standard error: 25.44963
## Estimated effects may be unbalanced
summary(anovaGreco)
##             Df Sum Sq Mean Sq F value   Pr(>F)    
## Lisina       6  30718    5120   7.905 8.98e-05 ***
## Vaca         6   5832     972   1.501    0.220    
## Periodo      6   2124     354   0.547    0.768    
## ProteĆ­na     6 160243   26707  41.235 1.75e-11 ***
## Residuals   24  15544     648                     
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

(d) Comparaciones mĆŗltiples: HSD de Tukey

TukeyHSD(anovaGreco)
##   Tukey multiple comparisons of means
##     95% family-wise confidence level
## 
## Fit: aov(formula = modeloGreco)
## 
## $Lisina
##           diff        lwr       upr     p adj
## B-A  54.285714  10.602565  97.96886 0.0084334
## C-A  53.000000   9.316850  96.68315 0.0105520
## D-A  66.571429  22.888279 110.25458 0.0009375
## E-A  77.714286  34.031136 121.39744 0.0001255
## F-A  80.571429  36.888279 124.25458 0.0000753
## G-A  47.285714   3.602565  90.96886 0.0278698
## C-B  -1.285714 -44.968864  42.39744 0.9999999
## D-B  12.285714 -31.397435  55.96886 0.9685039
## E-B  23.428571 -20.254578  67.11172 0.6087189
## F-B  26.285714 -17.397435  69.96886 0.4798768
## G-B  -7.000000 -50.683150  36.68315 0.9983751
## D-C  13.571429 -30.111721  57.25458 0.9496240
## E-C  24.714286 -18.968864  68.39744 0.5501792
## F-C  27.571429 -16.111721  71.25458 0.4246848
## G-C  -5.714286 -49.397435  37.96886 0.9994849
## E-D  11.142857 -32.540293  54.82601 0.9805282
## F-D  14.000000 -29.683150  57.68315 0.9419417
## G-D -19.285714 -62.968864  24.39744 0.7872452
## F-E   2.857143 -40.826007  46.54029 0.9999911
## G-E -30.428571 -74.111721  13.25458 0.3137926
## G-F -33.285714 -76.968864  10.39744 0.2230055
## 
## $Vaca
##            diff        lwr      upr     p adj
## 2-1  24.2857143 -19.397435 67.96886 0.5696607
## 3-1  25.0000000 -18.683150 68.68315 0.5372409
## 4-1  25.8571429 -17.826007 69.54029 0.4988057
## 5-1  27.2857143 -16.397435 70.96886 0.4367144
## 6-1  13.2857143 -30.397435 56.96886 0.9543493
## 7-1  36.7142857  -6.968864 80.39744 0.1415911
## 3-2   0.7142857 -42.968864 44.39744 1.0000000
## 4-2   1.5714286 -42.111721 45.25458 0.9999997
## 5-2   3.0000000 -40.683150 46.68315 0.9999881
## 6-2 -11.0000000 -54.683150 32.68315 0.9817515
## 7-2  12.4285714 -31.254578 56.11172 0.9667006
## 4-3   0.8571429 -42.826007 44.54029 1.0000000
## 5-3   2.2857143 -41.397435 45.96886 0.9999976
## 6-3 -11.7142857 -55.397435 31.96886 0.9750321
## 7-3  11.7142857 -31.968864 55.39744 0.9750321
## 5-4   1.4285714 -42.254578 45.11172 0.9999999
## 6-4 -12.5714286 -56.254578 31.11172 0.9648262
## 7-4  10.8571429 -32.826007 54.54029 0.9829176
## 6-5 -14.0000000 -57.683150 29.68315 0.9419417
## 7-5   9.4285714 -34.254578 53.11172 0.9917682
## 7-6  23.4285714 -20.254578 67.11172 0.6087189
## 
## $Periodo
##            diff       lwr      upr     p adj
## 2-1   0.4285714 -43.25458 44.11172 1.0000000
## 3-1   5.4285714 -38.25458 49.11172 0.9996162
## 4-1 -12.0000000 -55.68315 31.68315 0.9719025
## 5-1  -0.5714286 -44.25458 43.11172 1.0000000
## 6-1   2.1428571 -41.54029 45.82601 0.9999984
## 7-1 -13.0000000 -56.68315 30.68315 0.9587653
## 3-2   5.0000000 -38.68315 48.68315 0.9997612
## 4-2 -12.4285714 -56.11172 31.25458 0.9667006
## 5-2  -1.0000000 -44.68315 42.68315 1.0000000
## 6-2   1.7142857 -41.96886 45.39744 0.9999996
## 7-2 -13.4285714 -57.11172 30.25458 0.9520258
## 4-3 -17.4285714 -61.11172 26.25458 0.8537421
## 5-3  -6.0000000 -49.68315 37.68315 0.9993194
## 6-3  -3.2857143 -46.96886 40.39744 0.9999796
## 7-3 -18.4285714 -62.11172 25.25458 0.8193780
## 5-4  11.4285714 -32.25458 55.11172 0.9779036
## 6-4  14.1428571 -29.54029 57.82601 0.9392195
## 7-4  -1.0000000 -44.68315 42.68315 1.0000000
## 6-5   2.7142857 -40.96886 46.39744 0.9999934
## 7-5 -12.4285714 -56.11172 31.25458 0.9667006
## 7-6 -15.1428571 -58.82601 28.54029 0.9178534
## 
## $ProteĆ­na
##          diff        lwr       upr     p adj
## b-a  20.71429 -22.968864  64.39744 0.7291166
## c-a  47.28571   3.602565  90.96886 0.0278698
## d-a  85.28571  41.602565 128.96886 0.0000326
## e-a 108.71429  65.031136 152.39744 0.0000006
## f-a 149.00000 105.316850 192.68315 0.0000000
## g-a 159.42857 115.745422 203.11172 0.0000000
## c-b  26.57143 -17.111721  70.25458 0.4673904
## d-b  64.57143  20.888279 108.25458 0.0013458
## e-b  88.00000  44.316850 131.68315 0.0000203
## f-b 128.28571  84.602565 171.96886 0.0000000
## g-b 138.71429  95.031136 182.39744 0.0000000
## d-c  38.00000  -5.683150  81.68315 0.1181175
## e-c  61.42857  17.745422 105.11172 0.0023709
## f-c 101.71429  58.031136 145.39744 0.0000020
## g-c 112.14286  68.459707 155.82601 0.0000004
## e-d  23.42857 -20.254578  67.11172 0.6087189
## f-d  63.71429  20.031136 107.39744 0.0015710
## g-d  74.14286  30.459707 117.82601 0.0002385
## f-e  40.28571  -3.397435  83.96886 0.0844845
## g-e  50.71429   7.031136  94.39744 0.0156454
## g-f  10.42857 -33.254578  54.11172 0.9860875

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

(e) Comparaciones múltiples: grÔfico HSD de Tukey

plot(TukeyHSD(anovaGreco))

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

5.5. Pruebas de Medias por comparaciones MĆŗltiples

(a) (Prueba LSD). Instale el paquete ā€œagricolae

library(agricolae)

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

(b) Prueba LSD para Lisina

LSD.test(anovaGreco,"Lisina",console=TRUE)
## 
## Study: anovaGreco ~ "Lisina"
## 
## LSD t Test for Producción 
## 
## Mean Square Error:  647.6837 
## 
## Lisina,  means and individual ( 95 %) CI
## 
##   Producción      std r      LCL      UCL Min Max
## A   390.7143 67.49250 7 370.8615 410.5670 304 495
## B   445.0000 45.36151 7 425.1472 464.8528 381 509
## C   443.7143 69.90878 7 423.8615 463.5670 346 507
## D   457.2857 63.65196 7 437.4330 477.1385 380 566
## E   468.4286 75.68984 7 448.5758 488.2813 372 564
## F   471.2857 68.58988 7 451.4330 491.1385 357 536
## G   438.0000 68.10776 7 418.1472 457.8528 350 543
## 
## Alpha: 0.05 ; DF Error: 24
## Critical Value of t: 2.063899 
## 
## least Significant Difference: 28.07604 
## 
## Treatments with the same letter are not significantly different.
## 
##   Producción groups
## F   471.2857      a
## E   468.4286      a
## D   457.2857     ab
## B   445.0000     ab
## C   443.7143     ab
## G   438.0000      b
## A   390.7143      c

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

(c) Prueba LSD para ProteĆ­na

LSD.test(anovaGreco,"ProteĆ­na",console=TRUE)
## 
## Study: anovaGreco ~ "ProteĆ­na"
## 
## LSD t Test for Producción 
## 
## Mean Square Error:  647.6837 
## 
## ProteĆ­na,  means and individual ( 95 %) CI
## 
##   Producción      std r      LCL      UCL Min Max
## a   363.4286 39.84912 7 343.5758 383.2813 304 435
## b   384.1429 37.19959 7 364.2901 403.9956 340 449
## c   410.7143 29.79214 7 390.8615 430.5670 345 432
## d   448.7143 38.16506 7 428.8615 468.5670 386 494
## e   472.1429 40.36264 7 452.2901 491.9956 413 536
## f   512.4286 22.76589 7 492.5758 532.2813 493 554
## g   522.8571 39.66286 7 503.0044 542.7099 452 566
## 
## Alpha: 0.05 ; DF Error: 24
## Critical Value of t: 2.063899 
## 
## least Significant Difference: 28.07604 
## 
## Treatments with the same letter are not significantly different.
## 
##   Producción groups
## g   522.8571      a
## f   512.4286      a
## e   472.1429      b
## d   448.7143      b
## c   410.7143      c
## b   384.1429     cd
## a   363.4286      d

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

(d) Prueba LSD para vaca

LSD.test(anovaGreco,"Vaca",console=TRUE)
## 
## Study: anovaGreco ~ "Vaca"
## 
## LSD t Test for Producción 
## 
## Mean Square Error:  647.6837 
## 
## Vaca,  means and individual ( 95 %) CI
## 
##   Producción      std r      LCL      UCL Min Max
## 1   423.1429 76.97711 7 403.2901 442.9956 304 519
## 2   447.4286 76.01065 7 427.5758 467.2813 350 564
## 3   448.1429 79.76095 7 428.2901 467.9956 340 566
## 4   449.0000 66.44797 7 429.1472 468.8528 366 536
## 5   450.4286 63.68113 7 430.5758 470.2813 345 509
## 6   436.4286 59.93012 7 416.5758 456.2813 346 534
## 7   459.8571 68.15039 7 440.0044 479.7099 386 554
## 
## Alpha: 0.05 ; DF Error: 24
## Critical Value of t: 2.063899 
## 
## least Significant Difference: 28.07604 
## 
## Treatments with the same letter are not significantly different.
## 
##   Producción groups
## 7   459.8571      a
## 5   450.4286     ab
## 4   449.0000     ab
## 3   448.1429     ab
## 2   447.4286     ab
## 6   436.4286     ab
## 1   423.1429      b

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

(e) Prueba LSD para Periodo

LSD.test(anovaGreco,"Periodo",console=TRUE)
## 
## Study: anovaGreco ~ "Periodo"
## 
## LSD t Test for Producción 
## 
## Mean Square Error:  647.6837 
## 
## Periodo,  means and individual ( 95 %) CI
## 
##   Producción      std r      LCL      UCL Min Max
## 1   447.4286 85.86784 7 427.5758 467.2813 304 543
## 2   447.8571 67.90540 7 428.0044 467.7099 372 566
## 3   452.8571 58.99556 7 433.0044 472.7099 350 536
## 4   435.4286 84.56725 7 415.5758 455.2813 345 564
## 5   446.8571 59.63061 7 427.0044 466.7099 346 509
## 6   449.5714 81.69630 7 429.7187 469.4242 340 554
## 7   434.4286 50.42769 7 414.5758 454.2813 380 507
## 
## Alpha: 0.05 ; DF Error: 24
## Critical Value of t: 2.063899 
## 
## least Significant Difference: 28.07604 
## 
## Treatments with the same letter are not significantly different.
## 
##   Producción groups
## 3   452.8571      a
## 6   449.5714      a
## 2   447.8571      a
## 1   447.4286      a
## 5   446.8571      a
## 4   435.4286      a
## 7   434.4286      a

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

(f) Prueba de Tukey: Lisina

HSD.test(anovaGreco, "Lisina",console=TRUE)
## 
## Study: anovaGreco ~ "Lisina"
## 
## HSD Test for Producción 
## 
## Mean Square Error:  647.6837 
## 
## Lisina,  means
## 
##   Producción      std r Min Max
## A   390.7143 67.49250 7 304 495
## B   445.0000 45.36151 7 381 509
## C   443.7143 69.90878 7 346 507
## D   457.2857 63.65196 7 380 566
## E   468.4286 75.68984 7 372 564
## F   471.2857 68.58988 7 357 536
## G   438.0000 68.10776 7 350 543
## 
## Alpha: 0.05 ; DF Error: 24 
## Critical Value of Studentized Range: 4.541314 
## 
## Minimun Significant Difference: 43.68315 
## 
## Treatments with the same letter are not significantly different.
## 
##   Producción groups
## F   471.2857      a
## E   468.4286      a
## D   457.2857      a
## B   445.0000      a
## C   443.7143      a
## G   438.0000      a
## A   390.7143      b

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

(g) Prueba de Tukey: ProteĆ­na

HSD.test(anovaGreco, "ProteĆ­na",console=TRUE)
## 
## Study: anovaGreco ~ "ProteĆ­na"
## 
## HSD Test for Producción 
## 
## Mean Square Error:  647.6837 
## 
## ProteĆ­na,  means
## 
##   Producción      std r Min Max
## a   363.4286 39.84912 7 304 435
## b   384.1429 37.19959 7 340 449
## c   410.7143 29.79214 7 345 432
## d   448.7143 38.16506 7 386 494
## e   472.1429 40.36264 7 413 536
## f   512.4286 22.76589 7 493 554
## g   522.8571 39.66286 7 452 566
## 
## Alpha: 0.05 ; DF Error: 24 
## Critical Value of Studentized Range: 4.541314 
## 
## Minimun Significant Difference: 43.68315 
## 
## Treatments with the same letter are not significantly different.
## 
##   Producción groups
## g   522.8571      a
## f   512.4286     ab
## e   472.1429     bc
## d   448.7143     cd
## c   410.7143     de
## b   384.1429     ef
## a   363.4286      f

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

(h) Prueba de Student-Newman-Keuls (SNK)

SNK.test(anovaGreco, "Lisina",console=TRUE)
## 
## Study: anovaGreco ~ "Lisina"
## 
## Student Newman Keuls Test
## for Producción 
## 
## Mean Square Error:  647.6837 
## 
## Lisina,  means
## 
##   Producción      std r Min Max
## A   390.7143 67.49250 7 304 495
## B   445.0000 45.36151 7 381 509
## C   443.7143 69.90878 7 346 507
## D   457.2857 63.65196 7 380 566
## E   468.4286 75.68984 7 372 564
## F   471.2857 68.58988 7 357 536
## G   438.0000 68.10776 7 350 543
## 
## Alpha: 0.05 ; DF Error: 24 
## 
## Critical Range
##        2        3        4        5        6        7 
## 28.07603 33.97159 37.52646 40.07601 42.06077 43.68315 
## 
## Means with the same letter are not significantly different.
## 
##   Producción groups
## F   471.2857      a
## E   468.4286      a
## D   457.2857      a
## B   445.0000      a
## C   443.7143      a
## G   438.0000      a
## A   390.7143      b

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

(i) Prueba de ScheffƩ

scheffe.test(anovaGreco, "Lisina",console=TRUE)
## 
## Study: anovaGreco ~ "Lisina"
## 
## Scheffe Test for Producción 
## 
## Mean Square Error  : 647.6837 
## 
## Lisina,  means
## 
##   Producción      std r Min Max
## A   390.7143 67.49250 7 304 495
## B   445.0000 45.36151 7 381 509
## C   443.7143 69.90878 7 346 507
## D   457.2857 63.65196 7 380 566
## E   468.4286 75.68984 7 372 564
## F   471.2857 68.58988 7 357 536
## G   438.0000 68.10776 7 350 543
## 
## Alpha: 0.05 ; DF Error: 24 
## Critical Value of F: 2.508189 
## 
## Minimum Significant Difference: 52.77196 
## 
## Means with the same letter are not significantly different.
## 
##   Producción groups
## F   471.2857      a
## E   468.4286      a
## D   457.2857      a
## B   445.0000      a
## C   443.7143      a
## G   438.0000     ab
## A   390.7143      b

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

(j) Prueba de Duncan

duncan.test(anovaGreco, "Lisina",console=TRUE)
## 
## Study: anovaGreco ~ "Lisina"
## 
## Duncan's new multiple range test
## for Producción 
## 
## Mean Square Error:  647.6837 
## 
## Lisina,  means
## 
##   Producción      std r Min Max
## A   390.7143 67.49250 7 304 495
## B   445.0000 45.36151 7 381 509
## C   443.7143 69.90878 7 346 507
## D   457.2857 63.65196 7 380 566
## E   468.4286 75.68984 7 372 564
## F   471.2857 68.58988 7 357 536
## G   438.0000 68.10776 7 350 543
## 
## Alpha: 0.05 ; DF Error: 24 
## 
## Critical Range
##        2        3        4        5        6        7 
## 28.07603 29.48828 30.39500 31.03545 31.51352 31.88335 
## 
## Means with the same letter are not significantly different.
## 
##   Producción groups
## F   471.2857      a
## E   468.4286     ab
## D   457.2857     ab
## B   445.0000     ab
## C   443.7143     ab
## G   438.0000      b
## A   390.7143      c

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

(k) Prueba de Bonferroni

LSD.test(anovaGreco, "Lisina", p.adj= "bon",console=TRUE)
## 
## Study: anovaGreco ~ "Lisina"
## 
## LSD t Test for Producción 
## P value adjustment method: bonferroni 
## 
## Mean Square Error:  647.6837 
## 
## Lisina,  means and individual ( 95 %) CI
## 
##   Producción      std r      LCL      UCL Min Max
## A   390.7143 67.49250 7 370.8615 410.5670 304 495
## B   445.0000 45.36151 7 425.1472 464.8528 381 509
## C   443.7143 69.90878 7 423.8615 463.5670 346 507
## D   457.2857 63.65196 7 437.4330 477.1385 380 566
## E   468.4286 75.68984 7 448.5758 488.2813 372 564
## F   471.2857 68.58988 7 451.4330 491.1385 357 536
## G   438.0000 68.10776 7 418.1472 457.8528 350 543
## 
## Alpha: 0.05 ; DF Error: 24
## Critical Value of t: 3.395988 
## 
## Minimum Significant Difference: 46.19699 
## 
## Treatments with the same letter are not significantly different.
## 
##   Producción groups
## F   471.2857      a
## E   468.4286      a
## D   457.2857      a
## B   445.0000      a
## C   443.7143      a
## G   438.0000      a
## A   390.7143      b

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

5.6 Supuestos del Modelo en RStudio: Normalidad

(a) Normalidad de los residuos

shapiro.test(anovaGreco$res)
## 
##  Shapiro-Wilk normality test
## 
## data:  anovaGreco$res
## W = 0.97204, p-value = 0.2915

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

(b) Supuesto del modelo:Normalidad de los residuos

summary(anovaGreco$residuals)
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
## -31.531 -11.673  -3.245   0.000  10.469  48.612
sd((anovaGreco$residuals))
## [1] 17.99561

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

(c) Supuesto del modelo:Normalidad de los residuos

boxplot(anovaGreco$residuals,col="lightblue") 

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

(d) Supuesto del modelo:Normalidad de los residuos

hist(anovaGreco$residuals, col="lightgreen", main = "Histograma de los Residuos",
     freq = F, xlab="Residuos",ylab="Densidad")
lines(density(anovaGreco$residuals), col="red", lwd=3)

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

(e) ** Prueba de Normalidad con Q-Q Plot**

qqnorm(anovaGreco$residuals,col="blue", lwd=3) 
qqline(anovaGreco$residuals,col="red", lwd=3)

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

5.7. Supuestos del Modelo en RStudio: Supuesto de Independencia

(y) Supuesto de Independencia

plot(anovaGreco$residuals,main = "Residuos vs Observaciones",col="red", lwd=3) 

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

5.8. Supuestos del Modelo en RStudio: Supuesto de Homocedasticidad

(a) Homocedasticidad

boxplot(anovaGreco$residuals~Lisina, xlab="Lisina",ylab="Residuos",
        col = c("yellow", "blue", "white","green", "red")) # Homocedasticidad

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

(b) Homocedasticidad

boxplot(anovaGreco$residuals~ProteĆ­na, xlab="ProteĆ­na",ylab="Residuos",
        col = c("yellow", "blue", "white","green", "red")) # Homocedasticidad

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

(c) Homocedasticidad

boxplot(anovaGreco$residuals~Periodo, xlab="Periodo",ylab="Residuos",
        col = c("yellow", "blue", "white","green", "red")) # Homocedasticidad

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

(d) Homocedasticidad: GrƔfico de predichos contra residuos estandarizados

pred=fitted(anovaGreco)
resid=rstandard(anovaGreco)
plot(pred,resid,xlab="Valores predichos", ylab="Residuos estandarizados",abline(h=0),col="red", lwd=3)

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

(e) Homocedasticidad: Prueba de Bartlett para Lisina

bartlett.test(anovaGreco$residuals ~ Lisina)
## 
##  Bartlett test of homogeneity of variances
## 
## data:  anovaGreco$residuals by Lisina
## Bartlett's K-squared = 2.6611, df = 6, p-value = 0.85

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

(f) Homocedasticidad: Prueba de Bartlett para ProteĆ­na

bartlett.test(anovaGreco$residuals ~ ProteĆ­na)
## 
##  Bartlett test of homogeneity of variances
## 
## data:  anovaGreco$residuals by ProteĆ­na
## Bartlett's K-squared = 2.8279, df = 6, p-value = 0.8301

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

(g) Homocedasticidad: Prueba de Bartlett para ProteĆ­na

bartlett.test(anovaGreco$residuals ~ Periodo)
## 
##  Bartlett test of homogeneity of variances
## 
## data:  anovaGreco$residuals by Periodo
## Bartlett's K-squared = 5.1728, df = 6, p-value = 0.5218

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

5.9. Evaluación 5. DCGL

Ejemplo - DCGL. Si el enlace no lo lleva directamente, por favor copielo y peguelo directamente en su navegador <span

https://forms.gle/ierbMiggJX3P7Ze29

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

6.0 Tema 6: DiseƱo en Bloques Incompletos Balanceados - DBIB

6.1 Ejemplo 6. (Texto Analisis y Diseno de Experimentos_Humberto-Roman_2da Ed_McGrawHill, pƔg. 63)

Supongase que un ingeniero químico cree que el tiempo de reacción en un proceso químico es función del catalizador empleado. De hecho 4 catalizadores estan siendo investigados. El procedimiento experimental consiste en seleccionar un lote de materia prima, cargar una planta piloto, aplicar cada catalizador a ensayos separados de dicha planta y observar el tiempo de reacción. Debido a que las variaciones en los lotes de materia prima pueden afectar el comportamiento del catalizador, el ingeniero decide controlar este factor por medio de bloques. Sin embargo, cada lote es lo suficientemente grande para permitir el ensayo de 3 catalizadores únicamente. Por lo tanto, es necesario utilizar un diseño aleatoriazado por bloques incompletos. El diseño BIBD, junto con las observaciones recopiladas aparecen en la siguiente tabla:

BLOQUE 1 2 3 4
A 73 74 – 71
CATALIZADOR B – 75 67 72
C 73 75 68 –
D 75 – 72 75

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ## 6.2 Ingresando los datos en RStudio

(a) Primero creamos los vectores teniendo en cuenta que los factores se deben crear como factor.

set.seed(7638)
CATALIZADOR <- factor( rep( c("A", "A", "A","B","B","B","C","C","C","D" ,"D","D"), each = 1))
BLOQUE <- factor( rep( c("1", "2", "4", "2", "3", "4","1", "2", "3", "1", "3", "4"), each = 1))
f = PRODUCCION <- c(73, 74,  71,  75, 67, 72, 73, 75, 68,  75,  72, 75)

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

(b) Se obtiene ahora la nueva tabla de datos del modelo

DBIB <- data.frame(  BLOQUE, CATALIZADOR, f)
DBIB

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

6.3 Analizando los datos en RStudio

(a) Para el próximo paso debemos descargar los siguientes paquetes (gridExtra) y (ggplot2)

library(gridExtra)
library(ggplot2)

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

(b) Diagramas de caja: Los siguientes son grƔficos descriptivos de los factores con la variable respuesta

CATALIZADOR2 <- ggplot(DBIB, aes(x = CATALIZADOR, y = f, fill=CATALIZADOR)) +
  geom_boxplot() + theme(legend.position = "none")
BLOQUE2 <- ggplot(DBIB, aes(x = BLOQUE, y = f, fill=BLOQUE)) +
  geom_boxplot() + theme(legend.position = "none")
grid.arrange(CATALIZADOR2,BLOQUE2, nrow=1,ncol=2)

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

(c) El Modelo linal y tabla ANOVA

modeloDBIB= lm(f ~ BLOQUE+CATALIZADOR, DBIB)
anovaDBIB=aov(modeloDBIB)
anovaDBIB
## Call:
##    aov(formula = modeloDBIB)
## 
## Terms:
##                 BLOQUE CATALIZADOR Residuals
## Sum of Squares   55.00       22.75      3.25
## Deg. of Freedom      3           3         5
## 
## Residual standard error: 0.8062258
## Estimated effects may be unbalanced
summary(anovaDBIB)
##             Df Sum Sq Mean Sq F value  Pr(>F)   
## BLOQUE       3  55.00  18.333   28.20 0.00147 **
## CATALIZADOR  3  22.75   7.583   11.67 0.01074 * 
## Residuals    5   3.25   0.650                   
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

(d) Comparaciones mĆŗltiples: HSD de Tukey

TukeyHSD(anovaDBIB)
##   Tukey multiple comparisons of means
##     95% family-wise confidence level
## 
## Fit: aov(formula = modeloDBIB)
## 
## $BLOQUE
##          diff       lwr       upr     p adj
## 2-1  1.000000 -1.428998  3.428998 0.4917130
## 3-1 -4.666667 -7.095665 -2.237669 0.0032954
## 4-1 -1.000000 -3.428998  1.428998 0.4917130
## 3-2 -5.666667 -8.095665 -3.237669 0.0013433
## 4-2 -2.000000 -4.428998  0.428998 0.0975482
## 4-3  3.666667  1.237669  6.095665 0.0096068
## 
## $CATALIZADOR
##          diff        lwr      upr     p adj
## B-A 0.2222222 -2.2067758 2.651220 0.9852477
## C-A 0.5555556 -1.8734425 2.984554 0.8323947
## D-A 3.2222222  0.7932242 5.651220 0.0165827
## C-B 0.3333333 -2.0956647 2.762331 0.9540767
## D-B 3.0000000  0.5710020 5.428998 0.0222012
## D-C 2.6666667  0.2376686 5.095665 0.0352698

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

(e) Comparaciones múltiples: grÔfico HSD de Tukey

plot(TukeyHSD(anovaDBIB))

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

6.4 Pruebas de Medias por comparaciones MĆŗltiples

(a) (Prueba LSD). Instale el paquete ā€œagricolae

library(agricolae)

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

(b) Prueba LSD para CATALIZADOR

LSD.test(anovaDBIB,"CATALIZADOR",console=TRUE)
## 
## Study: anovaDBIB ~ "CATALIZADOR"
## 
## LSD t Test for f 
## 
## Mean Square Error:  0.65 
## 
## CATALIZADOR,  means and individual ( 95 %) CI
## 
##          f      std r      LCL      UCL Min Max
## A 72.66667 1.527525 3 71.47013 73.86321  71  74
## B 71.33333 4.041452 3 70.13679 72.52987  67  75
## C 72.00000 3.605551 3 70.80346 73.19654  68  75
## D 74.00000 1.732051 3 72.80346 75.19654  72  75
## 
## Alpha: 0.05 ; DF Error: 5
## Critical Value of t: 2.570582 
## 
## least Significant Difference: 1.692164 
## 
## Treatments with the same letter are not significantly different.
## 
##          f groups
## D 74.00000      a
## A 72.66667     ab
## C 72.00000      b
## B 71.33333      b
plot(LSD.test(anovaDBIB,"CATALIZADOR",console=TRUE))
## 
## Study: anovaDBIB ~ "CATALIZADOR"
## 
## LSD t Test for f 
## 
## Mean Square Error:  0.65 
## 
## CATALIZADOR,  means and individual ( 95 %) CI
## 
##          f      std r      LCL      UCL Min Max
## A 72.66667 1.527525 3 71.47013 73.86321  71  74
## B 71.33333 4.041452 3 70.13679 72.52987  67  75
## C 72.00000 3.605551 3 70.80346 73.19654  68  75
## D 74.00000 1.732051 3 72.80346 75.19654  72  75
## 
## Alpha: 0.05 ; DF Error: 5
## Critical Value of t: 2.570582 
## 
## least Significant Difference: 1.692164 
## 
## Treatments with the same letter are not significantly different.
## 
##          f groups
## D 74.00000      a
## A 72.66667     ab
## C 72.00000      b
## B 71.33333      b

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

(c) Prueba LSD para ProteĆ­na

LSD.test(anovaDBIB,"BLOQUE",console=TRUE)
## 
## Study: anovaDBIB ~ "BLOQUE"
## 
## LSD t Test for f 
## 
## Mean Square Error:  0.65 
## 
## BLOQUE,  means and individual ( 95 %) CI
## 
##          f       std r      LCL      UCL Min Max
## 1 73.66667 1.1547005 3 72.47013 74.86321  73  75
## 2 74.66667 0.5773503 3 73.47013 75.86321  74  75
## 3 69.00000 2.6457513 3 67.80346 70.19654  67  72
## 4 72.66667 2.0816660 3 71.47013 73.86321  71  75
## 
## Alpha: 0.05 ; DF Error: 5
## Critical Value of t: 2.570582 
## 
## least Significant Difference: 1.692164 
## 
## Treatments with the same letter are not significantly different.
## 
##          f groups
## 2 74.66667      a
## 1 73.66667     ab
## 4 72.66667      b
## 3 69.00000      c
plot(LSD.test(anovaDBIB,"BLOQUE",console=TRUE))
## 
## Study: anovaDBIB ~ "BLOQUE"
## 
## LSD t Test for f 
## 
## Mean Square Error:  0.65 
## 
## BLOQUE,  means and individual ( 95 %) CI
## 
##          f       std r      LCL      UCL Min Max
## 1 73.66667 1.1547005 3 72.47013 74.86321  73  75
## 2 74.66667 0.5773503 3 73.47013 75.86321  74  75
## 3 69.00000 2.6457513 3 67.80346 70.19654  67  72
## 4 72.66667 2.0816660 3 71.47013 73.86321  71  75
## 
## Alpha: 0.05 ; DF Error: 5
## Critical Value of t: 2.570582 
## 
## least Significant Difference: 1.692164 
## 
## Treatments with the same letter are not significantly different.
## 
##          f groups
## 2 74.66667      a
## 1 73.66667     ab
## 4 72.66667      b
## 3 69.00000      c

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

(d) Prueba de Tukey: Lisina

HSD.test(anovaDBIB, "CATALIZADOR",console=TRUE)
## 
## Study: anovaDBIB ~ "CATALIZADOR"
## 
## HSD Test for f 
## 
## Mean Square Error:  0.65 
## 
## CATALIZADOR,  means
## 
##          f      std r Min Max
## A 72.66667 1.527525 3  71  74
## B 71.33333 4.041452 3  67  75
## C 72.00000 3.605551 3  68  75
## D 74.00000 1.732051 3  72  75
## 
## Alpha: 0.05 ; DF Error: 5 
## Critical Value of Studentized Range: 5.218325 
## 
## Minimun Significant Difference: 2.428998 
## 
## Treatments with the same letter are not significantly different.
## 
##          f groups
## D 74.00000      a
## A 72.66667     ab
## C 72.00000     ab
## B 71.33333      b
plot(HSD.test(anovaDBIB, "CATALIZADOR",console=TRUE))
## 
## Study: anovaDBIB ~ "CATALIZADOR"
## 
## HSD Test for f 
## 
## Mean Square Error:  0.65 
## 
## CATALIZADOR,  means
## 
##          f      std r Min Max
## A 72.66667 1.527525 3  71  74
## B 71.33333 4.041452 3  67  75
## C 72.00000 3.605551 3  68  75
## D 74.00000 1.732051 3  72  75
## 
## Alpha: 0.05 ; DF Error: 5 
## Critical Value of Studentized Range: 5.218325 
## 
## Minimun Significant Difference: 2.428998 
## 
## Treatments with the same letter are not significantly different.
## 
##          f groups
## D 74.00000      a
## A 72.66667     ab
## C 72.00000     ab
## B 71.33333      b

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

(e) Prueba de Tukey: ProteĆ­na

HSD.test(anovaDBIB, "BLOQUE",console=TRUE)
## 
## Study: anovaDBIB ~ "BLOQUE"
## 
## HSD Test for f 
## 
## Mean Square Error:  0.65 
## 
## BLOQUE,  means
## 
##          f       std r Min Max
## 1 73.66667 1.1547005 3  73  75
## 2 74.66667 0.5773503 3  74  75
## 3 69.00000 2.6457513 3  67  72
## 4 72.66667 2.0816660 3  71  75
## 
## Alpha: 0.05 ; DF Error: 5 
## Critical Value of Studentized Range: 5.218325 
## 
## Minimun Significant Difference: 2.428998 
## 
## Treatments with the same letter are not significantly different.
## 
##          f groups
## 2 74.66667      a
## 1 73.66667      a
## 4 72.66667      a
## 3 69.00000      b
plot(HSD.test(anovaDBIB, "BLOQUE",console=TRUE))
## 
## Study: anovaDBIB ~ "BLOQUE"
## 
## HSD Test for f 
## 
## Mean Square Error:  0.65 
## 
## BLOQUE,  means
## 
##          f       std r Min Max
## 1 73.66667 1.1547005 3  73  75
## 2 74.66667 0.5773503 3  74  75
## 3 69.00000 2.6457513 3  67  72
## 4 72.66667 2.0816660 3  71  75
## 
## Alpha: 0.05 ; DF Error: 5 
## Critical Value of Studentized Range: 5.218325 
## 
## Minimun Significant Difference: 2.428998 
## 
## Treatments with the same letter are not significantly different.
## 
##          f groups
## 2 74.66667      a
## 1 73.66667      a
## 4 72.66667      a
## 3 69.00000      b

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

(f) Prueba de Student-Newman-Keuls (SNK)

SNK.test(anovaDBIB, "CATALIZADOR",console=TRUE)
## 
## Study: anovaDBIB ~ "CATALIZADOR"
## 
## Student Newman Keuls Test
## for f 
## 
## Mean Square Error:  0.65 
## 
## CATALIZADOR,  means
## 
##          f      std r Min Max
## A 72.66667 1.527525 3  71  74
## B 71.33333 4.041452 3  67  75
## C 72.00000 3.605551 3  68  75
## D 74.00000 1.732051 3  72  75
## 
## Alpha: 0.05 ; DF Error: 5 
## 
## Critical Range
##        2        3        4 
## 1.692164 2.141987 2.428998 
## 
## Means with the same letter are not significantly different.
## 
##          f groups
## D 74.00000      a
## A 72.66667     ab
## C 72.00000     ab
## B 71.33333      b
plot(SNK.test(anovaDBIB, "CATALIZADOR",console=TRUE))
## 
## Study: anovaDBIB ~ "CATALIZADOR"
## 
## Student Newman Keuls Test
## for f 
## 
## Mean Square Error:  0.65 
## 
## CATALIZADOR,  means
## 
##          f      std r Min Max
## A 72.66667 1.527525 3  71  74
## B 71.33333 4.041452 3  67  75
## C 72.00000 3.605551 3  68  75
## D 74.00000 1.732051 3  72  75
## 
## Alpha: 0.05 ; DF Error: 5 
## 
## Critical Range
##        2        3        4 
## 1.692164 2.141987 2.428998 
## 
## Means with the same letter are not significantly different.
## 
##          f groups
## D 74.00000      a
## A 72.66667     ab
## C 72.00000     ab
## B 71.33333      b

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

(g) Prueba de Student-Newman-Keuls (SNK)

SNK.test(anovaDBIB, "BLOQUE",console=TRUE)
## 
## Study: anovaDBIB ~ "BLOQUE"
## 
## Student Newman Keuls Test
## for f 
## 
## Mean Square Error:  0.65 
## 
## BLOQUE,  means
## 
##          f       std r Min Max
## 1 73.66667 1.1547005 3  73  75
## 2 74.66667 0.5773503 3  74  75
## 3 69.00000 2.6457513 3  67  72
## 4 72.66667 2.0816660 3  71  75
## 
## Alpha: 0.05 ; DF Error: 5 
## 
## Critical Range
##        2        3        4 
## 1.692164 2.141987 2.428998 
## 
## Means with the same letter are not significantly different.
## 
##          f groups
## 2 74.66667      a
## 1 73.66667      a
## 4 72.66667      a
## 3 69.00000      b
plot(SNK.test(anovaDBIB, "BLOQUE",console=TRUE))
## 
## Study: anovaDBIB ~ "BLOQUE"
## 
## Student Newman Keuls Test
## for f 
## 
## Mean Square Error:  0.65 
## 
## BLOQUE,  means
## 
##          f       std r Min Max
## 1 73.66667 1.1547005 3  73  75
## 2 74.66667 0.5773503 3  74  75
## 3 69.00000 2.6457513 3  67  72
## 4 72.66667 2.0816660 3  71  75
## 
## Alpha: 0.05 ; DF Error: 5 
## 
## Critical Range
##        2        3        4 
## 1.692164 2.141987 2.428998 
## 
## Means with the same letter are not significantly different.
## 
##          f groups
## 2 74.66667      a
## 1 73.66667      a
## 4 72.66667      a
## 3 69.00000      b

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

(h) Prueba de ScheffƩ

scheffe.test(anovaDBIB, "CATALIZADOR",console=TRUE)
## 
## Study: anovaDBIB ~ "CATALIZADOR"
## 
## Scheffe Test for f 
## 
## Mean Square Error  : 0.65 
## 
## CATALIZADOR,  means
## 
##          f      std r Min Max
## A 72.66667 1.527525 3  71  74
## B 71.33333 4.041452 3  67  75
## C 72.00000 3.605551 3  68  75
## D 74.00000 1.732051 3  72  75
## 
## Alpha: 0.05 ; DF Error: 5 
## Critical Value of F: 5.409451 
## 
## Minimum Significant Difference: 2.651846 
## 
## Means with the same letter are not significantly different.
## 
##          f groups
## D 74.00000      a
## A 72.66667     ab
## C 72.00000     ab
## B 71.33333      b
plot(scheffe.test(anovaDBIB, "CATALIZADOR",console=TRUE))
## 
## Study: anovaDBIB ~ "CATALIZADOR"
## 
## Scheffe Test for f 
## 
## Mean Square Error  : 0.65 
## 
## CATALIZADOR,  means
## 
##          f      std r Min Max
## A 72.66667 1.527525 3  71  74
## B 71.33333 4.041452 3  67  75
## C 72.00000 3.605551 3  68  75
## D 74.00000 1.732051 3  72  75
## 
## Alpha: 0.05 ; DF Error: 5 
## Critical Value of F: 5.409451 
## 
## Minimum Significant Difference: 2.651846 
## 
## Means with the same letter are not significantly different.
## 
##          f groups
## D 74.00000      a
## A 72.66667     ab
## C 72.00000     ab
## B 71.33333      b

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

(i) Prueba de ScheffƩ

scheffe.test(anovaDBIB, "BLOQUE",console=TRUE)
## 
## Study: anovaDBIB ~ "BLOQUE"
## 
## Scheffe Test for f 
## 
## Mean Square Error  : 0.65 
## 
## BLOQUE,  means
## 
##          f       std r Min Max
## 1 73.66667 1.1547005 3  73  75
## 2 74.66667 0.5773503 3  74  75
## 3 69.00000 2.6457513 3  67  72
## 4 72.66667 2.0816660 3  71  75
## 
## Alpha: 0.05 ; DF Error: 5 
## Critical Value of F: 5.409451 
## 
## Minimum Significant Difference: 2.651846 
## 
## Means with the same letter are not significantly different.
## 
##          f groups
## 2 74.66667      a
## 1 73.66667      a
## 4 72.66667      a
## 3 69.00000      b
plot(scheffe.test(anovaDBIB, "BLOQUE",console=TRUE))
## 
## Study: anovaDBIB ~ "BLOQUE"
## 
## Scheffe Test for f 
## 
## Mean Square Error  : 0.65 
## 
## BLOQUE,  means
## 
##          f       std r Min Max
## 1 73.66667 1.1547005 3  73  75
## 2 74.66667 0.5773503 3  74  75
## 3 69.00000 2.6457513 3  67  72
## 4 72.66667 2.0816660 3  71  75
## 
## Alpha: 0.05 ; DF Error: 5 
## Critical Value of F: 5.409451 
## 
## Minimum Significant Difference: 2.651846 
## 
## Means with the same letter are not significantly different.
## 
##          f groups
## 2 74.66667      a
## 1 73.66667      a
## 4 72.66667      a
## 3 69.00000      b

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

(j) Prueba de Duncan

duncan.test(anovaDBIB, "CATALIZADOR",console=TRUE)
## 
## Study: anovaDBIB ~ "CATALIZADOR"
## 
## Duncan's new multiple range test
## for f 
## 
## Mean Square Error:  0.65 
## 
## CATALIZADOR,  means
## 
##          f      std r Min Max
## A 72.66667 1.527525 3  71  74
## B 71.33333 4.041452 3  67  75
## C 72.00000 3.605551 3  68  75
## D 74.00000 1.732051 3  72  75
## 
## Alpha: 0.05 ; DF Error: 5 
## 
## Critical Range
##        2        3        4 
## 1.692164 1.744832 1.767154 
## 
## Means with the same letter are not significantly different.
## 
##          f groups
## D 74.00000      a
## A 72.66667     ab
## C 72.00000      b
## B 71.33333      b
plot(duncan.test(anovaDBIB, "CATALIZADOR",console=TRUE))
## 
## Study: anovaDBIB ~ "CATALIZADOR"
## 
## Duncan's new multiple range test
## for f 
## 
## Mean Square Error:  0.65 
## 
## CATALIZADOR,  means
## 
##          f      std r Min Max
## A 72.66667 1.527525 3  71  74
## B 71.33333 4.041452 3  67  75
## C 72.00000 3.605551 3  68  75
## D 74.00000 1.732051 3  72  75
## 
## Alpha: 0.05 ; DF Error: 5 
## 
## Critical Range
##        2        3        4 
## 1.692164 1.744832 1.767154 
## 
## Means with the same letter are not significantly different.
## 
##          f groups
## D 74.00000      a
## A 72.66667     ab
## C 72.00000      b
## B 71.33333      b

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

(k) Prueba de Duncan

duncan.test(anovaDBIB, "BLOQUE",console=TRUE)
## 
## Study: anovaDBIB ~ "BLOQUE"
## 
## Duncan's new multiple range test
## for f 
## 
## Mean Square Error:  0.65 
## 
## BLOQUE,  means
## 
##          f       std r Min Max
## 1 73.66667 1.1547005 3  73  75
## 2 74.66667 0.5773503 3  74  75
## 3 69.00000 2.6457513 3  67  72
## 4 72.66667 2.0816660 3  71  75
## 
## Alpha: 0.05 ; DF Error: 5 
## 
## Critical Range
##        2        3        4 
## 1.692164 1.744832 1.767154 
## 
## Means with the same letter are not significantly different.
## 
##          f groups
## 2 74.66667      a
## 1 73.66667     ab
## 4 72.66667      b
## 3 69.00000      c
plot(duncan.test(anovaDBIB, "BLOQUE",console=TRUE))
## 
## Study: anovaDBIB ~ "BLOQUE"
## 
## Duncan's new multiple range test
## for f 
## 
## Mean Square Error:  0.65 
## 
## BLOQUE,  means
## 
##          f       std r Min Max
## 1 73.66667 1.1547005 3  73  75
## 2 74.66667 0.5773503 3  74  75
## 3 69.00000 2.6457513 3  67  72
## 4 72.66667 2.0816660 3  71  75
## 
## Alpha: 0.05 ; DF Error: 5 
## 
## Critical Range
##        2        3        4 
## 1.692164 1.744832 1.767154 
## 
## Means with the same letter are not significantly different.
## 
##          f groups
## 2 74.66667      a
## 1 73.66667     ab
## 4 72.66667      b
## 3 69.00000      c

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

(k) Prueba de Bonferroni

LSD.test(anovaDBIB, "CATALIZADOR", p.adj= "bon",console=TRUE)
## 
## Study: anovaDBIB ~ "CATALIZADOR"
## 
## LSD t Test for f 
## P value adjustment method: bonferroni 
## 
## Mean Square Error:  0.65 
## 
## CATALIZADOR,  means and individual ( 95 %) CI
## 
##          f      std r      LCL      UCL Min Max
## A 72.66667 1.527525 3 71.47013 73.86321  71  74
## B 71.33333 4.041452 3 70.13679 72.52987  67  75
## C 72.00000 3.605551 3 70.80346 73.19654  68  75
## D 74.00000 1.732051 3 72.80346 75.19654  72  75
## 
## Alpha: 0.05 ; DF Error: 5
## Critical Value of t: 4.219309 
## 
## Minimum Significant Difference: 2.777489 
## 
## Treatments with the same letter are not significantly different.
## 
##          f groups
## D 74.00000      a
## A 72.66667      a
## C 72.00000      a
## B 71.33333      a
plot(LSD.test(anovaDBIB, "CATALIZADOR", p.adj= "bon",console=TRUE))
## 
## Study: anovaDBIB ~ "CATALIZADOR"
## 
## LSD t Test for f 
## P value adjustment method: bonferroni 
## 
## Mean Square Error:  0.65 
## 
## CATALIZADOR,  means and individual ( 95 %) CI
## 
##          f      std r      LCL      UCL Min Max
## A 72.66667 1.527525 3 71.47013 73.86321  71  74
## B 71.33333 4.041452 3 70.13679 72.52987  67  75
## C 72.00000 3.605551 3 70.80346 73.19654  68  75
## D 74.00000 1.732051 3 72.80346 75.19654  72  75
## 
## Alpha: 0.05 ; DF Error: 5
## Critical Value of t: 4.219309 
## 
## Minimum Significant Difference: 2.777489 
## 
## Treatments with the same letter are not significantly different.
## 
##          f groups
## D 74.00000      a
## A 72.66667      a
## C 72.00000      a
## B 71.33333      a

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

(l) Prueba de Bonferroni

LSD.test(anovaDBIB, "BLOQUE", p.adj= "bon",console=TRUE)
## 
## Study: anovaDBIB ~ "BLOQUE"
## 
## LSD t Test for f 
## P value adjustment method: bonferroni 
## 
## Mean Square Error:  0.65 
## 
## BLOQUE,  means and individual ( 95 %) CI
## 
##          f       std r      LCL      UCL Min Max
## 1 73.66667 1.1547005 3 72.47013 74.86321  73  75
## 2 74.66667 0.5773503 3 73.47013 75.86321  74  75
## 3 69.00000 2.6457513 3 67.80346 70.19654  67  72
## 4 72.66667 2.0816660 3 71.47013 73.86321  71  75
## 
## Alpha: 0.05 ; DF Error: 5
## Critical Value of t: 4.219309 
## 
## Minimum Significant Difference: 2.777489 
## 
## Treatments with the same letter are not significantly different.
## 
##          f groups
## 2 74.66667      a
## 1 73.66667      a
## 4 72.66667      a
## 3 69.00000      b
plot(LSD.test(anovaDBIB, "BLOQUE", p.adj= "bon",console=TRUE))
## 
## Study: anovaDBIB ~ "BLOQUE"
## 
## LSD t Test for f 
## P value adjustment method: bonferroni 
## 
## Mean Square Error:  0.65 
## 
## BLOQUE,  means and individual ( 95 %) CI
## 
##          f       std r      LCL      UCL Min Max
## 1 73.66667 1.1547005 3 72.47013 74.86321  73  75
## 2 74.66667 0.5773503 3 73.47013 75.86321  74  75
## 3 69.00000 2.6457513 3 67.80346 70.19654  67  72
## 4 72.66667 2.0816660 3 71.47013 73.86321  71  75
## 
## Alpha: 0.05 ; DF Error: 5
## Critical Value of t: 4.219309 
## 
## Minimum Significant Difference: 2.777489 
## 
## Treatments with the same letter are not significantly different.
## 
##          f groups
## 2 74.66667      a
## 1 73.66667      a
## 4 72.66667      a
## 3 69.00000      b

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

6.5 Supuestos del Modelo en RStudio: Normalidad

(a) Normalidad de los residuos

shapiro.test(anovaDBIB$res)
## 
##  Shapiro-Wilk normality test
## 
## data:  anovaDBIB$res
## W = 0.96945, p-value = 0.905

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

(b) Supuesto del modelo:Normalidad de los residuos

summary(anovaDBIB$residuals)
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##  -0.875  -0.375   0.000   0.000   0.375   0.875
sd((anovaDBIB$residuals))
## [1] 0.5435573

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

(c) Supuesto del modelo:Normalidad de los residuos

boxplot(anovaDBIB$residuals,col="lightblue") 

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

(d) Supuesto del modelo:Normalidad de los residuos

hist(anovaDBIB$residuals, col="lightgreen", main = "Histograma de los Residuos",
     freq = F, xlab="Residuos",ylab="Densidad")
lines(density(anovaDBIB$residuals), col="red", lwd=3)

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

(e) ** Prueba de Normalidad con Q-Q Plot**

qqnorm(anovaDBIB$residuals,col="blue", lwd=3) 
qqline(anovaDBIB$residuals,col="red", lwd=3)

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ## 6.6 Supuestos del Modelo en RStudio: Supuesto de Independencia

(y) Supuesto de Independencia

plot(anovaDBIB$residuals,main = "Residuos vs Observaciones",col="red", lwd=3) 

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

6.7 Supuestos del Modelo en RStudio: Supuesto de Homocedasticidad

(a) Homocedasticidad

boxplot(anovaDBIB$residuals~CATALIZADOR, xlab="CATALIZADOR",ylab="Residuos",
        col = c("yellow", "blue", "white","green", "red"))

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

(b) Homocedasticidad

boxplot(anovaDBIB$residuals~BLOQUE, xlab="BLOQUE",ylab="Residuos",
        col = c("yellow", "blue", "white","green", "red")) 

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

(c) Homocedasticidad: GrƔfico de predichos contra residuos estandarizados

pred=fitted(anovaDBIB)
resid=rstandard(anovaDBIB)
plot(pred,resid,xlab="Valores predichos", ylab="Residuos estandarizados",abline(h=0),col="red", lwd=3)

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

(f) Homocedasticidad: Prueba de Bartlett para ProteĆ­na

bartlett.test(anovaDBIB$residuals ~ CATALIZADOR)
## 
##  Bartlett test of homogeneity of variances
## 
## data:  anovaDBIB$residuals by CATALIZADOR
## Bartlett's K-squared = 4.2189, df = 3, p-value = 0.2388

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

(g) Homocedasticidad: Prueba de Bartlett para ProteĆ­na

bartlett.test(anovaDBIB$residuals ~ BLOQUE)
## 
##  Bartlett test of homogeneity of variances
## 
## data:  anovaDBIB$residuals by BLOQUE
## Bartlett's K-squared = 1.8464, df = 3, p-value = 0.6049

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

7.0 Tema 6: DiseƱos Factorial - Dos Factores: Generalidades y Ejemplo en Statgraphics

7.1 Video: DiseƱos Factorial - Dos Factores: Generalidades y Ejemplo en Statgraphics

embed_youtube("_5-L0gFtEdQ")

7.2 Ejemplo 6. (Texto Analisis y Diseno de Experimentos_Humberto-Roman_2da Ed_McGrawHill, pƔg. 134)

Problema: Consideremos un experimento en el que se quiere estudiar el efecto de los factores velocidad de alimentación y profundidad de corte sobre el acabado de un metal. Aunque los factores son de naturaleza continua, en este proceso sólo se pueden trabajar en 3 y 4 niveles, respectivamente. Por ello, se decide correr un factorial completo \(4x3\) con tres réplicas, que permitirÔ obtener toda la información relevante en relación al efecto de estos factores sobre el acabado. El acabado (Y) estÔ en unidades de gramos e interesa minimizar su valor

B: vel // A: Pro (pulg.) 0.15 0.18 0.21 0.24
74 79 82 99
0.20 64 68 88 104
60 73 92 96
92 98 99 104
0.25 86 104 108 110
88 88 95 99
99 104 108 114
0.30 98 99 110 111
102 95 99 107

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

7.3 Construyamos el diseƱo en R

(a) Construyamos el diseƱo en R

D2F <- expand.grid( A = c(0.15, 0.18, 0.21, 0.24), B = c(0.20, 0.25, 0.30) )
D2F<- rbind(D2F, D2F, D2F )
D2F
f = ACABADO <- c(74, 79, 82, 99, 92, 98, 99, 104, 99, 104, 108, 114, 64, 68, 88, 104, 86, 104, 108, 110, 98, 99, 110, 111, 60, 73, 92, 96, 88, 88, 95, 99, 102, 95, 99, 107)
D2F1 <- data.frame( D2F,  f)
D2F1

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

(b) Diagrama de Caja

plot(f ~ factor(A) * factor(B), data = D2F1, col=c("red", "blue", "yellow", "orange"))

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

7.4 Anova para el modelo bifactorial

(a) Anova para el modelo bifactorial

mod1 <- aov( f ~ factor(A) * factor(B), data = D2F1 )
summary(mod1)
##                     Df Sum Sq Mean Sq F value   Pr(>F)    
## factor(A)            3 2125.1   708.4  24.663 1.65e-07 ***
## factor(B)            2 3160.5  1580.3  55.018 1.09e-09 ***
## factor(A):factor(B)  6  557.1    92.8   3.232    0.018 *  
## Residuals           24  689.3    28.7                     
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

(b) Anova para el modelo bifactorial2 mƔs completo

g <- lm(f ~ factor(A) * factor(B), data = D2F1)
anova(g)
summary(g)
## 
## Call:
## lm(formula = f ~ factor(A) * factor(B), data = D2F1)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -8.6667 -3.6667 -0.3333  3.5833  8.0000 
## 
## Coefficients:
##                             Estimate Std. Error t value Pr(>|t|)    
## (Intercept)                  66.0000     3.0942  21.330  < 2e-16 ***
## factor(A)0.18                 7.3333     4.3759   1.676  0.10675    
## factor(A)0.21                21.3333     4.3759   4.875 5.70e-05 ***
## factor(A)0.24                33.6667     4.3759   7.694 6.25e-08 ***
## factor(B)0.25                22.6667     4.3759   5.180 2.64e-05 ***
## factor(B)0.3                 33.6667     4.3759   7.694 6.25e-08 ***
## factor(A)0.18:factor(B)0.25   0.6667     6.1884   0.108  0.91511    
## factor(A)0.21:factor(B)0.25  -9.3333     6.1884  -1.508  0.14456    
## factor(A)0.24:factor(B)0.25 -18.0000     6.1884  -2.909  0.00770 ** 
## factor(A)0.18:factor(B)0.3   -7.6667     6.1884  -1.239  0.22737    
## factor(A)0.21:factor(B)0.3  -15.3333     6.1884  -2.478  0.02065 *  
## factor(A)0.24:factor(B)0.3  -22.6667     6.1884  -3.663  0.00123 ** 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 5.359 on 24 degrees of freedom
## Multiple R-squared:  0.8945, Adjusted R-squared:  0.8461 
## F-statistic: 18.49 on 11 and 24 DF,  p-value: 4.111e-09

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

7.5 GrÔficos de Interacción

(a) GrÔficos de Interacción

with(D2F1, (interaction.plot(factor(A), factor(B), f, type = "b",pch = c(18,24,22), leg.bty = "o", main = "GrÔfico de interacción de Velocidad y Profundidad",xlab = "Profundidad",ylab = "f acabado", col=c("red", "blue", "yellow", "orange"))))

## NULL

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

(b) GrÔficos de Interacción

with(D2F1, (interaction.plot(factor(B), factor(A), f, type = "b",pch = c(18,24,22), leg.bty = "o", main = "GrÔficos de Interacción Velocidad y Profundidad",xlab = "Velocidad",ylab = "f acabado", col=c("darkred", "darkblue", "yellow", "darkorange"))))

## NULL

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

7.6 Prueba de Rangos MĆŗltiples: Prueba HSD de Tukey

(g) Prueba HSD de Tukey

TukeyHSD(mod1)
##   Tukey multiple comparisons of means
##     95% family-wise confidence level
## 
## Fit: aov(formula = f ~ factor(A) * factor(B), data = D2F1)
## 
## $`factor(A)`
##                diff         lwr      upr     p adj
## 0.18-0.15  5.000000 -1.96935966 11.96936 0.2236177
## 0.21-0.15 13.111111  6.14175145 20.08047 0.0001427
## 0.24-0.15 20.111111 13.14175145 27.08047 0.0000002
## 0.21-0.18  8.111111  1.14175145 15.08047 0.0183181
## 0.24-0.18 15.111111  8.14175145 22.08047 0.0000202
## 0.24-0.21  7.000000  0.03064034 13.96936 0.0487217
## 
## $`factor(B)`
##           diff       lwr      upr     p adj
## 0.25-0.2 16.00 10.536111 21.46389 0.0000004
## 0.3-0.2  22.25 16.786111 27.71389 0.0000000
## 0.3-0.25  6.25  0.786111 11.71389 0.0228257
## 
## $`factor(A):factor(B)`
##                            diff         lwr       upr     p adj
## 0.18:0.2-0.15:0.2     7.3333333  -8.4443944 23.111061 0.8621754
## 0.21:0.2-0.15:0.2    21.3333333   5.5556056 37.111061 0.0026516
## 0.24:0.2-0.15:0.2    33.6666667  17.8889389 49.444394 0.0000035
## 0.15:0.25-0.15:0.2   22.6666667   6.8889389 38.444394 0.0012723
## 0.18:0.25-0.15:0.2   30.6666667  14.8889389 46.444394 0.0000165
## 0.21:0.25-0.15:0.2   34.6666667  18.8889389 50.444394 0.0000021
## 0.24:0.25-0.15:0.2   38.3333333  22.5556056 54.111061 0.0000004
## 0.15:0.3-0.15:0.2    33.6666667  17.8889389 49.444394 0.0000035
## 0.18:0.3-0.15:0.2    33.3333333  17.5556056 49.111061 0.0000041
## 0.21:0.3-0.15:0.2    39.6666667  23.8889389 55.444394 0.0000002
## 0.24:0.3-0.15:0.2    44.6666667  28.8889389 60.444394 0.0000000
## 0.21:0.2-0.18:0.2    14.0000000  -1.7777277 29.777728 0.1156484
## 0.24:0.2-0.18:0.2    26.3333333  10.5556056 42.111061 0.0001693
## 0.15:0.25-0.18:0.2   15.3333333  -0.4443944 31.111061 0.0620975
## 0.18:0.25-0.18:0.2   23.3333333   7.5556056 39.111061 0.0008807
## 0.21:0.25-0.18:0.2   27.3333333  11.5556056 43.111061 0.0000982
## 0.24:0.25-0.18:0.2   31.0000000  15.2222723 46.777728 0.0000139
## 0.15:0.3-0.18:0.2    26.3333333  10.5556056 42.111061 0.0001693
## 0.18:0.3-0.18:0.2    26.0000000  10.2222723 41.777728 0.0002031
## 0.21:0.3-0.18:0.2    32.3333333  16.5556056 48.111061 0.0000069
## 0.24:0.3-0.18:0.2    37.3333333  21.5556056 53.111061 0.0000006
## 0.24:0.2-0.21:0.2    12.3333333  -3.4443944 28.111061 0.2331919
## 0.15:0.25-0.21:0.2    1.3333333 -14.4443944 17.111061 1.0000000
## 0.18:0.25-0.21:0.2    9.3333333  -6.4443944 25.111061 0.6067268
## 0.21:0.25-0.21:0.2   13.3333333  -2.4443944 29.111061 0.1548689
## 0.24:0.25-0.21:0.2   17.0000000   1.2222723 32.777728 0.0270232
## 0.15:0.3-0.21:0.2    12.3333333  -3.4443944 28.111061 0.2331919
## 0.18:0.3-0.21:0.2    12.0000000  -3.7777277 27.777728 0.2649724
## 0.21:0.3-0.21:0.2    18.3333333   2.5556056 34.111061 0.0134649
## 0.24:0.3-0.21:0.2    23.3333333   7.5556056 39.111061 0.0008807
## 0.15:0.25-0.24:0.2  -11.0000000 -26.7777277  4.777728 0.3773797
## 0.18:0.25-0.24:0.2   -3.0000000 -18.7777277 12.777728 0.9998762
## 0.21:0.25-0.24:0.2    1.0000000 -14.7777277 16.777728 1.0000000
## 0.24:0.25-0.24:0.2    4.6666667 -11.1110611 20.444394 0.9935407
## 0.15:0.3-0.24:0.2     0.0000000 -15.7777277 15.777728 1.0000000
## 0.18:0.3-0.24:0.2    -0.3333333 -16.1110611 15.444394 1.0000000
## 0.21:0.3-0.24:0.2     6.0000000  -9.7777277 21.777728 0.9585056
## 0.24:0.3-0.24:0.2    11.0000000  -4.7777277 26.777728 0.3773797
## 0.18:0.25-0.15:0.25   8.0000000  -7.7777277 23.777728 0.7881462
## 0.21:0.25-0.15:0.25  12.0000000  -3.7777277 27.777728 0.2649724
## 0.24:0.25-0.15:0.25  15.6666667  -0.1110611 31.444394 0.0528028
## 0.15:0.3-0.15:0.25   11.0000000  -4.7777277 26.777728 0.3773797
## 0.18:0.3-0.15:0.25   10.6666667  -5.1110611 26.444394 0.4200394
## 0.21:0.3-0.15:0.25   17.0000000   1.2222723 32.777728 0.0270232
## 0.24:0.3-0.15:0.25   22.0000000   6.2222723 37.777728 0.0018375
## 0.21:0.25-0.18:0.25   4.0000000 -11.7777277 19.777728 0.9982365
## 0.24:0.25-0.18:0.25   7.6666667  -8.1110611 23.444394 0.8270901
## 0.15:0.3-0.18:0.25    3.0000000 -12.7777277 18.777728 0.9998762
## 0.18:0.3-0.18:0.25    2.6666667 -13.1110611 18.444394 0.9999609
## 0.21:0.3-0.18:0.25    9.0000000  -6.7777277 24.777728 0.6544316
## 0.24:0.3-0.18:0.25   14.0000000  -1.7777277 29.777728 0.1156484
## 0.24:0.25-0.21:0.25   3.6666667 -12.1110611 19.444394 0.9991877
## 0.15:0.3-0.21:0.25   -1.0000000 -16.7777277 14.777728 1.0000000
## 0.18:0.3-0.21:0.25   -1.3333333 -17.1110611 14.444394 1.0000000
## 0.21:0.3-0.21:0.25    5.0000000 -10.7777277 20.777728 0.9888577
## 0.24:0.3-0.21:0.25   10.0000000  -5.7777277 25.777728 0.5112272
## 0.15:0.3-0.24:0.25   -4.6666667 -20.4443944 11.111061 0.9935407
## 0.18:0.3-0.24:0.25   -5.0000000 -20.7777277 10.777728 0.9888577
## 0.21:0.3-0.24:0.25    1.3333333 -14.4443944 17.111061 1.0000000
## 0.24:0.3-0.24:0.25    6.3333333  -9.4443944 22.111061 0.9410768
## 0.18:0.3-0.15:0.3    -0.3333333 -16.1110611 15.444394 1.0000000
## 0.21:0.3-0.15:0.3     6.0000000  -9.7777277 21.777728 0.9585056
## 0.24:0.3-0.15:0.3    11.0000000  -4.7777277 26.777728 0.3773797
## 0.21:0.3-0.18:0.3     6.3333333  -9.4443944 22.111061 0.9410768
## 0.24:0.3-0.18:0.3    11.3333333  -4.4443944 27.111061 0.3371703
## 0.24:0.3-0.21:0.3     5.0000000 -10.7777277 20.777728 0.9888577

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

7.7 DiseƱos Factorial - Dos Factores con Python

7.8 DiseƱos Factorial - 2x3 con Python

8.0 Tema 8: DiseƱos Factorial - Tres Factores

8.1. *Video: DiseƱos Factorial - Tres Factores: Generalidades y Ejemplo en Statgraphics**

embed_youtube("UxVEHWf-Fdw")

8.2 Tema 6: DiseƱos Factorial - Tres Factores: Usando RStudio

Ejemplo 8.2. (Texto Analisis y Diseno de Experimentos_Humberto-Roman_2da Ed_McGrawHill, pƔg. 143)

El experimento Se desea investigar el efecto del tipo de suspensión (A), abertura de malla (B) y temperatura de ciclaje (C) en el volumen de sedimentación Y(%) de una suspensión. Para ello se decide correr un experimento factorial 322 con seis réplicas, y las observaciones obtenidas en las 72 corridas experimentales se muestran en la siguiente tabla

: A1 // B: B1 B1 B1 B2 B2 B2
60 75 75 67 73 73
C1 86 70 70 67 68 68
55 53 53 52 52 57
C2 55 55 55 52 54 54
: A2 // B: B1 B1 B1 B2 B2 B2
62 68 65 71 80 80
C1 76 65 65 72 80 80
44 44 45 60 60 60
C2 48 48 45 67 67 65
: A3 // B: B1 B1 B1 B2 B2 B2
70 71 75 75 75 75
C1 76 68 73 75 75 77
52 51 50 56 55 57
C2 52 48 54 59 50 55

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

8.3 Ingresando los datos en RStudio

(a) (Ingresando los datos a R)

D3F <- expand.grid( A = c("A1", "A2", "A3"), B = c("B1", "B2"), C = c("C1", "C2") )
D3F
D3F<- rbind(D3F, D3F, D3F, D3F,D3F, D3F )
D3F
f = volumen <- c(60,62,70,67,71,75,55,44,54,52,60,55,86,68,71,73,80,75,53,48,48,52,60,57,75,65,75,73,80,75,53,44,52,57,60,50,75,76,76,67,72,75,55,45,50,52,67,55,70,65,68,68,80,75,55,48,51,54,67,56,70,65,73,68,80,77,55,45,52,54,65,  59)
D3F1 <- data.frame( D3F,  f)
D3F1

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

(b) Diagrama de Caja

plot(f ~ factor(A) * factor(B)* factor(C), data = D3F1, col=c("red", "blue", "yellow", "orange"))

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

8.4 Analizando los datos en RStudio

(a) Anova para el volumen de sedimentación

mod1 <- aov( f ~ factor(A) * factor(B)* factor(C), data = D3F1 )
summary(mod1)
##                               Df Sum Sq Mean Sq F value   Pr(>F)    
## factor(A)                      2     14       7   0.494   0.6126    
## factor(B)                      1    480     480  34.253 2.16e-07 ***
## factor(C)                      1   6087    6087 433.905  < 2e-16 ***
## factor(A):factor(B)            2    788     394  28.096 2.45e-09 ***
## factor(A):factor(C)            2     41      20   1.456   0.2412    
## factor(B):factor(C)            1     57      57   4.055   0.0485 *  
## factor(A):factor(B):factor(C)  2     31      16   1.106   0.3375    
## Residuals                     60    842      14                     
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

(b) Anova para el volumen de sedimentación completa

g <- lm(f ~ factor(A) * factor(B)* factor(C), data = D3F1)
anova(g)
summary(g)
## 
## Call:
## lm(formula = f ~ factor(A) * factor(B) * factor(C), data = D3F1)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -12.6667  -1.7083  -0.3333   2.3333  13.3333 
## 
## Coefficients:
##                                     Estimate Std. Error t value Pr(>|t|)    
## (Intercept)                           72.667      1.529  47.524  < 2e-16 ***
## factor(A)A2                           -5.833      2.162  -2.698  0.00905 ** 
## factor(A)A3                           -0.500      2.162  -0.231  0.81793    
## factor(B)B2                           -3.333      2.162  -1.542  0.12845    
## factor(C)C2                          -18.333      2.162  -8.478 7.52e-12 ***
## factor(A)A2:factor(B)B2               13.667      3.058   4.469 3.55e-05 ***
## factor(A)A3:factor(B)B2                6.500      3.058   2.126  0.03767 *  
## factor(A)A2:factor(C)C2               -2.833      3.058  -0.927  0.35789    
## factor(A)A3:factor(C)C2               -2.667      3.058  -0.872  0.38668    
## factor(B)B2:factor(C)C2                2.500      3.058   0.818  0.41687    
## factor(A)A2:factor(B)B2:factor(C)C2    4.667      4.325   1.079  0.28488    
## factor(A)A3:factor(B)B2:factor(C)C2   -1.500      4.325  -0.347  0.72993    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 3.745 on 60 degrees of freedom
## Multiple R-squared:  0.8991, Adjusted R-squared:  0.8806 
## F-statistic: 48.59 on 11 and 60 DF,  p-value: < 2.2e-16

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

8.5 Analizando los datos en RStudio: GrÔficos de Interacción

(a) GrÔficos de Interacción

with(D3F1, (interaction.plot(factor(A), factor(B), f, type = "b",pch = c(18,24,22), leg.bty = "o", main = "GrÔficos de Interacción Suspensión y Abertura",xlab = "Suspensión",ylab = "f Volumen", col=c("red", "blue", "yellow", "orange"))))

## NULL

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

(b)GrÔficos de Interacción

with(D3F1, (interaction.plot(factor(A), factor(C), f, type = "b",pch = c(18,24,22), leg.bty = "o", main = "GrÔficos de Interacción Suspensión y Temperatura",xlab = "Suspensión",ylab = "f Volumen", col=c("red", "blue", "yellow", "orange"))))

## NULL

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

(c)GrÔficos de Interacción

with(D3F1, (interaction.plot(factor(B), factor(C), f, type = "b",pch = c(18,24,22), leg.bty = "o", main = "GrÔficos de Interacción Abertura y Temperatura",xlab = "Abertura",ylab = "f Volumen", col=c("red", "blue", "yellow", "orange"))))

## NULL

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

8.6 Pruebas de Medias por comparaciones MĆŗltiples

(a)Prueba HSD de Tukey

TukeyHSD(mod1)
##   Tukey multiple comparisons of means
##     95% family-wise confidence level
## 
## Fit: aov(formula = f ~ factor(A) * factor(B) * factor(C), data = D3F1)
## 
## $`factor(A)`
##            diff       lwr      upr     p adj
## A2-A1 0.7500000 -1.848344 3.348344 0.7680852
## A3-A1 1.0416667 -1.556678 3.640011 0.6026331
## A3-A2 0.2916667 -2.306678 2.890011 0.9607046
## 
## $`factor(B)`
##           diff      lwr      upr p adj
## B2-B1 5.166667 3.400821 6.932513 2e-07
## 
## $`factor(C)`
##            diff       lwr       upr p adj
## C2-C1 -18.38889 -20.15473 -16.62304     0
## 
## $`factor(A):factor(B)`
##                  diff         lwr        upr     p adj
## A2:B1-A1:B1 -7.250000 -11.7511865 -2.7488135 0.0001895
## A3:B1-A1:B1 -1.833333  -6.3345198  2.6678531 0.8356078
## A1:B2-A1:B1 -2.083333  -6.5845198  2.4178531 0.7488090
## A2:B2-A1:B1  6.666667   2.1654802 11.1678531 0.0007097
## A3:B2-A1:B1  1.833333  -2.6678531  6.3345198 0.8356078
## A3:B1-A2:B1  5.416667   0.9154802  9.9178531 0.0096192
## A1:B2-A2:B1  5.166667   0.6654802  9.6678531 0.0154752
## A2:B2-A2:B1 13.916667   9.4154802 18.4178531 0.0000000
## A3:B2-A2:B1  9.083333   4.5821469 13.5845198 0.0000023
## A1:B2-A3:B1 -0.250000  -4.7511865  4.2511865 0.9999829
## A2:B2-A3:B1  8.500000   3.9988135 13.0011865 0.0000096
## A3:B2-A3:B1  3.666667  -0.8345198  8.1678531 0.1734453
## A2:B2-A1:B2  8.750000   4.2488135 13.2511865 0.0000052
## A3:B2-A1:B2  3.916667  -0.5845198  8.4178531 0.1230911
## A3:B2-A2:B2 -4.833333  -9.3345198 -0.3321469 0.0283481
## 
## $`factor(A):factor(C)`
##                    diff        lwr        upr     p adj
## A2:C1-A1:C1   1.0000000  -3.501186   5.501186 0.9861601
## A3:C1-A1:C1   2.7500000  -1.751186   7.251186 0.4744663
## A1:C2-A1:C1 -17.0833333 -21.584520 -12.582147 0.0000000
## A2:C2-A1:C1 -16.5833333 -21.084520 -12.082147 0.0000000
## A3:C2-A1:C1 -17.7500000 -22.251186 -13.248814 0.0000000
## A3:C1-A2:C1   1.7500000  -2.751186   6.251186 0.8606445
## A1:C2-A2:C1 -18.0833333 -22.584520 -13.582147 0.0000000
## A2:C2-A2:C1 -17.5833333 -22.084520 -13.082147 0.0000000
## A3:C2-A2:C1 -18.7500000 -23.251186 -14.248814 0.0000000
## A1:C2-A3:C1 -19.8333333 -24.334520 -15.332147 0.0000000
## A2:C2-A3:C1 -19.3333333 -23.834520 -14.832147 0.0000000
## A3:C2-A3:C1 -20.5000000 -25.001186 -15.998814 0.0000000
## A2:C2-A1:C2   0.5000000  -4.001186   5.001186 0.9994780
## A3:C2-A1:C2  -0.6666667  -5.167853   3.834520 0.9979060
## A3:C2-A2:C2  -1.1666667  -5.667853   3.334520 0.9726219
## 
## $`factor(B):factor(C)`
##                   diff          lwr        upr     p adj
## B2:C1-B1:C1   3.388889   0.08981796   6.687960 0.0418949
## B1:C2-B1:C1 -20.166667 -23.46573760 -16.867596 0.0000000
## B2:C2-B1:C1 -13.222222 -16.52129315  -9.923151 0.0000000
## B1:C2-B2:C1 -23.555556 -26.85462649 -20.256485 0.0000000
## B2:C2-B2:C1 -16.611111 -19.91018204 -13.312040 0.0000000
## B2:C2-B1:C2   6.944444   3.64537351  10.243515 0.0000038
## 
## $`factor(A):factor(B):factor(C)`
##                          diff         lwr         upr     p adj
## A2:B1:C1-A1:B1:C1  -5.8333333 -13.1856861   1.5190194 0.2527629
## A3:B1:C1-A1:B1:C1  -0.5000000  -7.8523528   6.8523528 1.0000000
## A1:B2:C1-A1:B1:C1  -3.3333333 -10.6856861   4.0190194 0.9223912
## A2:B2:C1-A1:B1:C1   4.5000000  -2.8523528  11.8523528 0.6375599
## A3:B2:C1-A1:B1:C1   2.6666667  -4.6856861  10.0190194 0.9839113
## A1:B1:C2-A1:B1:C1 -18.3333333 -25.6856861 -10.9809806 0.0000000
## A2:B1:C2-A1:B1:C1 -27.0000000 -34.3523528 -19.6476472 0.0000000
## A3:B1:C2-A1:B1:C1 -21.5000000 -28.8523528 -14.1476472 0.0000000
## A1:B2:C2-A1:B1:C1 -19.1666667 -26.5190194 -11.8143139 0.0000000
## A2:B2:C2-A1:B1:C1  -9.5000000 -16.8523528  -2.1476472 0.0025052
## A3:B2:C2-A1:B1:C1 -17.3333333 -24.6856861  -9.9809806 0.0000000
## A3:B1:C1-A2:B1:C1   5.3333333  -2.0190194  12.6856861 0.3802875
## A1:B2:C1-A2:B1:C1   2.5000000  -4.8523528   9.8523528 0.9903398
## A2:B2:C1-A2:B1:C1  10.3333333   2.9809806  17.6856861 0.0006757
## A3:B2:C1-A2:B1:C1   8.5000000   1.1476472  15.8523528 0.0109430
## A1:B1:C2-A2:B1:C1 -12.5000000 -19.8523528  -5.1476472 0.0000176
## A2:B1:C2-A2:B1:C1 -21.1666667 -28.5190194 -13.8143139 0.0000000
## A3:B1:C2-A2:B1:C1 -15.6666667 -23.0190194  -8.3143139 0.0000001
## A1:B2:C2-A2:B1:C1 -13.3333333 -20.6856861  -5.9809806 0.0000041
## A2:B2:C2-A2:B1:C1  -3.6666667 -11.0190194   3.6856861 0.8630813
## A3:B2:C2-A2:B1:C1 -11.5000000 -18.8523528  -4.1476472 0.0000982
## A1:B2:C1-A3:B1:C1  -2.8333333 -10.1856861   4.5190194 0.9745590
## A2:B2:C1-A3:B1:C1   5.0000000  -2.3523528  12.3523528 0.4796825
## A3:B2:C1-A3:B1:C1   3.1666667  -4.1856861  10.5190194 0.9443710
## A1:B1:C2-A3:B1:C1 -17.8333333 -25.1856861 -10.4809806 0.0000000
## A2:B1:C2-A3:B1:C1 -26.5000000 -33.8523528 -19.1476472 0.0000000
## A3:B1:C2-A3:B1:C1 -21.0000000 -28.3523528 -13.6476472 0.0000000
## A1:B2:C2-A3:B1:C1 -18.6666667 -26.0190194 -11.3143139 0.0000000
## A2:B2:C2-A3:B1:C1  -9.0000000 -16.3523528  -1.6476472 0.0053152
## A3:B2:C2-A3:B1:C1 -16.8333333 -24.1856861  -9.4809806 0.0000000
## A2:B2:C1-A1:B2:C1   7.8333333   0.4809806  15.1856861 0.0271441
## A3:B2:C1-A1:B2:C1   6.0000000  -1.3523528  13.3523528 0.2172776
## A1:B1:C2-A1:B2:C1 -15.0000000 -22.3523528  -7.6476472 0.0000002
## A2:B1:C2-A1:B2:C1 -23.6666667 -31.0190194 -16.3143139 0.0000000
## A3:B1:C2-A1:B2:C1 -18.1666667 -25.5190194 -10.8143139 0.0000000
## A1:B2:C2-A1:B2:C1 -15.8333333 -23.1856861  -8.4809806 0.0000000
## A2:B2:C2-A1:B2:C1  -6.1666667 -13.5190194   1.1856861 0.1854455
## A3:B2:C2-A1:B2:C1 -14.0000000 -21.3523528  -6.6476472 0.0000012
## A3:B2:C1-A2:B2:C1  -1.8333333  -9.1856861   5.5190194 0.9993589
## A1:B1:C2-A2:B2:C1 -22.8333333 -30.1856861 -15.4809806 0.0000000
## A2:B1:C2-A2:B2:C1 -31.5000000 -38.8523528 -24.1476472 0.0000000
## A3:B1:C2-A2:B2:C1 -26.0000000 -33.3523528 -18.6476472 0.0000000
## A1:B2:C2-A2:B2:C1 -23.6666667 -31.0190194 -16.3143139 0.0000000
## A2:B2:C2-A2:B2:C1 -14.0000000 -21.3523528  -6.6476472 0.0000012
## A3:B2:C2-A2:B2:C1 -21.8333333 -29.1856861 -14.4809806 0.0000000
## A1:B1:C2-A3:B2:C1 -21.0000000 -28.3523528 -13.6476472 0.0000000
## A2:B1:C2-A3:B2:C1 -29.6666667 -37.0190194 -22.3143139 0.0000000
## A3:B1:C2-A3:B2:C1 -24.1666667 -31.5190194 -16.8143139 0.0000000
## A1:B2:C2-A3:B2:C1 -21.8333333 -29.1856861 -14.4809806 0.0000000
## A2:B2:C2-A3:B2:C1 -12.1666667 -19.5190194  -4.8143139 0.0000314
## A3:B2:C2-A3:B2:C1 -20.0000000 -27.3523528 -12.6476472 0.0000000
## A2:B1:C2-A1:B1:C2  -8.6666667 -16.0190194  -1.3143139 0.0086330
## A3:B1:C2-A1:B1:C2  -3.1666667 -10.5190194   4.1856861 0.9443710
## A1:B2:C2-A1:B1:C2  -0.8333333  -8.1856861   6.5190194 0.9999998
## A2:B2:C2-A1:B1:C2   8.8333333   1.4809806  16.1856861 0.0067858
## A3:B2:C2-A1:B1:C2   1.0000000  -6.3523528   8.3523528 0.9999985
## A3:B1:C2-A2:B1:C2   5.5000000  -1.8523528  12.8523528 0.3344782
## A1:B2:C2-A2:B1:C2   7.8333333   0.4809806  15.1856861 0.0271441
## A2:B2:C2-A2:B1:C2  17.5000000  10.1476472  24.8523528 0.0000000
## A3:B2:C2-A2:B1:C2   9.6666667   2.3143139  17.0190194 0.0019379
## A1:B2:C2-A3:B1:C2   2.3333333  -5.0190194   9.6856861 0.9945288
## A2:B2:C2-A3:B1:C2  12.0000000   4.6476472  19.3523528 0.0000418
## A3:B2:C2-A3:B1:C2   4.1666667  -3.1856861  11.5190194 0.7380170
## A2:B2:C2-A1:B2:C2   9.6666667   2.3143139  17.0190194 0.0019379
## A3:B2:C2-A1:B2:C2   1.8333333  -5.5190194   9.1856861 0.9993589
## A3:B2:C2-A2:B2:C2  -7.8333333 -15.1856861  -0.4809806 0.0271441

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

(b) Prueba HSD de Tukey

TukeyHSD(mod1, "factor(A)")
##   Tukey multiple comparisons of means
##     95% family-wise confidence level
## 
## Fit: aov(formula = f ~ factor(A) * factor(B) * factor(C), data = D3F1)
## 
## $`factor(A)`
##            diff       lwr      upr     p adj
## A2-A1 0.7500000 -1.848344 3.348344 0.7680852
## A3-A1 1.0416667 -1.556678 3.640011 0.6026331
## A3-A2 0.2916667 -2.306678 2.890011 0.9607046
plot(TukeyHSD(mod1, "factor(A)"))

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

(c) Prueba HSD de Tukey

TukeyHSD(mod1, "factor(B)")
##   Tukey multiple comparisons of means
##     95% family-wise confidence level
## 
## Fit: aov(formula = f ~ factor(A) * factor(B) * factor(C), data = D3F1)
## 
## $`factor(B)`
##           diff      lwr      upr p adj
## B2-B1 5.166667 3.400821 6.932513 2e-07
plot(TukeyHSD(mod1, "factor(B)"))

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

(d) Prueba HSD de Tukey

TukeyHSD(mod1, "factor(C)")
##   Tukey multiple comparisons of means
##     95% family-wise confidence level
## 
## Fit: aov(formula = f ~ factor(A) * factor(B) * factor(C), data = D3F1)
## 
## $`factor(C)`
##            diff       lwr       upr p adj
## C2-C1 -18.38889 -20.15473 -16.62304     0
plot(TukeyHSD(mod1, "factor(C)"))

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

8.7 DiseƱos Factorial - Tres Factores con Python

8.8 DiseƱos Factorial Tres Factores - 2x2x3 con Python

8.9. Evaluación 6. Diseño Factorial I

Ejemplo - DiseƱo Factorial I. Si el enlace no lo lleva directamente, por favor copielo y peguelo directamente en su navegador <span

https://forms.gle/vULzw9JY4Z4vGb2t6

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

8.10. Evaluación 7. Diseño Factorial II

Ejemplo - DiseƱo Factorial II. Si el enlace no lo lleva directamente, por favor copielo y peguelo directamente en su navegador <span

https://forms.gle/DYb3BmWNY75JHk2r8

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

9.0 Tema 9: Diseños Factorial - Tres Factores: Ejemplo Cultivo comercial del Camarón

9.1. Video 9: Diseños Factorial - Tres Factores: Ejemplo Cultivo comercial del Camarón y Ejemplo en Statgraphics

embed_youtube("b-ubtPfkJ1E")

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

10.0 Tema 10: DiseƱos Completos Aleatorizados Usando RStudio

10.1. Video 10: DiseƱos Completos Aleatorizados Usando RStudio

embed_youtube("pFpH1eCkZ7w")

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

11.0 Tema 11: DiseƱos Factoriales \(2^k\) Usando RStudio: Generalidades

11.1. Video 11: DiseƱos Factoriales \(2^2\) Usando RStudio: Generalidades

embed_youtube("g0JTxEdO2Gc")

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

12.0 Tema 12: DiseƱos Factoriales \(2^k\) Usando Statgraphics: Generalidades

12.1. Video 12: DiseƱos Factoriales \(2^3\) Usando Statgraphics: Generalidades

embed_youtube("mEbaEhf6yv0")

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

12.2. Evaluación 8. Diseño Factorial \(2^k\)

Ejemplo - DiseƱo Factorial II. Si el enlace no lo lleva directamente, por favor copielo y peguelo directamente en su navegador <span

https://forms.gle/dSTpwtcYawFmtEPC9

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

12.3. Evaluación 9. Diseño Factorial \(2^k\)

Ejemplo - DiseƱo Factorial II. Si el enlace no lo lleva directamente, por favor copielo y peguelo directamente en su navegador <span

https://forms.gle/hhAQ7VUnkdfUMWQL9

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

12.4 DiseƱo Factorial \(2^2\) No balancedo usando Python

13.0 Tema 13: DiseƱos Factoriales \(2^4\) Usando Statgraphics: Generalidades

13.1. Video 13: DiseƱos Factoriales \(2^4\) Usando Statgraphics: Generalidades

embed_youtube("2Ly5vXlxiQ8")

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

14.0 Tema 14: DiseƱos Factoriales \(2^5\) Usando Statgraphics: Colasando un DiseƱo

14.1. Video 14: DiseƱos Factoriales \(2^5\) Usando Statgraphics: Colasando un DiseƱo

embed_youtube("Qtd9sKAKenE")

14.2. Video 15: DiseƱos Factoriales \(2^5\) Usando Statgraphics: Colasando un DiseƱo

embed_youtube("aAhXxjK9sZk")

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

14.3 Tema 14: DiseƱos Factoriales \(2^5\) Usando Python

https://github.com/JSEFERINO/JSEFERINO/blob/main/DOEJH10.ipynb

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

14.4 Tema 14: DiseƱos Factoriales \(2^6\) Usando Python

https://github.com/JSEFERINO/JSEFERINO/blob/main/DOEJH12.ipynb

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

15.0 Tema 15: DiseƱos Factoriales fraccionados \(2^(k-p)\) Usando Statgraphics: Generalidades

15.1. Video 15: DiseƱos Factoriales \(2^5\) Usando Statgraphics: Generalidades

embed_youtube("go1NKeLvHv4")

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

16.0 Tema 16: DiseƱos de Superficie de respuesta - Generalidaddes

16.1. Video 16: DiseƱos de Superficie de respuesta - Generalidaddes

embed_youtube("ql9DFse9bb8")

16.1. Video 16: DiseƱos de Superficie de respuesta - Ejemplo ilustrativo

embed_youtube("SmyY5erS-WA")

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

16.2. Evaluación 10. Diseño en Superficie de Respuesta

Ejemplo - DiseƱo en Superficie de Respuesta. Si el enlace no lo lleva directamente, por favor copielo y peguelo directamente en su navegador <span

https://forms.gle/t3Bymt5WwMzQvEVg8

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

7.0 Tema 7: Experimento 2^5 no replicado

7.1 Ejemplo 7. (Texto Analisis y Diseno de Experimentos_Humberto-Roman_2da Ed_McGrawHill, pƔg. 63)

SEn una planta donde se fabrican semiconductores se quiere mejorar el rendimiento del proceso vƭa diseƱo de experimentos. De acuerdo con la experiencia del grupo de mejora, los factores que podrƭan tener mayor influencia sobre la variable de respuesta (rendimiento), asƭ como los niveles de prueba utilizados son los siguientes:

A = Nivel de la abertura (pequeƱa, grande).

B = Tiempo de exposición (20% abajo, 20% arriba).

C = Tiempo de revelado (30 seg, 45 seg).

D = Dimensión de la mÔscara (pequeña, grande).

E = Tiempo de grabado (14.5 min, 15.5 min).

Se decide correr un experimento \(2^5\) con una sola corrida o rƩplica para estudiar estos cinco factores. Se hacen las 32 corridas a nivel proceso.*

(1)=7 d=8 e=8 de=6
a=9 ad=10 ae=12 ade=10
b=34 bd=32 be=35 bde=30
ab=55 abd=50 abe=52 abde=53
c=16 cd=18 ce=15 cde=15
ac=20 acd=21 ace=22 acde=20
bc=41 bcd=44 bce=45 bcde=41
abc=60 abcd=61 abce=65 abcde=63

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

2.2 Ingresando los datos en RStudio

(a) Primero creamos los vectores teniendo en cuenta que los factores se deben crear como factor.

V.sanguĆ­neo =c(4.1, 6.5,4.1, 4.9,
               4.1, 5.3, 4.0, 6.2, 
               6.5, 6.9, 4.5,  4.8, 
               4.3, 6.8, 4.3,4.2, 
               6.0, 6.5,4.1, 6.9)

Tratamientos =factor( c(rep("A",1), 
                rep("B",1), 
                rep("C",1), 
                rep("D",1)))

Bloques = factor(c(rep("I",4),
                    rep("II",4),
                    rep("III",4),
                    rep("IV",4),
                    rep("V",4))) 

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

(b) Se obtiene ahora la nueva tabla de datos del modelo

DBCA1 = data.frame(Bloques,Tratamientos, V.sanguĆ­neo)

DBCA1

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

2.3 Analizando los datos en RStudio

(a) Para el próximo paso debemos descargar los siguientes paquetes (gridExtra) y (ggplot2)

library(gridExtra)
library(ggplot2)

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

(b) Diagramas de caja: Los siguientes son grƔficos descriptivos de los factores con la variable respuesta

Tratamientos2 <- ggplot(DBCA1, aes(x = Tratamientos, y = V.sanguĆ­neo, fill=Tratamientos)) +
  geom_boxplot() + theme(legend.position = "none")
Bloques2 <- ggplot(DBCA1, aes(x = Bloques, y = V.sanguĆ­neo, fill=Bloques)) +
  geom_boxplot() + theme(legend.position = "none")
grid.arrange(Tratamientos2,Bloques2, nrow=1, ncol=2)

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

(c) El Modelo linal y tabla ANOVA

modeloDBCA1= lm(V.sanguĆ­neo ~ Tratamientos + Bloques, DBCA1)
anovaDBCA1=aov(modeloDBCA1)
anovaDBCA1
## Call:
##    aov(formula = modeloDBCA1)
## 
## Terms:
##                 Tratamientos Bloques Residuals
## Sum of Squares        12.550   3.755     8.345
## Deg. of Freedom            3       4        12
## 
## Residual standard error: 0.8339165
## Estimated effects may be unbalanced
summary(anovaDBCA1)
##              Df Sum Sq Mean Sq F value  Pr(>F)   
## Tratamientos  3 12.550   4.183   6.016 0.00964 **
## Bloques       4  3.755   0.939   1.350 0.30797   
## Residuals    12  8.345   0.695                   
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

(d) Comparaciones mĆŗltiples: HSD de Tukey

TukeyHSD(anovaDBCA1)
##   Tukey multiple comparisons of means
##     95% family-wise confidence level
## 
## Fit: aov(formula = modeloDBCA1)
## 
## $Tratamientos
##     diff        lwr        upr     p adj
## B-A  1.4 -0.1658432  2.9658432 0.0854565
## C-A -0.8 -2.3658432  0.7658432 0.4580868
## D-A  0.4 -1.1658432  1.9658432 0.8713824
## C-B -2.2 -3.7658432 -0.6341568 0.0061420
## D-B -1.0 -2.5658432  0.5658432 0.2800111
## D-C  1.2 -0.3658432  2.7658432 0.1586223
## 
## $Bloques
##                 diff        lwr      upr     p adj
## II-I    0.000000e+00 -1.8795268 1.879527 1.0000000
## III-I   7.750000e-01 -1.1045268 2.654527 0.6881671
## IV-I   -8.881784e-16 -1.8795268 1.879527 1.0000000
## V-I     9.750000e-01 -0.9045268 2.854527 0.4944147
## III-II  7.750000e-01 -1.1045268 2.654527 0.6881671
## IV-II  -8.881784e-16 -1.8795268 1.879527 1.0000000
## V-II    9.750000e-01 -0.9045268 2.854527 0.4944147
## IV-III -7.750000e-01 -2.6545268 1.104527 0.6881671
## V-III   2.000000e-01 -1.6795268 2.079527 0.9967411
## V-IV    9.750000e-01 -0.9045268 2.854527 0.4944147

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

(e) Comparaciones múltiples: grÔfico HSD de Tukey

plot(TukeyHSD(anovaDBCA1))

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

2.4 Pruebas de Medias por comparaciones MĆŗltiples

(a) (Prueba LSD). Instale el paquete ā€œagricolae

library(agricolae)

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

(b) Prueba LSD para Tratamientos

LSD.test(anovaDBCA1,"Tratamientos",console=TRUE)
## 
## Study: anovaDBCA1 ~ "Tratamientos"
## 
## LSD t Test for V.sanguĆ­neo 
## 
## Mean Square Error:  0.6954167 
## 
## Tratamientos,  means and individual ( 95 %) CI
## 
##   V.sanguĆ­neo       std r      LCL      UCL Min Max
## A         5.0 1.1575837 5 4.187436 5.812564 4.1 6.5
## B         6.4 0.6403124 5 5.587436 7.212564 5.3 6.9
## C         4.2 0.2000000 5 3.387436 5.012564 4.0 4.5
## D         5.4 1.1113055 5 4.587436 6.212564 4.2 6.9
## 
## Alpha: 0.05 ; DF Error: 12
## Critical Value of t: 2.178813 
## 
## least Significant Difference: 1.149139 
## 
## Treatments with the same letter are not significantly different.
## 
##   V.sanguĆ­neo groups
## B         6.4      a
## D         5.4     ab
## A         5.0     bc
## C         4.2      c
plot(LSD.test(anovaDBCA1,"Tratamientos",console=TRUE))
## 
## Study: anovaDBCA1 ~ "Tratamientos"
## 
## LSD t Test for V.sanguĆ­neo 
## 
## Mean Square Error:  0.6954167 
## 
## Tratamientos,  means and individual ( 95 %) CI
## 
##   V.sanguĆ­neo       std r      LCL      UCL Min Max
## A         5.0 1.1575837 5 4.187436 5.812564 4.1 6.5
## B         6.4 0.6403124 5 5.587436 7.212564 5.3 6.9
## C         4.2 0.2000000 5 3.387436 5.012564 4.0 4.5
## D         5.4 1.1113055 5 4.587436 6.212564 4.2 6.9
## 
## Alpha: 0.05 ; DF Error: 12
## Critical Value of t: 2.178813 
## 
## least Significant Difference: 1.149139 
## 
## Treatments with the same letter are not significantly different.
## 
##   V.sanguĆ­neo groups
## B         6.4      a
## D         5.4     ab
## A         5.0     bc
## C         4.2      c

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

(c) Prueba LSD para Bloques

LSD.test(anovaDBCA1,"Bloques",console=TRUE)
## 
## Study: anovaDBCA1 ~ "Bloques"
## 
## LSD t Test for V.sanguĆ­neo 
## 
## Mean Square Error:  0.6954167 
## 
## Bloques,  means and individual ( 95 %) CI
## 
##     V.sanguĆ­neo      std r      LCL      UCL Min Max
## I         4.900 1.131371 4 3.991526 5.808474 4.1 6.5
## II        4.900 1.048809 4 3.991526 5.808474 4.0 6.2
## III       5.675 1.201041 4 4.766526 6.583474 4.5 6.9
## IV        4.900 1.267544 4 3.991526 5.808474 4.2 6.8
## V         5.875 1.239287 4 4.966526 6.783474 4.1 6.9
## 
## Alpha: 0.05 ; DF Error: 12
## Critical Value of t: 2.178813 
## 
## least Significant Difference: 1.284776 
## 
## Treatments with the same letter are not significantly different.
## 
##     V.sanguĆ­neo groups
## V         5.875      a
## III       5.675      a
## I         4.900      a
## II        4.900      a
## IV        4.900      a
plot(LSD.test(anovaDBCA1,"Bloques",console=TRUE))
## 
## Study: anovaDBCA1 ~ "Bloques"
## 
## LSD t Test for V.sanguĆ­neo 
## 
## Mean Square Error:  0.6954167 
## 
## Bloques,  means and individual ( 95 %) CI
## 
##     V.sanguĆ­neo      std r      LCL      UCL Min Max
## I         4.900 1.131371 4 3.991526 5.808474 4.1 6.5
## II        4.900 1.048809 4 3.991526 5.808474 4.0 6.2
## III       5.675 1.201041 4 4.766526 6.583474 4.5 6.9
## IV        4.900 1.267544 4 3.991526 5.808474 4.2 6.8
## V         5.875 1.239287 4 4.966526 6.783474 4.1 6.9
## 
## Alpha: 0.05 ; DF Error: 12
## Critical Value of t: 2.178813 
## 
## least Significant Difference: 1.284776 
## 
## Treatments with the same letter are not significantly different.
## 
##     V.sanguĆ­neo groups
## V         5.875      a
## III       5.675      a
## I         4.900      a
## II        4.900      a
## IV        4.900      a

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

(f) Prueba de Tukey: Tratamientos

HSD.test(anovaDBCA1, "Tratamientos",console=TRUE)
## 
## Study: anovaDBCA1 ~ "Tratamientos"
## 
## HSD Test for V.sanguĆ­neo 
## 
## Mean Square Error:  0.6954167 
## 
## Tratamientos,  means
## 
##   V.sanguĆ­neo       std r Min Max
## A         5.0 1.1575837 5 4.1 6.5
## B         6.4 0.6403124 5 5.3 6.9
## C         4.2 0.2000000 5 4.0 4.5
## D         5.4 1.1113055 5 4.2 6.9
## 
## Alpha: 0.05 ; DF Error: 12 
## Critical Value of Studentized Range: 4.19866 
## 
## Minimun Significant Difference: 1.565843 
## 
## Treatments with the same letter are not significantly different.
## 
##   V.sanguĆ­neo groups
## B         6.4      a
## D         5.4     ab
## A         5.0     ab
## C         4.2      b
plot(HSD.test(anovaDBCA1, "Tratamientos",console=TRUE))
## 
## Study: anovaDBCA1 ~ "Tratamientos"
## 
## HSD Test for V.sanguĆ­neo 
## 
## Mean Square Error:  0.6954167 
## 
## Tratamientos,  means
## 
##   V.sanguĆ­neo       std r Min Max
## A         5.0 1.1575837 5 4.1 6.5
## B         6.4 0.6403124 5 5.3 6.9
## C         4.2 0.2000000 5 4.0 4.5
## D         5.4 1.1113055 5 4.2 6.9
## 
## Alpha: 0.05 ; DF Error: 12 
## Critical Value of Studentized Range: 4.19866 
## 
## Minimun Significant Difference: 1.565843 
## 
## Treatments with the same letter are not significantly different.
## 
##   V.sanguĆ­neo groups
## B         6.4      a
## D         5.4     ab
## A         5.0     ab
## C         4.2      b

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

(g) Prueba de Tukey: Bloques

HSD.test(anovaDBCA1, "Bloques",console=TRUE)
## 
## Study: anovaDBCA1 ~ "Bloques"
## 
## HSD Test for V.sanguĆ­neo 
## 
## Mean Square Error:  0.6954167 
## 
## Bloques,  means
## 
##     V.sanguĆ­neo      std r Min Max
## I         4.900 1.131371 4 4.1 6.5
## II        4.900 1.048809 4 4.0 6.2
## III       5.675 1.201041 4 4.5 6.9
## IV        4.900 1.267544 4 4.2 6.8
## V         5.875 1.239287 4 4.1 6.9
## 
## Alpha: 0.05 ; DF Error: 12 
## Critical Value of Studentized Range: 4.50771 
## 
## Minimun Significant Difference: 1.879527 
## 
## Treatments with the same letter are not significantly different.
## 
##     V.sanguĆ­neo groups
## V         5.875      a
## III       5.675      a
## I         4.900      a
## II        4.900      a
## IV        4.900      a

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

(h) Prueba de Student-Newman-Keuls (SNK)

SNK.test(anovaDBCA1, "Tratamientos",console=TRUE)
## 
## Study: anovaDBCA1 ~ "Tratamientos"
## 
## Student Newman Keuls Test
## for V.sanguĆ­neo 
## 
## Mean Square Error:  0.6954167 
## 
## Tratamientos,  means
## 
##   V.sanguĆ­neo       std r Min Max
## A         5.0 1.1575837 5 4.1 6.5
## B         6.4 0.6403124 5 5.3 6.9
## C         4.2 0.2000000 5 4.0 4.5
## D         5.4 1.1113055 5 4.2 6.9
## 
## Alpha: 0.05 ; DF Error: 12 
## 
## Critical Range
##        2        3        4 
## 1.149139 1.407072 1.565843 
## 
## Means with the same letter are not significantly different.
## 
##   V.sanguĆ­neo groups
## B         6.4      a
## D         5.4     ab
## A         5.0     ab
## C         4.2      b
plot(SNK.test(anovaDBCA1, "Tratamientos",console=TRUE))
## 
## Study: anovaDBCA1 ~ "Tratamientos"
## 
## Student Newman Keuls Test
## for V.sanguĆ­neo 
## 
## Mean Square Error:  0.6954167 
## 
## Tratamientos,  means
## 
##   V.sanguĆ­neo       std r Min Max
## A         5.0 1.1575837 5 4.1 6.5
## B         6.4 0.6403124 5 5.3 6.9
## C         4.2 0.2000000 5 4.0 4.5
## D         5.4 1.1113055 5 4.2 6.9
## 
## Alpha: 0.05 ; DF Error: 12 
## 
## Critical Range
##        2        3        4 
## 1.149139 1.407072 1.565843 
## 
## Means with the same letter are not significantly different.
## 
##   V.sanguĆ­neo groups
## B         6.4      a
## D         5.4     ab
## A         5.0     ab
## C         4.2      b

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

(i) Prueba de ScheffƩ

scheffe.test(anovaDBCA1, "Bloques",console=TRUE)
## 
## Study: anovaDBCA1 ~ "Bloques"
## 
## Scheffe Test for V.sanguĆ­neo 
## 
## Mean Square Error  : 0.6954167 
## 
## Bloques,  means
## 
##     V.sanguĆ­neo      std r Min Max
## I         4.900 1.131371 4 4.1 6.5
## II        4.900 1.048809 4 4.0 6.2
## III       5.675 1.201041 4 4.5 6.9
## IV        4.900 1.267544 4 4.2 6.8
## V         5.875 1.239287 4 4.1 6.9
## 
## Alpha: 0.05 ; DF Error: 12 
## Critical Value of F: 3.259167 
## 
## Minimum Significant Difference: 2.129074 
## 
## Means with the same letter are not significantly different.
## 
##     V.sanguĆ­neo groups
## V         5.875      a
## III       5.675      a
## I         4.900      a
## II        4.900      a
## IV        4.900      a
plot(scheffe.test(anovaDBCA1, "Bloques",console=TRUE))
## 
## Study: anovaDBCA1 ~ "Bloques"
## 
## Scheffe Test for V.sanguĆ­neo 
## 
## Mean Square Error  : 0.6954167 
## 
## Bloques,  means
## 
##     V.sanguĆ­neo      std r Min Max
## I         4.900 1.131371 4 4.1 6.5
## II        4.900 1.048809 4 4.0 6.2
## III       5.675 1.201041 4 4.5 6.9
## IV        4.900 1.267544 4 4.2 6.8
## V         5.875 1.239287 4 4.1 6.9
## 
## Alpha: 0.05 ; DF Error: 12 
## Critical Value of F: 3.259167 
## 
## Minimum Significant Difference: 2.129074 
## 
## Means with the same letter are not significantly different.
## 
##     V.sanguĆ­neo groups
## V         5.875      a
## III       5.675      a
## I         4.900      a
## II        4.900      a
## IV        4.900      a

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

(j) Prueba de Duncan

duncan.test(anovaDBCA1, "Tratamientos",console=TRUE)
## 
## Study: anovaDBCA1 ~ "Tratamientos"
## 
## Duncan's new multiple range test
## for V.sanguĆ­neo 
## 
## Mean Square Error:  0.6954167 
## 
## Tratamientos,  means
## 
##   V.sanguĆ­neo       std r Min Max
## A         5.0 1.1575837 5 4.1 6.5
## B         6.4 0.6403124 5 5.3 6.9
## C         4.2 0.2000000 5 4.0 4.5
## D         5.4 1.1113055 5 4.2 6.9
## 
## Alpha: 0.05 ; DF Error: 12 
## 
## Critical Range
##        2        3        4 
## 1.149139 1.202818 1.235342 
## 
## Means with the same letter are not significantly different.
## 
##   V.sanguĆ­neo groups
## B         6.4      a
## D         5.4     ab
## A         5.0      b
## C         4.2      b
plot(duncan.test(anovaDBCA1, "Tratamientos",console=TRUE))
## 
## Study: anovaDBCA1 ~ "Tratamientos"
## 
## Duncan's new multiple range test
## for V.sanguĆ­neo 
## 
## Mean Square Error:  0.6954167 
## 
## Tratamientos,  means
## 
##   V.sanguĆ­neo       std r Min Max
## A         5.0 1.1575837 5 4.1 6.5
## B         6.4 0.6403124 5 5.3 6.9
## C         4.2 0.2000000 5 4.0 4.5
## D         5.4 1.1113055 5 4.2 6.9
## 
## Alpha: 0.05 ; DF Error: 12 
## 
## Critical Range
##        2        3        4 
## 1.149139 1.202818 1.235342 
## 
## Means with the same letter are not significantly different.
## 
##   V.sanguĆ­neo groups
## B         6.4      a
## D         5.4     ab
## A         5.0      b
## C         4.2      b

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

(k) Prueba de Bonferroni

LSD.test(anovaDBCA1, "Tratamientos", p.adj= "bon",console=TRUE)
## 
## Study: anovaDBCA1 ~ "Tratamientos"
## 
## LSD t Test for V.sanguĆ­neo 
## P value adjustment method: bonferroni 
## 
## Mean Square Error:  0.6954167 
## 
## Tratamientos,  means and individual ( 95 %) CI
## 
##   V.sanguĆ­neo       std r      LCL      UCL Min Max
## A         5.0 1.1575837 5 4.187436 5.812564 4.1 6.5
## B         6.4 0.6403124 5 5.587436 7.212564 5.3 6.9
## C         4.2 0.2000000 5 3.387436 5.012564 4.0 4.5
## D         5.4 1.1113055 5 4.587436 6.212564 4.2 6.9
## 
## Alpha: 0.05 ; DF Error: 12
## Critical Value of t: 3.152681 
## 
## Minimum Significant Difference: 1.662772 
## 
## Treatments with the same letter are not significantly different.
## 
##   V.sanguĆ­neo groups
## B         6.4      a
## D         5.4     ab
## A         5.0     ab
## C         4.2      b
plot(LSD.test(anovaDBCA1, "Tratamientos", p.adj= "bon",console=TRUE))
## 
## Study: anovaDBCA1 ~ "Tratamientos"
## 
## LSD t Test for V.sanguĆ­neo 
## P value adjustment method: bonferroni 
## 
## Mean Square Error:  0.6954167 
## 
## Tratamientos,  means and individual ( 95 %) CI
## 
##   V.sanguĆ­neo       std r      LCL      UCL Min Max
## A         5.0 1.1575837 5 4.187436 5.812564 4.1 6.5
## B         6.4 0.6403124 5 5.587436 7.212564 5.3 6.9
## C         4.2 0.2000000 5 3.387436 5.012564 4.0 4.5
## D         5.4 1.1113055 5 4.587436 6.212564 4.2 6.9
## 
## Alpha: 0.05 ; DF Error: 12
## Critical Value of t: 3.152681 
## 
## Minimum Significant Difference: 1.662772 
## 
## Treatments with the same letter are not significantly different.
## 
##   V.sanguĆ­neo groups
## B         6.4      a
## D         5.4     ab
## A         5.0     ab
## C         4.2      b

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

2.5 Supuestos del Modelo en RStudio: Normalidad

(a) Normalidad de los residuos

shapiro.test(anovaDBCA1$res)
## 
##  Shapiro-Wilk normality test
## 
## data:  anovaDBCA1$res
## W = 0.95529, p-value = 0.4545

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

(b) Supuesto del modelo:Normalidad de los residuos

summary(anovaDBCA1$residuals)
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##  -1.025  -0.550  -0.025   0.000   0.450   1.150
sd((anovaDBCA1$residuals))
## [1] 0.6627296

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

(c) Supuesto del modelo:Normalidad de los residuos

boxplot(anovaDBCA1$residuals,col="lightblue") 

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

(d) Supuesto del modelo:Normalidad de los residuos

hist(anovaDBCA1$residuals, col="lightgreen", main = "Histograma de los Residuos",
     freq = F, xlab="Residuos",ylab="Densidad")
lines(density(anovaDBCA1$residuals), col="red", lwd=3)

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

(e) ** Prueba de Normalidad con Q-Q Plot**

qqnorm(anovaDBCA1$residuals,col="blue", lwd=3) 
qqline(anovaDBCA1$residuals,col="red", lwd=3)

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ## 2.6 Supuestos del Modelo en RStudio: Supuesto de Independencia

(a) Supuesto de Independencia

plot(anovaDBCA1$residuals,main = "Residuos vs Observaciones",col="red", lwd=3) 

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ## 2.6 Supuestos del Modelo en RStudio: Supuesto de Homocedasticidad

(a) Homocedasticidad

boxplot(anovaDBCA1$residuals~Bloques, xlab="Bloques",ylab="Residuos",
        col = c("yellow", "blue", "white","green", "red")) 

names(anovaDBCA1)
##  [1] "coefficients"  "residuals"     "effects"       "rank"         
##  [5] "fitted.values" "assign"        "qr"            "df.residual"  
##  [9] "contrasts"     "xlevels"       "call"          "terms"        
## [13] "model"

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

(d) Homocedasticidad: GrƔfico de predichos contra residuos estandarizados

pred=fitted(anovaDBCA1)
resid=rstandard(anovaDBCA1)
plot(pred,resid,xlab="Valores predichos", ylab="Residuos estandarizados",abline(h=0),col="red", lwd=3)

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

(e) Homocedasticidad: Prueba de Bartlett para Lisina

bartlett.test(anovaDBCA1$residuals ~ Bloques)
## 
##  Bartlett test of homogeneity of variances
## 
## data:  anovaDBCA1$residuals by Bloques
## Bartlett's K-squared = 1.2802, df = 4, p-value = 0.8647

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

(k) (a)

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

(l) (a)

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

(m) (a)

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

(n) (a)

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

(o) (a)

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

(p) (a)

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

(q) (a)

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

(r) (a)

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

(s) (a)

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

(t) (a)

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

(u) (a)

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

(v) (a)

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

(x) (a)

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

(y) (a)

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

(z) (a)

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

(a) (a)

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

(b) (a)

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

(c) (a)

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

(d) (a)

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

(e) (a)

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

(f) (a)

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

(g) (a)

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

(h) (a)

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

(a) (a)

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

(i) (a)

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

(j) (a)

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

(k) (a)

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

(l) (a)

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

(m) (a)

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

(n) (a)

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

(o) (a)

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

(p) (a)

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

(q) (a)

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

(r) (a)

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

(s) (a)

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

(t) (a)

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

(u) (a)

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

(v) (a)

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

(x) (a)

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

(y) (a)

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

(z) (a)

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%