Está en la página 1de 1

library(readxl)

Chi_cuadrado <- read_excel("C:/Users/LENOVO/Desktop/Chi-cuadrado.xlsx")


View(Chi_cuadrado)

# Tabla de doble entrada a partir de los datos para cada individuo


table1<-table(Chi_cuadrado$Entrenamiento,Chi_cuadrado$NivelVentas)
colnames(table1)<-c("Alto","Medio","Bajo")
rownames(table1)<-c("Alto","Medio","Bajo")
table1

# Prueba de Chi-cuadrado sin corrección por finitud


chisq.test(table1, correct = FALSE)

# Prueba de Chi-cuadrado con corrección por finitud


chisq.test(table1, correct = TRUE)

# Prueba de Chi-cuadrado con remuestreo de 10.000 muestras simuladas


chisq.test(table1, simulate.p.value=TRUE, B=10000)

# Gráfico de barras
colores<-c("red","blue","green")
barplot(table1, col = colores, beside = TRUE,
xlab="Nivel de Ventas",ylab="Frecuencia absoluta")
legend("topright", legend = c("Alto","Medio","Bajo"),
title = "Entrenamiento", fill = colores)

# Boxplot
Chi_cuadrado$NivelVentas[Chi_cuadrado$NivelVentas=="1Alto"]<-1
Chi_cuadrado$NivelVentas[Chi_cuadrado$NivelVentas=="2Medio"]<-2
Chi_cuadrado$NivelVentas[Chi_cuadrado$NivelVentas=="3Bajo"]<-3

Chi_cuadrado$NivelVentas<-as.numeric(Chi_cuadrado$NivelVentas)

boxplot(Chi_cuadrado$NivelVentas ~ Chi_cuadrado$Entrenamiento, col = colores,


names=c("Bajo","Medio","Alto"),
xlab = "Entrenamiento",
ylab="Nivel de ventas")

También podría gustarte

  • Pse 042009
    Pse 042009
    Documento139 páginas
    Pse 042009
    ANGEL GUARACA
    Aún no hay calificaciones
  • IEM 19 e
    IEM 19 e
    Documento6 páginas
    IEM 19 e
    ANGEL GUARACA
    Aún no hay calificaciones
  • Untitled
    Untitled
    Documento6 páginas
    Untitled
    ANGEL GUARACA
    Aún no hay calificaciones
  • Untitled
    Untitled
    Documento2 páginas
    Untitled
    ANGEL GUARACA
    Aún no hay calificaciones
  • Untitled
    Untitled
    Documento3 páginas
    Untitled
    ANGEL GUARACA
    Aún no hay calificaciones