El rendimiento de un proceso químico se midió utilizando cinco lotes de materia prima, cinco concentraciones del ácido, cinco tiempo de procesamiento (A, B, C, D, y E) y cinco concentraciones del catalizador (a, b, c, d, e). Se utilizó el cuadrado grecolatino siguiente. Analizar los datos de este experimento (alpha = 0.05) y sacar conclusiones.

df<-read.csv("https://raw.githubusercontent.com/A14Reyes/Diseno_Experimental/main/PROB%204-22%20-%20Hoja%201.csv")
df$Lote=factor(df$Lote)
df$Conc=factor(df$Conc)
df$Trat1=factor(df$Trat1)
df$Trat2=factor(df$Trat2)
df$Y=as.numeric(df$Y)
df
##    Lote Conc Trat1 Trat2  Y
## 1     1    1     A     a 26
## 2     1    2     B     b 16
## 3     1    3     C     c 19
## 4     1    4     D     d 16
## 5     1    5     E     e 13
## 6     2    1     B     c 18
## 7     2    2     C     d 21
## 8     2    3     D     e 18
## 9     2    4     E     a 11
## 10    2    5     A     b 21
## 11    3    1     C     e 20
## 12    3    2     D     a 12
## 13    3    3     E     b 16
## 14    3    4     A     c 25
## 15    3    5     B     d 13
## 16    4    1     D     b 15
## 17    4    2     E     c 15
## 18    4    3     A     d 22
## 19    4    4     B     e 14
## 20    4    5     C     a 17
## 21    5    1     E     d 10
## 22    5    2     A     e 24
## 23    5    3     B     a 17
## 24    5    4     C     b 17
## 25    5    5     D     c 14
modelo<-lm(Y~Lote+Conc+Trat1+Trat2,data=df)
anova<-aov(modelo)
summary(anova)
##             Df Sum Sq Mean Sq F value   Pr(>F)    
## Lote         4   10.0    2.50   0.427 0.785447    
## Conc         4   24.4    6.10   1.043 0.442543    
## Trat1        4  342.8   85.70  14.650 0.000941 ***
## Trat2        4   12.0    3.00   0.513 0.728900    
## Residuals    8   46.8    5.85                     
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Normalidad de los Residuales

qqnorm(modelo$residuals)
qqline(modelo$residuals)

Gráfico de Tratamientos

boxplot(Y~Trat1,data = df)

boxplot(Y~Trat2,data = df)

Pruebas de comparaciones múltiples de LSD y Duncan

library(agricolae)
LSD<-LSD.test(y=anova,trt="Trat1",group=T,console=T)
## 
## Study: anova ~ "Trat1"
## 
## LSD t Test for Y 
## 
## Mean Square Error:  5.85 
## 
## Trat1,  means and individual ( 95 %) CI
## 
##      Y      std r      LCL      UCL Min Max
## A 23.6 2.073644 5 21.10568 26.09432  21  26
## B 15.6 2.073644 5 13.10568 18.09432  13  18
## C 18.8 1.788854 5 16.30568 21.29432  17  21
## D 15.0 2.236068 5 12.50568 17.49432  12  18
## E 13.0 2.549510 5 10.50568 15.49432  10  16
## 
## Alpha: 0.05 ; DF Error: 8
## Critical Value of t: 2.306004 
## 
## least Significant Difference: 3.527508 
## 
## Treatments with the same letter are not significantly different.
## 
##      Y groups
## A 23.6      a
## C 18.8      b
## B 15.6     bc
## D 15.0      c
## E 13.0      c
bar.group(x=LSD$groups,horiz=T,col="blue",xlim=c(0,50), xlab="Rendimiento", ylab="Tiempos de Procesamiento", main="Tiempos vs Rendimiento")

LSD<-LSD.test(y=anova,trt="Trat2",group=T,console=T)
## 
## Study: anova ~ "Trat2"
## 
## LSD t Test for Y 
## 
## Mean Square Error:  5.85 
## 
## Trat2,  means and individual ( 95 %) CI
## 
##      Y      std r      LCL      UCL Min Max
## a 16.6 5.941380 5 14.10568 19.09432  11  26
## b 17.0 2.345208 5 14.50568 19.49432  15  21
## c 18.2 4.324350 5 15.70568 20.69432  14  25
## d 16.4 5.128353 5 13.90568 18.89432  10  22
## e 17.8 4.494441 5 15.30568 20.29432  13  24
## 
## Alpha: 0.05 ; DF Error: 8
## Critical Value of t: 2.306004 
## 
## least Significant Difference: 3.527508 
## 
## Treatments with the same letter are not significantly different.
## 
##      Y groups
## c 18.2      a
## e 17.8      a
## b 17.0      a
## a 16.6      a
## d 16.4      a
bar.group(x=LSD$groups,horiz=T,col="skyblue",xlim=c(0,50),xlab="Rendimiento", ylab="Concentración del catalizador", main="Concentración vs Rendimiento")

Duncan<-duncan.test(anova,"Trat1", group=T, console=T)
## 
## Study: anova ~ "Trat1"
## 
## Duncan's new multiple range test
## for Y 
## 
## Mean Square Error:  5.85 
## 
## Trat1,  means
## 
##      Y      std r Min Max
## A 23.6 2.073644 5  21  26
## B 15.6 2.073644 5  13  18
## C 18.8 1.788854 5  17  21
## D 15.0 2.236068 5  12  18
## E 13.0 2.549510 5  10  16
## 
## Alpha: 0.05 ; DF Error: 8 
## 
## Critical Range
##        2        3        4        5 
## 3.527508 3.675996 3.758993 3.808753 
## 
## Means with the same letter are not significantly different.
## 
##      Y groups
## A 23.6      a
## C 18.8      b
## B 15.6     bc
## D 15.0      c
## E 13.0      c
bar.group(x=Duncan$groups,horiz=T,col="red",xlim=c(0,50), xlab="Rendimiento", ylab="Tiempos de Procesamiento", main="Tiempos vs Rendimiento")

Duncan<-duncan.test(anova,"Trat2", group=T, console=T)
## 
## Study: anova ~ "Trat2"
## 
## Duncan's new multiple range test
## for Y 
## 
## Mean Square Error:  5.85 
## 
## Trat2,  means
## 
##      Y      std r Min Max
## a 16.6 5.941380 5  11  26
## b 17.0 2.345208 5  15  21
## c 18.2 4.324350 5  14  25
## d 16.4 5.128353 5  10  22
## e 17.8 4.494441 5  13  24
## 
## Alpha: 0.05 ; DF Error: 8 
## 
## Critical Range
##        2        3        4        5 
## 3.527508 3.675996 3.758993 3.808753 
## 
## Means with the same letter are not significantly different.
## 
##      Y groups
## c 18.2      a
## e 17.8      a
## b 17.0      a
## a 16.6      a
## d 16.4      a
bar.group(x=Duncan$groups,horiz=T,col="pink",xlim=c(0,50), xlab="Rendimiento", ylab="Concentración del catalizador", main="Concentración vs Rendimiento")

PRUEBA DE HOMOGENEIDAD DE VARIANZAS (HOMOCEDASTICIDAD)

library(car)
## Loading required package: carData
## 
## Attaching package: 'carData'
## The following object is masked _by_ '.GlobalEnv':
## 
##     Duncan
leveneTest(df$Y~df$Trat1)
## Levene's Test for Homogeneity of Variance (center = median)
##       Df F value Pr(>F)
## group  4  0.1791 0.9465
##       20
leveneTest(df$Y~df$Trat2)
## Levene's Test for Homogeneity of Variance (center = median)
##       Df F value Pr(>F)
## group  4  0.7247 0.5853
##       20

GRÁFICO DE RESIDUALES (Sesgo)

plot(anova$residuals)
abline(h=0)