#UNIVERSIDAD NACIONAL DEL ALTIPLANO
#DISENOS EXPERIMENTALES
#FINESI
#TEMA: DCGL
library(daewr)
## Warning: package 'daewr' was built under R version 4.0.5
## Registered S3 method overwritten by 'DoE.base':
##   method           from       
##   factorize.factor conf.design
library(knitr)
library(readxl)
## Warning: package 'readxl' was built under R version 4.0.2
DCGL <- read_excel("E:/VII SEMESTRE/DISENOS EXPERIMENTALES/TAREA 7/DCGL.xlsx")
DCGL
## # A tibble: 25 x 5
##    Observacion Lotes Concentracion Tiempo Temperaturas
##          <dbl> <chr>         <dbl> <chr>  <chr>       
##  1          26 Lote1             1 A      Z           
##  2          21 Lote1             2 B      Y           
##  3          19 Lote1             3 C      X           
##  4          13 Lote1             4 D      W           
##  5          21 Lote1             5 E      V           
##  6          22 Lote2             1 B      X           
##  7          26 Lote2             2 C      W           
##  8          24 Lote2             3 D      V           
##  9          16 Lote2             4 E      Z           
## 10          20 Lote2             5 A      Y           
## # ... with 15 more rows
# Ver los Datos
head(DCGL)
## # A tibble: 6 x 5
##   Observacion Lotes Concentracion Tiempo Temperaturas
##         <dbl> <chr>         <dbl> <chr>  <chr>       
## 1          26 Lote1             1 A      Z           
## 2          21 Lote1             2 B      Y           
## 3          19 Lote1             3 C      X           
## 4          13 Lote1             4 D      W           
## 5          21 Lote1             5 E      V           
## 6          22 Lote2             1 B      X
View(DCGL)

#Factor de las Variables
DCGL$Lotes <- factor(DCGL$Lotes)
DCGL$Temperaturas <- factor(DCGL$Temperaturas)
DCGL$Tiempo <- factor(DCGL$Tiempo)
DCGL$Concentracion <- factor(DCGL$Concentracion)

#ANOVA
mod1 <- aov(Observacion~ Lotes + Concentracion + Tiempo + Temperaturas, data = DCGL )
mod1
## Call:
##    aov(formula = Observacion ~ Lotes + Concentracion + Tiempo + 
##     Temperaturas, data = DCGL)
## 
## Terms:
##                  Lotes Concentracion Tiempo Temperaturas Residuals
## Sum of Squares    9.76        226.16 156.16        94.96     83.52
## Deg. of Freedom      4             4      4            4         8
## 
## Residual standard error: 3.231099
## Estimated effects may be unbalanced
summary(mod1)
##               Df Sum Sq Mean Sq F value Pr(>F)  
## Lotes          4   9.76    2.44   0.234 0.9117  
## Concentracion  4 226.16   56.54   5.416 0.0207 *
## Tiempo         4 156.16   39.04   3.739 0.0532 .
## Temperaturas   4  94.96   23.74   2.274 0.1500  
## Residuals      8  83.52   10.44                 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1