Este documento presenta un análisis basado en el Diseño de Bloques Completamente al Azar (DBCA)** para evaluar la influencia del pH y la marca en la actividad enzimática (AE). Se tienen los bloques para las marcas de enzimas 1, 2, 3 y 4 las cuales son sometidas a los tratamientos de pH 5, 6, 7 y 8
library(readxl)
library(tidyverse)
library(apaTables)
library(car)
library(agricolae)
getwd() # Ver directorio actual
## [1] "C:/Users/thoma/Dropbox/My PC (LAPTOP-VP55P98S)/Downloads/Rstudio"
setwd("C:/Users/thoma/Dropbox/My PC (LAPTOP-VP55P98S)/Downloads/Rstudio") # Especificar directorio
#**Lectura de datos**
DBCA <- read_excel("DBCA.xlsx")
View(DBCA)
attach(DBCA)
#**Transformacion de variables**
PH <- factor(PH)
Marca <- factor(Marca)
#**Modelo lineal y ANOVA**
#El modelo presenta un ajuste alto, pues presenta un R² de 0.8857, por lo que es posible decir el 88.5% de la variabilidad enzimatica es explicada tanto por el pH y la marca esto pues cada uno presenta efectos significativos de pH con un p-valor 0.000115 y Marca con un p-valor 0.000570 indicando SI hay una diferencia significativa. Como tal el pH6 presenta un efecto negativo sobre la actividad enzimatica en comparacion al pH5 (p-valor 0.000299) mientras que pH8 presenta un efecto positivo al ser mas similar a pH5 por lo que presenta mayor actividad enzimatica en comparacion a pH6. Adicionalmente las marcas B, C y D presentan valores negativos respeccto a la marca A, por lo que su actividad enzimatica es menor en comparacion a la marca A.
modelo <- lm(AE ~ (PH + Marca))
summary(modelo)
##
## Call:
## lm(formula = AE ~ (PH + Marca))
##
## Residuals:
## Min 1Q Median 3Q Max
## -0.04250 -0.01812 -0.00875 0.01937 0.04500
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 0.80000 0.02385 33.545 9.16e-11 ***
## PHPH6 -0.14500 0.02550 -5.687 0.000299 ***
## PHPH7 0.03250 0.02550 1.275 0.234321
## PHPH8 0.05250 0.02550 2.059 0.069568 .
## MarcaB -0.16750 0.02550 -6.570 0.000103 ***
## MarcaC -0.13500 0.02550 -5.295 0.000497 ***
## MarcaD -0.09750 0.02550 -3.824 0.004063 **
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.03606 on 9 degrees of freedom
## Multiple R-squared: 0.9314, Adjusted R-squared: 0.8857
## F-statistic: 20.37 on 6 and 9 DF, p-value: 9.227e-05
anova <- aov(modelo)
summary(anova)
## Df Sum Sq Mean Sq F value Pr(>F)
## PH 3 0.09575 0.03192 24.55 0.000115 ***
## Marca 3 0.06315 0.02105 16.19 0.000570 ***
## Residuals 9 0.01170 0.00130
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#**Tablas**
apa.aov.table(lm_output = anova, filename="table1.doc", table.number = 1)
##
##
## Table 1
##
## ANOVA results using AE as the dependent variable
##
##
## Predictor SS df MS F p partial_eta2 CI_90_partial_eta2
## (Intercept) 1.46 1 1.46 1125.27 .000
## PH 0.10 3 0.03 24.55 .000 .91 [.62, .92]
## Marca 0.06 3 0.02 16.19 .001 .86 [.48, .88]
## Error 0.01 9 0.00
##
## Note: Values in square brackets indicate the bounds of the 90% confidence interval for partial eta-squared
apa.1way.table(iv=PH, dv=AE, filename="tabla2.doc", table.number= 2, data=DBCA)
##
##
## Table 2
##
## Descriptive statistics for AE as a function of PH.
##
## PH M SD
## PH5 0.70 0.06
## PH6 0.55 0.10
## PH7 0.73 0.07
## PH8 0.75 0.07
##
## Note. M and SD represent mean and standard deviation, respectively.
##
apa.d.table(iv = PH, dv = AE, data = DBCA, filename = "tabla3.doc", landscape=TRUE)
##
##
## Means, standard deviations, and d-values with confidence intervals
##
##
## Variable M SD 1 2 3
## 1. PH5 0.70 0.06
##
## 2. PH6 0.55 0.10 1.71
## [-0.01, 3.35]
##
## 3. PH7 0.73 0.07 0.48 2.00
## [-0.95, 1.87] [0.18, 3.73]
##
## 4. PH8 0.75 0.07 0.77 2.22 0.27
## [-0.71, 2.19] [0.32, 4.03] [-1.13, 1.66]
##
##
## Note. M indicates mean. SD indicates standard deviation. d-values are estimates calculated using formulas 4.18 and 4.19
## from Borenstein, Hedges, Higgins, & Rothstein (2009). d-values not calculated if unequal variances prevented pooling.
## Values in square brackets indicate the 95% confidence interval for each d-value.
## The confidence interval is a plausible range of population d-values
## that could have caused the sample d-value (Cumming, 2014).
##
#**Boxplot Actividad enzimatica v.s. pH
boxplot(split(AE, PH), xlab="Niveles de PH", ylab="Actividad Enzimática")
##**Analisis de supuestos**
#**Normalidad de los residuos**
#El p-valor es de 0.2584, indicando no hay residuos importantes, pues estos son absorbidos por los factores por lo que NO se rechaza la normalidad de los residuos.
normalidad <- shapiro.test(resid(modelo))
print(normalidad)
##
## Shapiro-Wilk normality test
##
## data: resid(modelo)
## W = 0.9316, p-value = 0.2584
qqPlot(anova)
## [1] 2 16
#**Homeocedasticidad**
#Se presenta un p-valor de 0.4922, lo cual indica NO se rechaza la homogeneidad de las varianzas, cumpliendose el supuesto de la homocedasticidad.
homocedasticidad <- bartlett.test(resid(modelo) ~ PH)
print(homocedasticidad)
##
## Bartlett test of homogeneity of variances
##
## data: resid(modelo) by PH
## Bartlett's K-squared = 2.4076, df = 3, p-value = 0.4922
homocedasticidad_bloque <- bartlett.test(resid(modelo) ~ Marca)
print(homocedasticidad_bloque)
##
## Bartlett test of homogeneity of variances
##
## data: resid(modelo) by Marca
## Bartlett's K-squared = 0.48391, df = 3, p-value = 0.9224
#**Valores predichos v.s. residuos
fitb <- fitted(anova)
res_stb <- rstandard(anova)
plot(fitb, res_stb, xlab="Valores Predichos", ylab="Residuos Estandarizados", abline(h=0))
##**Pruebas a posteriori**
#**Diferencia minima significativa**
#Se determina pH6 (b) es significativamente distinto de los demas niveles (pH 5, 7 y 8) mientras que el pH 5, 7 y 8 (a) no presentan diferencias significativas entre si
outLSD <- LSD.test(anova, "PH", console=TRUE)
##
## Study: anova ~ "PH"
##
## LSD t Test for AE
##
## Mean Square Error: 0.0013
##
## PH, means and individual ( 95 %) CI
##
## AE std r se LCL UCL Min Max Q25 Q50
## PH5 0.7000 0.06218253 4 0.01802776 0.6592184 0.7407816 0.65 0.79 0.6650 0.680
## PH6 0.5550 0.10214369 4 0.01802776 0.5142184 0.5957816 0.47 0.70 0.4925 0.525
## PH7 0.7325 0.07274384 4 0.01802776 0.6917184 0.7732816 0.68 0.84 0.6950 0.705
## PH8 0.7525 0.07320064 4 0.01802776 0.7117184 0.7932816 0.65 0.81 0.7250 0.775
## Q75
## PH5 0.7150
## PH6 0.5875
## PH7 0.7425
## PH8 0.8025
##
## Alpha: 0.05 ; DF Error: 9
## Critical Value of t: 2.262157
##
## least Significant Difference: 0.05767392
##
## Treatments with the same letter are not significantly different.
##
## AE groups
## PH8 0.7525 a
## PH7 0.7325 a
## PH5 0.7000 a
## PH6 0.5550 b
#**Tukey**
#Confirma los resultados obtenidos con LSD, resaltando nuevamente el pH6 presenta una actividad enzimatica significativamente distinta, siendo esta menor a la presentada en pH5, 7 y 8 los cuales no presentan diferencias significativas entre si.
outHSD <- HSD.test(anova, "PH", console=TRUE)
##
## Study: anova ~ "PH"
##
## HSD Test for AE
##
## Mean Square Error: 0.0013
##
## PH, means
##
## AE std r se Min Max Q25 Q50 Q75
## PH5 0.7000 0.06218253 4 0.01802776 0.65 0.79 0.6650 0.680 0.7150
## PH6 0.5550 0.10214369 4 0.01802776 0.47 0.70 0.4925 0.525 0.5875
## PH7 0.7325 0.07274384 4 0.01802776 0.68 0.84 0.6950 0.705 0.7425
## PH8 0.7525 0.07320064 4 0.01802776 0.65 0.81 0.7250 0.775 0.8025
##
## Alpha: 0.05 ; DF Error: 9
## Critical Value of Studentized Range: 4.41489
##
## Minimun Significant Difference: 0.07959056
##
## Treatments with the same letter are not significantly different.
##
## AE groups
## PH8 0.7525 a
## PH7 0.7325 a
## PH5 0.7000 a
## PH6 0.5550 b
plot(TukeyHSD(anova, "PH"))
#**Otras Pruebas de comparacion de medias**
#El comportamiento presentado para las pruebas de LSD y HSD se presenta nuevamente confirmando el pH6 presenta una actividad enzimatica significativamente diferente a los pH 5, 7 y 8.
SNK.test(anova, "PH", console=TRUE) # Student-Newman-Keuls
##
## Study: anova ~ "PH"
##
## Student Newman Keuls Test
## for AE
##
## Mean Square Error: 0.0013
##
## PH, means
##
## AE std r se Min Max Q25 Q50 Q75
## PH5 0.7000 0.06218253 4 0.01802776 0.65 0.79 0.6650 0.680 0.7150
## PH6 0.5550 0.10214369 4 0.01802776 0.47 0.70 0.4925 0.525 0.5875
## PH7 0.7325 0.07274384 4 0.01802776 0.68 0.84 0.6950 0.705 0.7425
## PH8 0.7525 0.07320064 4 0.01802776 0.65 0.81 0.7250 0.775 0.8025
##
## Alpha: 0.05 ; DF Error: 9
##
## Critical Range
## 2 3 4
## 0.05767392 0.07118246 0.07959056
##
## Means with the same letter are not significantly different.
##
## AE groups
## PH8 0.7525 a
## PH7 0.7325 a
## PH5 0.7000 a
## PH6 0.5550 b
scheffe.test(anova, "PH", console=TRUE) # Scheffé
##
## Study: anova ~ "PH"
##
## Scheffe Test for AE
##
## Mean Square Error : 0.0013
##
## PH, means
##
## AE std r se Min Max Q25 Q50 Q75
## PH5 0.7000 0.06218253 4 0.01802776 0.65 0.79 0.6650 0.680 0.7150
## PH6 0.5550 0.10214369 4 0.01802776 0.47 0.70 0.4925 0.525 0.5875
## PH7 0.7325 0.07274384 4 0.01802776 0.68 0.84 0.6950 0.705 0.7425
## PH8 0.7525 0.07320064 4 0.01802776 0.65 0.81 0.7250 0.775 0.8025
##
## Alpha: 0.05 ; DF Error: 9
## Critical Value of F: 3.862548
##
## Minimum Significant Difference: 0.08678692
##
## Means with the same letter are not significantly different.
##
## AE groups
## PH8 0.7525 a
## PH7 0.7325 a
## PH5 0.7000 a
## PH6 0.5550 b
duncan.test(anova, "PH", console=TRUE) # Duncan
##
## Study: anova ~ "PH"
##
## Duncan's new multiple range test
## for AE
##
## Mean Square Error: 0.0013
##
## PH, means
##
## AE std r se Min Max Q25 Q50 Q75
## PH5 0.7000 0.06218253 4 0.01802776 0.65 0.79 0.6650 0.680 0.7150
## PH6 0.5550 0.10214369 4 0.01802776 0.47 0.70 0.4925 0.525 0.5875
## PH7 0.7325 0.07274384 4 0.01802776 0.68 0.84 0.6950 0.705 0.7425
## PH8 0.7525 0.07320064 4 0.01802776 0.65 0.81 0.7250 0.775 0.8025
##
## Alpha: 0.05 ; DF Error: 9
##
## Critical Range
## 2 3 4
## 0.05767392 0.06019716 0.06165069
##
## Means with the same letter are not significantly different.
##
## AE groups
## PH8 0.7525 a
## PH7 0.7325 a
## PH5 0.7000 a
## PH6 0.5550 b
LSD.test(anova, "PH", p.adj= "bon", console=TRUE) # Bonferroni
##
## Study: anova ~ "PH"
##
## LSD t Test for AE
## P value adjustment method: bonferroni
##
## Mean Square Error: 0.0013
##
## PH, means and individual ( 95 %) CI
##
## AE std r se LCL UCL Min Max Q25 Q50
## PH5 0.7000 0.06218253 4 0.01802776 0.6592184 0.7407816 0.65 0.79 0.6650 0.680
## PH6 0.5550 0.10214369 4 0.01802776 0.5142184 0.5957816 0.47 0.70 0.4925 0.525
## PH7 0.7325 0.07274384 4 0.01802776 0.6917184 0.7732816 0.68 0.84 0.6950 0.705
## PH8 0.7525 0.07320064 4 0.01802776 0.7117184 0.7932816 0.65 0.81 0.7250 0.775
## Q75
## PH5 0.7150
## PH6 0.5875
## PH7 0.7425
## PH8 0.8025
##
## Alpha: 0.05 ; DF Error: 9
## Critical Value of t: 3.364203
##
## Minimum Significant Difference: 0.08577069
##
## Treatments with the same letter are not significantly different.
##
## AE groups
## PH8 0.7525 a
## PH7 0.7325 a
## PH5 0.7000 a
## PH6 0.5550 b
#**Conclusion**
#Frente al efecto negativo del pH6 seria mejor emplear un pH de 5, 7 o 8 para maximizar la actividad enzimatica, adicionalmente es recomendable ocupar la marca A, pues entre los pH con mayor actividad enzimatica la marca A presento una mayor AE en comparacion a las marcsas B, C y D