Prueba de hipotesis para dos muestras pareadas

set.seed(123)
cra= rnorm(n=80, mean=2.8, sd= 0.2)
hist(cra, xlim=c(2.2, 3.4), ylim=c(0, 20 ))
abline (v=mean(cra), col= 'red', lwd=3)

library(readxl)
## Warning: package 'readxl' was built under R version 4.2.2
cra=read_excel("C:/Users/FCECURSOS/Desktop/cra.xlsx")
## New names:
## • `CRA60` -> `CRA60...1`
## • `CRA80` -> `CRA80...2`
## • `` -> `...3`
## • `` -> `...5`
## • `CRA60` -> `CRA60...6`
## • `CRA80` -> `CRA80...7`
plot(cra$CRA60...6, cra$CRA80...7, pch=16, cex=1.5, 
     xlab ='CRA60', ylab='CRA80')

Ejemplos en algunas áreas

\[H_0: \mu_{CRA_{60}}= \mu_{CRA_{80}}\]

# Prueba3: t-Student para dos muestras pareadas

prueba3 = t.test(cra$CRA60...6, cra$CRA80...7,
       alternative = 't', # t = two.sided
       mu= 0, 
       paired = TRUE)
ifelse(prueba3$p.value<0.05, 'Rechazo Ho', 'No rechazo Ho')
## [1] "Rechazo Ho"
boxplot(cra$CRA60...6, cra$CRA80...7)