Este experimento consistio en verificar la absorción de diferentes marcas de papel sanitario expuestos a diferentes liquidos.
df=read.csv("dataset.csv")
print(df)
## Respuesta Tratamiento Bloque
## 1 2.54 Agua Regio
## 2 1.91 Agua Regio
## 3 3.93 Agua Regio
## 4 1.91 Cafe Regio
## 5 2.83 Cafe Regio
## 6 3.90 Cafe Regio
## 7 1.22 Refresco Regio
## 8 1.79 Refresco Regio
## 9 3.04 Refresco Regio
## 10 1.75 Leche Regio
## 11 3.92 Leche Regio
## 12 0.10 Leche Regio
## 13 2.80 Agua Vogue
## 14 0.10 Agua Vogue
## 15 2.20 Agua Vogue
## 16 2.79 Cafe Vogue
## 17 1.43 Cafe Vogue
## 18 1.93 Cafe Vogue
## 19 2.03 Refresco Vogue
## 20 2.18 Refresco Vogue
## 21 0.47 Refresco Vogue
## 22 0.72 Leche Vogue
## 23 1.99 Leche Vogue
## 24 0.44 Leche Vogue
## 25 2.99 Agua Petalo
## 26 3.69 Agua Petalo
## 27 3.68 Agua Petalo
## 28 2.17 Cafe Petalo
## 29 2.22 Cafe Petalo
## 30 1.62 Cafe Petalo
## 31 1.79 Refresco Petalo
## 32 2.95 Refresco Petalo
## 33 3.03 Refresco Petalo
## 34 3.98 Leche Petalo
## 35 3.58 Leche Petalo
## 36 4.04 Leche Petalo
## 37 2.46 Agua GV
## 38 2.55 Agua GV
## 39 3.85 Agua GV
## 40 2.48 Cafe GV
## 41 2.80 Cafe GV
## 42 2.93 Cafe GV
## 43 1.89 Refresco GV
## 44 2.07 Refresco GV
## 45 1.94 Refresco GV
## 46 2.37 Leche GV
## 47 1.68 Leche GV
## 48 2.72 Leche GV
## 49 2.56 Agua Premier
## 50 1.37 Agua Premier
## 51 2.46 Agua Premier
## 52 1.38 Cafe Premier
## 53 2.34 Cafe Premier
## 54 0.06 Cafe Premier
## 55 2.64 Refresco Premier
## 56 2.94 Refresco Premier
## 57 4.14 Refresco Premier
## 58 4.91 Leche Premier
## 59 2.66 Leche Premier
## 60 3.46 Leche Premier
Para trabajar con este experimento, utilizaremos las librerias ggplot2 y dplyr, ambas disponibles en el paquete R project.
library(ggplot2)
library(dplyr)
##
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
##
## filter, lag
## The following objects are masked from 'package:base':
##
## intersect, setdiff, setequal, union
df.1=df%>%group_by(Tratamiento)%>%summarise(Promedio=mean(Respuesta))
df.1
## # A tibble: 4 × 2
## Tratamiento Promedio
## <chr> <dbl>
## 1 Agua 2.61
## 2 Cafe 2.19
## 3 Leche 2.55
## 4 Refresco 2.27
df.2=df%>%group_by(Bloque)%>%summarise(Promedio=mean(Respuesta))
df.2
## # A tibble: 5 × 2
## Bloque Promedio
## <chr> <dbl>
## 1 GV 2.48
## 2 Petalo 2.98
## 3 Premier 2.58
## 4 Regio 2.40
## 5 Vogue 1.59
df=df%>%mutate(Tratamiento=as.factor(Tratamiento),Bloue=as.factor(Bloque))
gbox_f=ggplot(data=df,aes(x=Tratamiento,y=Respuesta,fill=Tratamiento))+
geom_boxplot()+
guides(fill = guide_legend(title = "Liquidos"))+
labs(x="Liquidos",y="Resistencia")+
theme_minimal()
gbox_f
gbox_b=ggplot(data=df,aes(x=Bloque,y=Respuesta,fill=Bloque))+
geom_boxplot()+
guides(fill = guide_legend(title = "Marcas"))+
labs(x="Marcas de papel sanitario",y="Resistencia")+
theme_minimal()
gbox_b
modelo=lm(Respuesta~Tratamiento+Bloque,data=df)
summary(modelo)
##
## Call:
## lm(formula = Respuesta ~ Tratamiento + Bloque, data = df)
##
## Residuals:
## Min 1Q Median 3Q Max
## -2.4527 -0.5515 0.0210 0.5895 2.1840
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 2.67900 0.36870 7.266 1.86e-09 ***
## TratamientoCafe -0.42000 0.36870 -1.139 0.2599
## TratamientoLeche -0.05133 0.36870 -0.139 0.8898
## TratamientoRefresco -0.33133 0.36870 -0.899 0.3730
## BloquePetalo 0.50000 0.41222 1.213 0.2306
## BloquePremier 0.09833 0.41222 0.239 0.8124
## BloqueRegio -0.07500 0.41222 -0.182 0.8563
## BloqueVogue -0.88833 0.41222 -2.155 0.0358 *
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 1.01 on 52 degrees of freedom
## Multiple R-squared: 0.2118, Adjusted R-squared: 0.1057
## F-statistic: 1.997 on 7 and 52 DF, p-value: 0.07324
anova=aov(modelo)
summary(anova)
## Df Sum Sq Mean Sq F value Pr(>F)
## Tratamiento 3 1.92 0.6387 0.626 0.6011
## Bloque 4 12.33 3.0834 3.024 0.0257 *
## Residuals 52 53.02 1.0196
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1