Bibliotecas

library(readxl)
library(tidyverse)
library(janitor)
library(ggpubr)
library(qqplotr)
library(car)
library(nortest)

Datos

ratones <- read_excel("experimento_ratones.xlsx")
ratones
## # A tibble: 16 x 4
##    Block Treatment Strain    GST
##    <chr> <chr>     <chr>   <dbl>
##  1 A     Control   NIH       444
##  2 A     Treated   NIH       614
##  3 A     Control   BALB/C    423
##  4 A     Treated   BALB/C    625
##  5 A     Control   A/J       408
##  6 A     Treated   A/J       856
##  7 A     Control   129/Ola   447
##  8 A     Treated   129/Ola   719
##  9 B     Control   NIH       764
## 10 B     Treated   NIH       831
## 11 B     Control   BALB/C    586
## 12 B     Treated   BALB/C    782
## 13 B     Control   A/J       609
## 14 B     Treated   A/J      1002
## 15 B     Control   129/Ola   606
## 16 B     Treated   129/Ola   766

Analizando la normalidad

  • Gráficos:
    • Histogramas
    • Densidades
    • Gráficos cuantil-cuantil (Q-Q Norm)
  • Pruebas de hipótesis:
    • Prueba de Shapiro Wilk
    • Prueba de Anderson Darling
    • Otras pruebas: Cramer-von Mises, Lilliefors (Kolmogorov-Smirnov), Pearson chi-square, entre otras.

Gráficos

Densidad

ratones %>% 
  ggplot(aes(x = GST)) +
  geom_density(fill = "forestgreen", color = "forestgreen", alpha = 0.3) +
  geom_rug()

Boxplot

ratones %>% 
  ggplot(aes(x = "", y = GST)) +
  geom_boxplot(fill = "forestgreen", color = "forestgreen", alpha = 0.3) +
  geom_rug() +
  coord_flip()

Gráfico Cuantil-Cuantil

ggplot2

ratones %>% 
  ggplot(aes(sample = GST)) +
  geom_qq() +
  geom_qq_line()

qqplotr

ratones %>%
  ggplot(aes(sample = GST)) +
  stat_qq_band() +
  stat_qq_line() +
  stat_qq_point()

ggpubr

ggqqplot(data = ratones$GST)

car

qqPlot(x = ratones$GST)

## [1] 14  5

Pruebas de hipótesis

Hipótesis general

\[H_0: X \sim N(\mu, \sigma) \\ H_1: X \nsim N(\mu, \sigma)\]

Shapiro-Wilk

shapiro.test(x = ratones$GST)
## 
##  Shapiro-Wilk normality test
## 
## data:  ratones$GST
## W = 0.94891, p-value = 0.4726

Anderson-Darling

ad.test(x = ratones$GST)
## 
##  Anderson-Darling normality test
## 
## data:  ratones$GST
## A = 0.33472, p-value = 0.4646

Cramer-von Mises

cvm.test(x = ratones$GST)
## 
##  Cramer-von Mises normality test
## 
## data:  ratones$GST
## W = 0.050458, p-value = 0.482

Lilliefors (Kolmogorov-Smirnov)

lillie.test(x = ratones$GST)
## 
##  Lilliefors (Kolmogorov-Smirnov) normality test
## 
## data:  ratones$GST
## D = 0.13506, p-value = 0.6069

Shapiro-Francia

sf.test(x = ratones$GST)
## 
##  Shapiro-Francia normality test
## 
## data:  ratones$GST
## W = 0.95742, p-value = 0.528