#Análisis estadísticos de tesis de Doctorado en Ciencias Bioquímicas:
#Berenice Franco Juárez

setwd("C:/Users/kner4/OneDrive/Desktop/Doctorado/Bere")

#Librerías
library(ggplot2)
library(ggthemes)
install.packages("car")
## Error in install.packages : Updating loaded packages
library(car)
library(effsize)
library(knitr)
library(rmarkdown)

Datos<-read.csv("AnalisisqPCR.csv", header=TRUE)

#qPCR

#ATG5
windows()
ggplot(data = Datos, aes(x = factor(Species), y = ATG5, fill=factor(Species))) +
  scale_fill_manual(values=c("blue", "orange")) +
  geom_boxplot(outlier.color="black")  +
  geom_jitter(color="#222424", size=1, alpha=1) +
  labs(title="", 
       x="", y="Atg5 mRNA expression/ actin") + 
  labs(fill="")+
  theme_bw()
#Prueba de normalidad
shapiro.test(lm(ATG5~Species, Datos)$residuals)
## 
##  Shapiro-Wilk normality test
## 
## data:  lm(ATG5 ~ Species, Datos)$residuals
## W = 0.87323, p-value = 0.2394
by(Datos$ATG5, Datos$Species, shapiro.test)
## Datos$Species: Ms 
## 
##  Shapiro-Wilk normality test
## 
## data:  dd[x, ]
## W = 0.91906, p-value = 0.449
## 
## ---------------------------------------------------------------------------------------------------- 
## Datos$Species: NMR
## 
##  Shapiro-Wilk normality test
## 
## data:  dd[x, ]
## W = 0.97527, p-value = 0.6984
#Pueba de homoscedasticidad
bartlett.test(ATG5~Species, Datos)
## 
##  Bartlett test of homogeneity of variances
## 
## data:  ATG5 by Species
## Bartlett's K-squared = 0.078602, df = 1, p-value = 0.7792
leveneTest(ATG5~Species, data = Datos)
## Warning in leveneTest.default(y = y, group = group, ...): group coerced to factor.
## Levene's Test for Homogeneity of Variance (center = median)
##       Df F value Pr(>F)
## group  1  0.0468 0.8393
##        4
#T-test
t.test(ATG5~Species, data = Datos, var.equal = TRUE)
## 
##  Two Sample t-test
## 
## data:  ATG5 by Species
## t = 1.7851, df = 4, p-value = 0.1488
## alternative hypothesis: true difference in means between group Ms  and group NMR is not equal to 0
## 95 percent confidence interval:
##  -0.0003906081  0.0017973481
## sample estimates:
## mean in group Ms  mean in group NMR 
##        0.00260632        0.00190295
#No significativo
#Tamaño del efecto
(cohen.d(ATG5~Species, data = Datos, hedges.correction = TRUE, conf.level = 0.95))$estimate
## [1] 1.166027
#BCN1
windows()
ggplot(data = Datos, aes(x = factor(Species), y = BCN1, fill=factor(Species))) +
  scale_fill_manual(values=c("blue", "orange")) +
  geom_boxplot(outlier.color="black")  +
  geom_jitter(color="#222424", size=1, alpha=1) +
  labs(title="", 
       x="", y="Becn 1 mRNA expression/ actin") + 
  labs(fill="")+
  theme_bw()
#Prueba de normalidad
shapiro.test(lm(BCN1~Species, Datos)$residuals)
## 
##  Shapiro-Wilk normality test
## 
## data:  lm(BCN1 ~ Species, Datos)$residuals
## W = 0.92869, p-value = 0.5701
by(Datos$BCN1, Datos$Species, shapiro.test)
## Datos$Species: Ms 
## 
##  Shapiro-Wilk normality test
## 
## data:  dd[x, ]
## W = 0.99913, p-value = 0.9435
## 
## ---------------------------------------------------------------------------------------------------- 
## Datos$Species: NMR
## 
##  Shapiro-Wilk normality test
## 
## data:  dd[x, ]
## W = 0.90334, p-value = 0.3962
#Prueba de homoscedasticidad
bartlett.test(BCN1~Species, Datos)
## 
##  Bartlett test of homogeneity of variances
## 
## data:  BCN1 by Species
## Bartlett's K-squared = 3.9535, df = 1, p-value = 0.04677
leveneTest(BCN1~Species, data = Datos)
## Warning in leveneTest.default(y = y, group = group, ...): group coerced to factor.
## Levene's Test for Homogeneity of Variance (center = median)
##       Df F value Pr(>F)
## group  1  1.4327 0.2974
##        4
fligner.test(BCN1~Species, data = Datos)
## 
##  Fligner-Killeen test of homogeneity of variances
## 
## data:  BCN1 by Species
## Fligner-Killeen:med chi-squared = 1.0421, df = 1, p-value = 0.3073
#t-test
t.test(BCN1~Species, data = Datos, var.equal = TRUE)
## 
##  Two Sample t-test
## 
## data:  BCN1 by Species
## t = -0.97684, df = 4, p-value = 0.384
## alternative hypothesis: true difference in means between group Ms  and group NMR is not equal to 0
## 95 percent confidence interval:
##  -0.002594399  0.001243945
## sample estimates:
## mean in group Ms  mean in group NMR 
##      0.0009593433      0.0016345700
#No significativo
#Tamaño del efecto
(cohen.d(BCN1~Species, data = Datos, hedges.correction = TRUE, conf.level = 0.95))$estimate
## [1] -0.6380712
#TFEB
windows()
ggplot(data = Datos, aes(x = factor(Species), y = TFEB, fill=factor(Species))) +
  scale_fill_manual(values=c("blue", "orange")) +
  geom_boxplot(outlier.color="black")  +
  geom_jitter(color="#222424", size=1, alpha=1) +
  labs(title="", 
       x="", y="Tfeb mRNA expression/ actin") + 
  labs(fill="")+
  theme_bw()
#Prueba de normalidad
shapiro.test(lm(TFEB~Species, Datos)$residuals)
## 
##  Shapiro-Wilk normality test
## 
## data:  lm(TFEB ~ Species, Datos)$residuals
## W = 0.92552, p-value = 0.5459
by(Datos$TFEB, Datos$Species, shapiro.test)
## Datos$Species: Ms 
## 
##  Shapiro-Wilk normality test
## 
## data:  dd[x, ]
## W = 0.99218, p-value = 0.8309
## 
## ---------------------------------------------------------------------------------------------------- 
## Datos$Species: NMR
## 
##  Shapiro-Wilk normality test
## 
## data:  dd[x, ]
## W = 0.99063, p-value = 0.8149
#Pueba de homoscedasticidad
bartlett.test(TFEB~Species, Datos)
## 
##  Bartlett test of homogeneity of variances
## 
## data:  TFEB by Species
## Bartlett's K-squared = 0.12643, df = 1, p-value = 0.7222
#T-test
t.test(TFEB ~ Species, data = Datos, var.equal = TRUE)
## 
##  Two Sample t-test
## 
## data:  TFEB by Species
## t = -17.044, df = 4, p-value = 6.95e-05
## alternative hypothesis: true difference in means between group Ms  and group NMR is not equal to 0
## 95 percent confidence interval:
##  -0.0002527125 -0.0001819122
## sample estimates:
## mean in group Ms  mean in group NMR 
##      9.309233e-05      3.104047e-04
#Significativo
#Tamaño del efecto
(cohen.d(TFEB ~ Species, data = Datos, hedges.correction = TRUE, conf.level = 0.95))$estimate
## [1] -11.13301
#LAMP1
windows()
ggplot(data = Datos, aes(x = factor(Species), y = LAMP1, fill=factor(Species))) +
  scale_fill_manual(values=c("blue", "orange")) +
  geom_boxplot(outlier.color="black")  +
  geom_jitter(color="#222424", size=1, alpha=1) +
  labs(title="", 
       x="", y="Lamp 1 mRNA expression/ actin") + 
  labs(fill="")+
  theme_bw()
#Prueba de normalidad
shapiro.test(lm(LAMP1~Species, Datos)$residuals)
## 
##  Shapiro-Wilk normality test
## 
## data:  lm(LAMP1 ~ Species, Datos)$residuals
## W = 0.97331, p-value = 0.9139
by(Datos$LAMP1, Datos$Species, shapiro.test)
## Datos$Species: Ms 
## 
##  Shapiro-Wilk normality test
## 
## data:  dd[x, ]
## W = 0.97617, p-value = 0.704
## 
## ---------------------------------------------------------------------------------------------------- 
## Datos$Species: NMR
## 
##  Shapiro-Wilk normality test
## 
## data:  dd[x, ]
## W = 0.99999, p-value = 0.9938
#Pueba de homoscedasticidad
bartlett.test(LAMP1~Species, Datos)
## 
##  Bartlett test of homogeneity of variances
## 
## data:  LAMP1 by Species
## Bartlett's K-squared = 0.47817, df = 1, p-value = 0.4893
#T-test
t.test(LAMP1~Species, data = Datos, var.equal = TRUE)
## 
##  Two Sample t-test
## 
## data:  LAMP1 by Species
## t = 2.4042, df = 4, p-value = 0.07402
## alternative hypothesis: true difference in means between group Ms  and group NMR is not equal to 0
## 95 percent confidence interval:
##  -0.002653031  0.036917871
## sample estimates:
## mean in group Ms  mean in group NMR 
##        0.03951503        0.02238261
#No significativo
#Tamaño del efecto
(cohen.d(LAMP1~Species, data = Datos, hedges.correction = TRUE, conf.level = 0.95))$estimate
## [1] 1.570385
#Atp6
windows()
ggplot(data = Datos, aes(x = factor(Species), y = Atp6, fill=factor(Species))) +
  scale_fill_manual(values=c("blue", "orange")) +
  geom_boxplot(outlier.color="black")  +
  geom_jitter(color="#222424", size=1, alpha=1) +
  labs(title="", 
       x="", y="Atp6V0e1 mRNA expression/ actin") + 
  labs(fill="")+
  theme_bw()
#Prueba de normalidad
shapiro.test(lm(Atp6~Species, Datos)$residuals)
## 
##  Shapiro-Wilk normality test
## 
## data:  lm(Atp6 ~ Species, Datos)$residuals
## W = 0.8521, p-value = 0.1637
by(Datos$Atp6, Datos$Species, shapiro.test)
## Datos$Species: Ms 
## 
##  Shapiro-Wilk normality test
## 
## data:  dd[x, ]
## W = 0.76716, p-value = 0.03829
## 
## ---------------------------------------------------------------------------------------------------- 
## Datos$Species: NMR
## 
##  Shapiro-Wilk normality test
## 
## data:  dd[x, ]
## W = 0.86543, p-value = 0.2826
#Pueba de homoscedasticidad
bartlett.test(Atp6~Species, Datos)
## 
##  Bartlett test of homogeneity of variances
## 
## data:  Atp6 by Species
## Bartlett's K-squared = 0.48722, df = 1, p-value = 0.4852
#T-test
t.test(Atp6~Species, data = Datos, var.equal = TRUE)
## 
##  Two Sample t-test
## 
## data:  Atp6 by Species
## t = 8.086, df = 4, p-value = 0.001271
## alternative hypothesis: true difference in means between group Ms  and group NMR is not equal to 0
## 95 percent confidence interval:
##  0.003558191 0.007279422
## sample estimates:
## mean in group Ms  mean in group NMR 
##       0.009615173       0.004196367
t.test(Atp6~Species, data = Datos)
## 
##  Welch Two Sample t-test
## 
## data:  Atp6 by Species
## t = 8.086, df = 3.1683, p-value = 0.003228
## alternative hypothesis: true difference in means between group Ms  and group NMR is not equal to 0
## 95 percent confidence interval:
##  0.003348783 0.007488830
## sample estimates:
## mean in group Ms  mean in group NMR 
##       0.009615173       0.004196367
#Significativo
#Tamaño del efecto
(cohen.d(Atp6~Species, data = Datos, hedges.correction = TRUE, conf.level = 0.95))$estimate
## [1] 5.281781
#ATP5K
windows()
ggplot(data = Datos, aes(x = factor(Species), y = ATP5K, fill=factor(Species))) +
  scale_fill_manual(values=c("blue", "orange")) +
  geom_boxplot(outlier.color="black")  +
  geom_jitter(color="#222424", size=1, alpha=1) +
  labs(title="", 
       x="", y="Atp 5k/me mRNA expression/ actin") + 
  labs(fill="")+
  theme_bw()
#Prueba de normalidad
shapiro.test(lm(ATP5K~Species, Datos)$residuals)
## 
##  Shapiro-Wilk normality test
## 
## data:  lm(ATP5K ~ Species, Datos)$residuals
## W = 0.92435, p-value = 0.5373
by(Datos$ATP5K, Datos$Species, shapiro.test)
## Datos$Species: Ms 
## 
##  Shapiro-Wilk normality test
## 
## data:  dd[x, ]
## W = 0.89937, p-value = 0.3835
## 
## ---------------------------------------------------------------------------------------------------- 
## Datos$Species: NMR
## 
##  Shapiro-Wilk normality test
## 
## data:  dd[x, ]
## W = 0.96424, p-value = 0.6367
#Pueba de homoscedasticidad
bartlett.test(ATP5K~Species, Datos)
## 
##  Bartlett test of homogeneity of variances
## 
## data:  ATP5K by Species
## Bartlett's K-squared = 4.2025, df = 1, p-value = 0.04036
leveneTest(ATP5K~Species, data = Datos)
## Warning in leveneTest.default(y = y, group = group, ...): group coerced to factor.
## Levene's Test for Homogeneity of Variance (center = median)
##       Df F value Pr(>F)
## group  1     2.2 0.2122
##        4
fligner.test(ATP5K~Species, data = Datos)
## 
##  Fligner-Killeen test of homogeneity of variances
## 
## data:  ATP5K by Species
## Fligner-Killeen:med chi-squared = 1.0421, df = 1, p-value = 0.3073
#t-test
t.test(ATP5K~Species, data = Datos, var.equal = TRUE) #Significativo
## 
##  Two Sample t-test
## 
## data:  ATP5K by Species
## t = -3.6318, df = 4, p-value = 0.02212
## alternative hypothesis: true difference in means between group Ms  and group NMR is not equal to 0
## 95 percent confidence interval:
##  -0.011489950 -0.001533658
## sample estimates:
## mean in group Ms  mean in group NMR 
##       0.001972515       0.008484319
t.test(ATP5K~Species, data = Datos) #No significativo
## 
##  Welch Two Sample t-test
## 
## data:  ATP5K by Species
## t = -3.6318, df = 2.075, p-value = 0.06448
## alternative hypothesis: true difference in means between group Ms  and group NMR is not equal to 0
## 95 percent confidence interval:
##  -0.0139651493  0.0009415413
## sample estimates:
## mean in group Ms  mean in group NMR 
##       0.001972515       0.008484319
#Tamaño del efecto
(cohen.d(ATP5K~Species, data = Datos, hedges.correction = TRUE, conf.level = 0.95))$estimate
## [1] -2.372287