# UNIVERSIDAD NACIONAL DEL ALTIPLANO
# INGENIERIA ESTADISTICA E INFORMATICA
# CURSO: DISENOS EXPERIMENTALES AVANZADOS
# TRABAJO GRUPAL
library(tidyverse)
## Warning: package 'tidyverse' was built under R version 4.0.5
## -- Attaching packages --------------------------------------- tidyverse 1.3.1 --
## v ggplot2 3.3.5 v purrr 0.3.4
## v tibble 3.1.5 v dplyr 1.0.7
## v tidyr 1.1.4 v stringr 1.4.0
## v readr 2.0.2 v forcats 0.5.1
## Warning: package 'ggplot2' was built under R version 4.0.5
## Warning: package 'tibble' was built under R version 4.0.5
## Warning: package 'tidyr' was built under R version 4.0.5
## Warning: package 'readr' was built under R version 4.0.5
## Warning: package 'dplyr' was built under R version 4.0.5
## Warning: package 'forcats' was built under R version 4.0.5
## -- Conflicts ------------------------------------------ tidyverse_conflicts() --
## x dplyr::filter() masks stats::filter()
## x dplyr::lag() masks stats::lag()
library(ggpubr)
## Warning: package 'ggpubr' was built under R version 4.0.5
library(rstatix)
## Warning: package 'rstatix' was built under R version 4.0.5
##
## Attaching package: 'rstatix'
## The following object is masked from 'package:stats':
##
## filter
library(readxl)
## Warning: package 'readxl' was built under R version 4.0.2
Ejemplo_4 <- read_excel("E:/DISENOS EXPERIMENTALES AVANZADOS/UNIDAD II/TAREA 01/Ejemplo 4.xlsx")
# View(Ejemplo_4)
attach(Ejemplo_4)
names(Ejemplo_4)
## [1] "id" "Tiempo" "Puntuacion"
# Analisis Descriptivo
Ejemplo_4 %>%
group_by(Tiempo) %>%
get_summary_stats(Puntuacion, type = "mean_sd")
## # A tibble: 3 x 5
## Tiempo variable n mean sd
## <chr> <chr> <dbl> <dbl> <dbl>
## 1 tiempo1 Puntuacion 10 62.5 1.96
## 2 tiempo2 Puntuacion 10 79.1 2.96
## 3 tiempo3 Puntuacion 10 65 2.06
# Visualizar
Boxplot <- ggboxplot(Ejemplo_4, x = "Tiempo", y = "Puntuacion", add = "point", fill = "Tiempo")
Boxplot

# Verificar los Supuestos
# Valores Exremos
Ejemplo_4 %>%
group_by(Tiempo) %>%
identify_outliers(Puntuacion)
## [1] Tiempo id Puntuacion is.outlier is.extreme
## <0 rows> (or 0-length row.names)
# Normalidad
Ejemplo_4 %>%
group_by(Tiempo) %>%
shapiro_test(Puntuacion)
## # A tibble: 3 x 4
## Tiempo variable statistic p
## <chr> <chr> <dbl> <dbl>
## 1 tiempo1 Puntuacion 0.898 0.206
## 2 tiempo2 Puntuacion 0.958 0.758
## 3 tiempo3 Puntuacion 0.940 0.550
ggqqplot(Ejemplo_4, "Puntuacion", facet.by = "Tiempo")

# Esfericidad
# modelo_1$`Mauchly's Test for Sphericity`
# Consultar ANOVA Medidas Repetidas
modelo_1 <- anova_test(data = Ejemplo_4, dv = Puntuacion, wid = id, within = Tiempo, effect.size = "pes")
get_anova_table(modelo_1)
## ANOVA Table (type III tests)
##
## Effect DFn DFd F p p<.05 pes
## 1 Tiempo 2 18 173.162 1.75e-12 * 0.951
# Comparaciones Multiples
comparacion_multiple <- Ejemplo_4 %>%
pairwise_t_test(
Puntuacion ~ Tiempo, paired = TRUE,
p.adjust.method = "bonferroni"
)
comparacion_multiple
## # A tibble: 3 x 10
## .y. group1 group2 n1 n2 statistic df p p.adj p.adj.signif
## * <chr> <chr> <chr> <int> <int> <dbl> <dbl> <dbl> <dbl> <chr>
## 1 Puntu~ tiempo1 tiemp~ 10 10 -17.6 9 2.85e-8 8.55e-8 ****
## 2 Puntu~ tiempo1 tiemp~ 10 10 -3.21 9 1.1 e-2 3.2 e-2 *
## 3 Puntu~ tiempo2 tiemp~ 10 10 12.5 9 5.51e-7 1.65e-6 ****
# Interpretacion
#Se realizo un ANOVA de medidas repetidas para examinar si existen diferencias en las puntuaciones
#medias de matematicas entre el tiempo 1 (M=62.5, SD=1.96)