#Coeficiente de Kendall

#Variables de estudio

libretas=(c(2,1,1,2,1,2,1,2,2,1,3,1,1,2,3,3,2,1,1,3,2,2,1,1,2,2,3,1,2,3,1,2,3,2,1,1,3,1,2,2,3,2,2,1,2,3,2,2,2,2,1,3,2,3,2,2,1,2,3,1,3,3,3,1,3,1,1,2,2,1,2,3,3,2,2,2,2,1,1,3,2,2,3,1,1,1,1,1,3,3,3,3,2,2,2,3,2,2,2))
satisfaccion=(c(4,3,1,4,5,4,5,1,4,4,3,3,5,1,2,5,1,3,5,5,1,1,4,3,5,5,4,2,1,5,5,1,5,4,2,5,4,3,3,1,4,5,5,2,2,3,5,2,2,2,3,1,5,3,2,1,3,5,4,2,1,5,3,3,1,2,1,1,2,1,3,4,3,3,4,4,4,4,3,3,4,2,2,5,1,4,3,4,3,4,4,3,3,5,2,3,5,4,2))

#Pruebas de Normalidad #Graficas

qqnorm(libretas)
qqline(libretas)

qqnorm(satisfaccion)
qqline(satisfaccion)

#Formales #install.packages(‘nortest’) <—-Esta paqueteria se instala si no se tiene

library(nortest)
lillie.test(libretas)
## 
##  Lilliefors (Kolmogorov-Smirnov) normality test
## 
## data:  libretas
## D = 0.21333, p-value = 4.905e-12
lillie.test(satisfaccion)
## 
##  Lilliefors (Kolmogorov-Smirnov) normality test
## 
## data:  satisfaccion
## D = 0.16667, p-value = 3.75e-07
shapiro.test(libretas)
## 
##  Shapiro-Wilk normality test
## 
## data:  libretas
## W = 0.80724, p-value = 4.772e-10
shapiro.test(satisfaccion)
## 
##  Shapiro-Wilk normality test
## 
## data:  satisfaccion
## W = 0.89187, p-value = 6.651e-07

Calculo del coeficiente de correlación de Kendall

cor_kendall = cor.test(satisfaccion,libretas, method = "kendall")

Imprimir el resultado

print(cor_kendall)
## 
##  Kendall's rank correlation tau
## 
## data:  satisfaccion and libretas
## z = 0.30779, p-value = 0.7582
## alternative hypothesis: true tau is not equal to 0
## sample estimates:
##        tau 
## 0.02632207