1) Carga, inspección y preparación
recode_ord <- function(x, labels) {
factor(x, levels = seq_along(labels), labels = labels, ordered = TRUE)
}
### Carga y nombres
if ("rotacion" %in% data(package = "paqueteMODELOS")$results[, "Item"]) {
data("rotacion", package = "paqueteMODELOS")
} else {
rotacion <- tryCatch(paqueteMODELOS::rotacion, error = function(e) NULL)
}
stopifnot(!is.null(rotacion))
rotacion <- janitor::clean_names(rotacion)
glimpse(rotacion)
## Rows: 1,470
## Columns: 24
## $ rotacion <chr> "Si", "No", "Si", "No", "No", "No", "No", …
## $ edad <dbl> 41, 49, 37, 33, 27, 32, 59, 30, 38, 36, 35…
## $ viaje_de_negocios <chr> "Raramente", "Frecuentemente", "Raramente"…
## $ departamento <chr> "Ventas", "IyD", "IyD", "IyD", "IyD", "IyD…
## $ distancia_casa <dbl> 1, 8, 2, 3, 2, 2, 3, 24, 23, 27, 16, 15, 2…
## $ educacion <dbl> 2, 1, 2, 4, 1, 2, 3, 1, 3, 3, 3, 2, 1, 2, …
## $ campo_educacion <chr> "Ciencias", "Ciencias", "Otra", "Ciencias"…
## $ satisfaccion_ambiental <dbl> 2, 3, 4, 4, 1, 4, 3, 4, 4, 3, 1, 4, 1, 2, …
## $ genero <chr> "F", "M", "M", "F", "M", "M", "F", "M", "M…
## $ cargo <chr> "Ejecutivo_Ventas", "Investigador_Cientifi…
## $ satisfacion_laboral <dbl> 4, 2, 3, 3, 2, 4, 1, 3, 3, 3, 2, 3, 3, 4, …
## $ estado_civil <chr> "Soltero", "Casado", "Soltero", "Casado", …
## $ ingreso_mensual <dbl> 5993, 5130, 2090, 2909, 3468, 3068, 2670, …
## $ trabajos_anteriores <dbl> 8, 1, 6, 1, 9, 0, 4, 1, 0, 6, 0, 0, 1, 0, …
## $ horas_extra <chr> "Si", "No", "Si", "Si", "No", "No", "Si", …
## $ porcentaje_aumento_salarial <dbl> 11, 23, 15, 11, 12, 13, 20, 22, 21, 13, 13…
## $ rendimiento_laboral <dbl> 3, 4, 3, 3, 3, 3, 4, 4, 4, 3, 3, 3, 3, 3, …
## $ anos_experiencia <dbl> 8, 10, 7, 8, 6, 8, 12, 1, 10, 17, 6, 10, 5…
## $ capacitaciones <dbl> 0, 3, 3, 3, 3, 2, 3, 2, 2, 3, 5, 3, 1, 2, …
## $ equilibrio_trabajo_vida <dbl> 1, 3, 3, 3, 3, 2, 2, 3, 3, 2, 3, 3, 2, 3, …
## $ antiguedad <dbl> 6, 10, 0, 8, 2, 7, 1, 1, 9, 7, 5, 9, 5, 2,…
## $ antiguedad_cargo <dbl> 4, 7, 0, 7, 2, 7, 0, 0, 7, 7, 4, 5, 2, 2, …
## $ anos_ultima_promocion <dbl> 0, 1, 0, 3, 2, 3, 0, 0, 1, 7, 0, 0, 4, 1, …
## $ anos_acargo_con_mismo_jefe <dbl> 5, 7, 0, 0, 2, 6, 0, 0, 8, 7, 3, 8, 3, 2, …
### Recodificación
## --- Variable respuesta: 'rotacion' y binaria 'y' ---
if ("rotacion" %in% names(rotacion)) {
v <- rotacion$rotacion
if (is.numeric(v)) {
v <- ifelse(v == 1, "Si", "No")
} else if (is.logical(v)) {
v <- ifelse(v, "Si", "No")
} else {
v <- as.character(v)
v <- dplyr::case_when(
v %in% c("1","si","sí","Si","SI","Yes","TRUE","True") ~ "Si",
v %in% c("0","no","No","NO","FALSE","False") ~ "No",
TRUE ~ v
)
}
rotacion$rotacion <- factor(v, levels = c("No","Si"))
rotacion$y <- as.integer(rotacion$rotacion == "Si") # 1 = Sí rota; 0 = No
}
## --- Ordinales (Likert) como factores ordenados ---
if ("rendimiento_laboral" %in% names(rotacion)) {
rotacion$rendimiento_laboral <- recode_ord(rotacion$rendimiento_laboral,
c("Bajo","Medio","Alto","Muy alto"))
}
if ("educacion" %in% names(rotacion)) {
rotacion$educacion <- recode_ord(rotacion$educacion,
c("Primaria","Secundaria","Técnico/tecnólogo","Pregrado","Posgrado"))
}
if ("satisfaccion_ambiental" %in% names(rotacion)) {
rotacion$satisfaccion_ambiental <- recode_ord(rotacion$satisfaccion_ambiental,
c("Muy insatisfecho","Insatisfecho","Satisfecho","Muy satisfecho"))
}
if ("satisfacion_laboral" %in% names(rotacion)) {
rotacion$satisfacion_laboral <- recode_ord(rotacion$satisfacion_laboral,
c("Muy insatisfecho","Insatisfecho","Satisfecho","Muy satisfecho"))
}
if ("equilibrio_trabajo_vida" %in% names(rotacion)) {
rotacion$equilibrio_trabajo_vida <- recode_ord(rotacion$equilibrio_trabajo_vida,
c("Muy bajo","Bajo","Medio","Alto"))
}
## --- Numéricas / enteras ---
if ("distancia_de_la_casa" %in% names(rotacion)) {
rotacion$distancia_de_la_casa <- suppressWarnings(as.numeric(rotacion$distancia_de_la_casa))
}
if ("trabajos_anteriores" %in% names(rotacion)) {
rotacion$trabajos_anteriores <- suppressWarnings(as.integer(rotacion$trabajos_anteriores))
}
glimpse(rotacion)
## Rows: 1,470
## Columns: 25
## $ rotacion <fct> Si, No, Si, No, No, No, No, No, No, No, No…
## $ edad <dbl> 41, 49, 37, 33, 27, 32, 59, 30, 38, 36, 35…
## $ viaje_de_negocios <chr> "Raramente", "Frecuentemente", "Raramente"…
## $ departamento <chr> "Ventas", "IyD", "IyD", "IyD", "IyD", "IyD…
## $ distancia_casa <dbl> 1, 8, 2, 3, 2, 2, 3, 24, 23, 27, 16, 15, 2…
## $ educacion <ord> Secundaria, Primaria, Secundaria, Pregrado…
## $ campo_educacion <chr> "Ciencias", "Ciencias", "Otra", "Ciencias"…
## $ satisfaccion_ambiental <ord> Insatisfecho, Satisfecho, Muy satisfecho, …
## $ genero <chr> "F", "M", "M", "F", "M", "M", "F", "M", "M…
## $ cargo <chr> "Ejecutivo_Ventas", "Investigador_Cientifi…
## $ satisfacion_laboral <ord> Muy satisfecho, Insatisfecho, Satisfecho, …
## $ estado_civil <chr> "Soltero", "Casado", "Soltero", "Casado", …
## $ ingreso_mensual <dbl> 5993, 5130, 2090, 2909, 3468, 3068, 2670, …
## $ trabajos_anteriores <int> 8, 1, 6, 1, 9, 0, 4, 1, 0, 6, 0, 0, 1, 0, …
## $ horas_extra <chr> "Si", "No", "Si", "Si", "No", "No", "Si", …
## $ porcentaje_aumento_salarial <dbl> 11, 23, 15, 11, 12, 13, 20, 22, 21, 13, 13…
## $ rendimiento_laboral <ord> Alto, Muy alto, Alto, Alto, Alto, Alto, Mu…
## $ anos_experiencia <dbl> 8, 10, 7, 8, 6, 8, 12, 1, 10, 17, 6, 10, 5…
## $ capacitaciones <dbl> 0, 3, 3, 3, 3, 2, 3, 2, 2, 3, 5, 3, 1, 2, …
## $ equilibrio_trabajo_vida <ord> Muy bajo, Medio, Medio, Medio, Medio, Bajo…
## $ antiguedad <dbl> 6, 10, 0, 8, 2, 7, 1, 1, 9, 7, 5, 9, 5, 2,…
## $ antiguedad_cargo <dbl> 4, 7, 0, 7, 2, 7, 0, 0, 7, 7, 4, 5, 2, 2, …
## $ anos_ultima_promocion <dbl> 0, 1, 0, 3, 2, 3, 0, 0, 1, 7, 0, 0, 4, 1, …
## $ anos_acargo_con_mismo_jefe <dbl> 5, 7, 0, 0, 2, 6, 0, 0, 8, 7, 3, 8, 3, 2, …
## $ y <int> 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, …
3) Análisis univariado y bivariado
3.1 Rotación (prevalencia)
prev_tbl <- rotacion |>
dplyr::count(y) |>
dplyr::mutate(prop = n / sum(n))
prev_tbl
ggplot(prev_tbl, aes(x = factor(y), y = prop)) +
geom_col() +
geom_text(aes(label = scales::percent(prop)), vjust = -0.2) +
labs(x = "Rotación (0=No, 1=Sí)", y = "Proporción", title = "Prevalencia de rotación") +
scale_y_continuous(labels = scales::percent_format()) +
theme_minimal()

Interpretación. La proporción de rotación es 16%; la
clase es desbalanceada, por lo que evaluamos con
ROC/AUC y ajustamos umbrales en la fase predictiva.
3.2 Numéricas: resumen y gráficos
vars_num <- c(
"edad","distancia_casa","ingreso_mensual","trabajos_anteriores",
"porcentaje_aumento_salarial","anos_experiencia","capacitaciones",
"antiguedad","antiguedad_cargo","anos_ultima_promocion",
"anos_acargo_con_mismo_jefe"
)
vars_num <- intersect(vars_num, names(rotacion))
num_summary <- lapply(vars_num, function(v){
x <- rotacion[[v]]
data.frame(
variable = v,
n = sum(!is.na(x)),
na = sum(is.na(x)),
min = min(x, na.rm = TRUE),
q1 = quantile(x, 0.25, na.rm = TRUE),
mediana = median(x, na.rm = TRUE),
q3 = quantile(x, 0.75, na.rm = TRUE),
max = max(x, na.rm = TRUE),
media = mean(x, na.rm = TRUE),
sd = sd(x, na.rm = TRUE),
stringsAsFactors = FALSE
)
}) |> dplyr::bind_rows()
knitr::kable(num_summary, caption = "Resumen descriptivo de variables numéricas")
Resumen descriptivo de variables numéricas
| 25%…1 |
edad |
1470 |
0 |
18 |
30 |
36 |
43 |
60 |
36.924490 |
9.135938 |
| 25%…2 |
distancia_casa |
1470 |
0 |
1 |
2 |
7 |
14 |
29 |
9.192517 |
8.106864 |
| 25%…3 |
ingreso_mensual |
1470 |
0 |
1009 |
2911 |
4919 |
8379 |
19999 |
6502.931293 |
4707.956783 |
| 25%…4 |
trabajos_anteriores |
1470 |
0 |
0 |
1 |
2 |
4 |
9 |
2.693197 |
2.498009 |
| 25%…5 |
porcentaje_aumento_salarial |
1470 |
0 |
11 |
12 |
14 |
18 |
25 |
15.209524 |
3.659938 |
| 25%…6 |
anos_experiencia |
1470 |
0 |
0 |
6 |
10 |
15 |
40 |
11.279592 |
7.780782 |
| 25%…7 |
capacitaciones |
1470 |
0 |
0 |
2 |
3 |
3 |
6 |
2.799320 |
1.289271 |
| 25%…8 |
antiguedad |
1470 |
0 |
0 |
3 |
5 |
9 |
40 |
7.008163 |
6.126525 |
| 25%…9 |
antiguedad_cargo |
1470 |
0 |
0 |
2 |
3 |
7 |
18 |
4.229252 |
3.623137 |
| 25%…10 |
anos_ultima_promocion |
1470 |
0 |
0 |
0 |
1 |
3 |
15 |
2.187755 |
3.222430 |
| 25%…11 |
anos_acargo_con_mismo_jefe |
1470 |
0 |
0 |
2 |
3 |
7 |
17 |
4.123129 |
3.568136 |
for(v in vars_num){
print(
ggplot(rotacion, aes(x = .data[[v]])) +
geom_histogram(bins = 30) +
labs(title = paste("Histograma -", v), x = v, y = "Frecuencia") +
theme_minimal()
)
print(
ggplot(rotacion, aes(y = .data[[v]])) +
geom_boxplot() +
labs(title = paste("Boxplot -", v), x = NULL, y = v) +
theme_minimal()
)
}






















3.3 Categóricas: frecuencias y gráficos
vars_nom <- c("viaje_de_negocios","departamento","campo_educacion",
"genero","cargo","estado_civil","horas_extra")
vars_ord <- c("educacion","satisfaccion_ambiental","satisfacion_laboral",
"rendimiento_laboral","equilibrio_trabajo_vida")
vars_nom <- intersect(vars_nom, names(rotacion))
vars_ord <- intersect(vars_ord, names(rotacion))
vars_cat <- c(vars_nom, vars_ord)
for(v in vars_cat){
df <- rotacion |>
dplyr::mutate(across(all_of(v), ~ as.factor(.))) |>
dplyr::count(.data[[v]]) |>
dplyr::mutate(prop = n / sum(n)) |>
dplyr::arrange(dplyr::desc(n))
print(df)
g <- ggplot(df, aes(x = .data[[v]], y = prop)) +
geom_col() +
geom_text(aes(label = scales::percent(prop)), vjust = -0.2, size = 3) +
labs(title = paste("Distribución -", v), x = v, y = "Proporción") +
scale_y_continuous(labels = scales::percent_format()) +
theme_minimal()
print(g)
}
## # A tibble: 3 × 3
## viaje_de_negocios n prop
## <fct> <int> <dbl>
## 1 Raramente 1043 0.710
## 2 Frecuentemente 277 0.188
## 3 No_Viaja 150 0.102

## # A tibble: 3 × 3
## departamento n prop
## <fct> <int> <dbl>
## 1 IyD 961 0.654
## 2 Ventas 446 0.303
## 3 RH 63 0.0429

## # A tibble: 6 × 3
## campo_educacion n prop
## <fct> <int> <dbl>
## 1 Ciencias 606 0.412
## 2 Salud 464 0.316
## 3 Mercadeo 159 0.108
## 4 Tecnicos 132 0.0898
## 5 Otra 82 0.0558
## 6 Humanidades 27 0.0184

## # A tibble: 2 × 3
## genero n prop
## <fct> <int> <dbl>
## 1 M 882 0.6
## 2 F 588 0.4

## # A tibble: 9 × 3
## cargo n prop
## <fct> <int> <dbl>
## 1 Ejecutivo_Ventas 326 0.222
## 2 Investigador_Cientifico 292 0.199
## 3 Tecnico_Laboratorio 259 0.176
## 4 Director_Manofactura 145 0.0986
## 5 Representante_Salud 131 0.0891
## 6 Gerente 102 0.0694
## 7 Representante_Ventas 83 0.0565
## 8 Director_Investigación 80 0.0544
## 9 Recursos_Humanos 52 0.0354

## # A tibble: 3 × 3
## estado_civil n prop
## <fct> <int> <dbl>
## 1 Casado 673 0.458
## 2 Soltero 470 0.320
## 3 Divorciado 327 0.222

## # A tibble: 2 × 3
## horas_extra n prop
## <fct> <int> <dbl>
## 1 No 1054 0.717
## 2 Si 416 0.283

## # A tibble: 5 × 3
## educacion n prop
## <ord> <int> <dbl>
## 1 Técnico/tecnólogo 572 0.389
## 2 Pregrado 398 0.271
## 3 Secundaria 282 0.192
## 4 Primaria 170 0.116
## 5 Posgrado 48 0.0327

## # A tibble: 4 × 3
## satisfaccion_ambiental n prop
## <ord> <int> <dbl>
## 1 Satisfecho 453 0.308
## 2 Muy satisfecho 446 0.303
## 3 Insatisfecho 287 0.195
## 4 Muy insatisfecho 284 0.193

## # A tibble: 4 × 3
## satisfacion_laboral n prop
## <ord> <int> <dbl>
## 1 Muy satisfecho 459 0.312
## 2 Satisfecho 442 0.301
## 3 Muy insatisfecho 289 0.197
## 4 Insatisfecho 280 0.190

## # A tibble: 2 × 3
## rendimiento_laboral n prop
## <ord> <int> <dbl>
## 1 Alto 1244 0.846
## 2 Muy alto 226 0.154

## # A tibble: 4 × 3
## equilibrio_trabajo_vida n prop
## <ord> <int> <dbl>
## 1 Medio 893 0.607
## 2 Bajo 344 0.234
## 3 Alto 153 0.104
## 4 Muy bajo 80 0.0544

3.4 Bivariado: numéricas vs rotación
vars_num <- intersect(vars_num, names(rotacion))
num_biv <- lapply(vars_num, function(v){
x <- rotacion[[v]]; y <- rotacion$y
ok <- complete.cases(x,y)
if(!any(ok)) return(NULL)
df <- data.frame(x=x[ok], y=y[ok])
gsum <- df |>
dplyr::group_by(y) |>
dplyr::summarise(n=dplyr::n(), media=mean(x), sd=sd(x), .groups="drop")
tt <- tryCatch(t.test(x ~ y, data=df), error=function(e) NULL)
dif_media <- if (!is.null(tt)) unname(diff(tt$estimate)) else NA_real_
p_ttest <- if (!is.null(tt)) tt$p.value else NA_real_
m <- glm(y ~ x, family=binomial(), data=df)
b <- coef(summary(m))["x","Estimate"]
se <- coef(summary(m))["x","Std. Error"]
or <- exp(b)
li <- exp(b - 1.96*se); ls <- exp(b + 1.96*se)
p <- coef(summary(m))["x","Pr(>|z|)"]
tibble::tibble(
variable = v,
media_y0 = gsum$media[gsum$y==0],
media_y1 = gsum$media[gsum$y==1],
dif_media = dif_media, p_ttest = p_ttest,
beta = b, OR = or, OR_LI = li, OR_LS = ls, p_glm = p,
signo = ifelse(b>0,"(+)","(-)")
)
}) |> dplyr::bind_rows()
knitr::kable(num_biv, digits = 3, caption = "Bivariado numéricas vs rotación")
Bivariado numéricas vs rotación
| edad |
37.562 |
33.608 |
-3.954 |
0.000 |
-0.052 |
0.949 |
0.933 |
0.965 |
0.000 |
(-) |
| distancia_casa |
8.916 |
10.633 |
1.717 |
0.004 |
0.025 |
1.025 |
1.008 |
1.042 |
0.003 |
(+) |
| ingreso_mensual |
6832.740 |
4787.093 |
-2045.647 |
0.000 |
0.000 |
1.000 |
1.000 |
1.000 |
0.000 |
(-) |
| trabajos_anteriores |
2.646 |
2.941 |
0.295 |
0.116 |
0.046 |
1.047 |
0.992 |
1.104 |
0.096 |
(+) |
| porcentaje_aumento_salarial |
15.231 |
15.097 |
-0.134 |
0.614 |
-0.010 |
0.990 |
0.953 |
1.029 |
0.605 |
(-) |
| anos_experiencia |
11.863 |
8.245 |
-3.618 |
0.000 |
-0.078 |
0.925 |
0.903 |
0.948 |
0.000 |
(-) |
| capacitaciones |
2.833 |
2.624 |
-0.208 |
0.020 |
-0.130 |
0.878 |
0.785 |
0.982 |
0.023 |
(-) |
| antiguedad |
7.369 |
5.131 |
-2.238 |
0.000 |
-0.081 |
0.922 |
0.894 |
0.952 |
0.000 |
(-) |
| antiguedad_cargo |
4.484 |
2.903 |
-1.581 |
0.000 |
-0.146 |
0.864 |
0.824 |
0.906 |
0.000 |
(-) |
| anos_ultima_promocion |
2.234 |
1.945 |
-0.289 |
0.199 |
-0.030 |
0.971 |
0.927 |
1.017 |
0.206 |
(-) |
| anos_acargo_con_mismo_jefe |
4.367 |
2.852 |
-1.515 |
0.000 |
-0.141 |
0.868 |
0.828 |
0.910 |
0.000 |
(-) |
3.5 Bivariado: categóricas vs rotación
cat_biv <- lapply(vars_cat, function(v){
x <- rotacion[[v]]; y <- rotacion$y
ok <- complete.cases(x, y)
if (!any(ok)) return(NULL)
df <- data.frame(f = x[ok], y = y[ok])
if (is.ordered(df$f)) df$f <- factor(df$f, ordered = FALSE)
df$f <- factor(df$f)
if (nlevels(df$f) < 2) return(NULL)
tasas <- df |>
dplyr::count(f) |>
dplyr::mutate(rotacion = tapply(df$y, df$f, mean)[as.character(f)]) |>
dplyr::arrange(dplyr::desc(rotacion))
tab <- table(df$f, df$y)
p_chi <- suppressWarnings(chisq.test(tab))$p.value
df$f <- stats::relevel(df$f, ref = levels(df$f)[1])
m <- glm(y ~ f, family = binomial(), data = df)
co <- broom::tidy(m, conf.int = TRUE, exponentiate = TRUE) |>
dplyr::filter(term != "(Intercept)") |>
dplyr::transmute(
nivel = sub("^f", "", term),
OR = estimate, OR_LI = conf.low, OR_LS = conf.high, p_glm = p.value
)
list(variable = v, tasas = tasas, p_chi = p_chi, ORs = co)
})
for(res in cat_biv){
cat("\n\n==== Variable:", res$variable, "====\n")
print(res$tasas)
cat("Chi-cuadrado p-value:", signif(res$p_chi, 4), "\n")
cat("OR por nivel vs. referencia (primer nivel):\n")
print(res$ORs)
}
##
##
## ==== Variable: viaje_de_negocios ====
## f n rotacion
## 1 Frecuentemente 277 0.2490975
## 2 Raramente 1043 0.1495686
## 3 No_Viaja 150 0.0800000
## Chi-cuadrado p-value: 5.609e-06
## OR por nivel vs. referencia (primer nivel):
## # A tibble: 2 × 5
## nivel OR OR_LI OR_LS p_glm
## <chr> <dbl> <dbl> <dbl> <dbl>
## 1 No_Viaja 0.262 0.131 0.485 0.0000536
## 2 Raramente 0.530 0.386 0.734 0.000107
##
##
## ==== Variable: departamento ====
## f n rotacion
## 1 Ventas 446 0.2062780
## 2 RH 63 0.1904762
## 3 IyD 961 0.1383975
## Chi-cuadrado p-value: 0.004526
## OR por nivel vs. referencia (primer nivel):
## # A tibble: 2 × 5
## nivel OR OR_LI OR_LS p_glm
## <chr> <dbl> <dbl> <dbl> <dbl>
## 1 RH 1.46 0.729 2.73 0.253
## 2 Ventas 1.62 1.20 2.17 0.00131
##
##
## ==== Variable: campo_educacion ====
## f n rotacion
## 1 Humanidades 27 0.2592593
## 2 Tecnicos 132 0.2424242
## 3 Mercadeo 159 0.2201258
## 4 Ciencias 606 0.1468647
## 5 Salud 464 0.1357759
## 6 Otra 82 0.1341463
## Chi-cuadrado p-value: 0.006774
## OR por nivel vs. referencia (primer nivel):
## # A tibble: 5 × 5
## nivel OR OR_LI OR_LS p_glm
## <chr> <dbl> <dbl> <dbl> <dbl>
## 1 Humanidades 2.03 0.779 4.74 0.118
## 2 Mercadeo 1.64 1.05 2.52 0.0267
## 3 Otra 0.900 0.437 1.70 0.759
## 4 Salud 0.913 0.642 1.29 0.607
## 5 Tecnicos 1.86 1.16 2.91 0.00787
##
##
## ==== Variable: genero ====
## f n rotacion
## 1 M 882 0.1700680
## 2 F 588 0.1479592
## Chi-cuadrado p-value: 0.2906
## OR por nivel vs. referencia (primer nivel):
## # A tibble: 1 × 5
## nivel OR OR_LI OR_LS p_glm
## <chr> <dbl> <dbl> <dbl> <dbl>
## 1 M 1.18 0.887 1.58 0.259
##
##
## ==== Variable: cargo ====
## f n rotacion
## 1 Representante_Ventas 83 0.39759036
## 2 Tecnico_Laboratorio 259 0.23938224
## 3 Recursos_Humanos 52 0.23076923
## 4 Ejecutivo_Ventas 326 0.17484663
## 5 Investigador_Cientifico 292 0.16095890
## 6 Director_Manofactura 145 0.06896552
## 7 Representante_Salud 131 0.06870229
## 8 Gerente 102 0.04901961
## 9 Director_Investigación 80 0.02500000
## Chi-cuadrado p-value: 2.752e-15
## OR por nivel vs. referencia (primer nivel):
## # A tibble: 8 × 5
## nivel OR OR_LI OR_LS p_glm
## <chr> <dbl> <dbl> <dbl> <dbl>
## 1 Director_Manofactura 2.89 0.738 19.1 0.178
## 2 Ejecutivo_Ventas 8.26 2.50 51.1 0.00385
## 3 Gerente 2.01 0.421 14.3 0.412
## 4 Investigador_Cientifico 7.48 2.24 46.4 0.00608
## 5 Recursos_Humanos 11.7 3.00 77.6 0.00180
## 6 Representante_Salud 2.88 0.718 19.2 0.184
## 7 Representante_Ventas 25.7 7.37 163. 0.0000150
## 8 Tecnico_Laboratorio 12.3 3.71 75.9 0.000601
##
##
## ==== Variable: estado_civil ====
## f n rotacion
## 1 Soltero 470 0.2553191
## 2 Casado 673 0.1248143
## 3 Divorciado 327 0.1009174
## Chi-cuadrado p-value: 9.456e-11
## OR por nivel vs. referencia (primer nivel):
## # A tibble: 2 × 5
## nivel OR OR_LI OR_LS p_glm
## <chr> <dbl> <dbl> <dbl> <dbl>
## 1 Divorciado 0.787 0.508 1.19 0.271
## 2 Soltero 2.40 1.77 3.28 0.0000000254
##
##
## ==== Variable: horas_extra ====
## f n rotacion
## 1 Si 416 0.3052885
## 2 No 1054 0.1043643
## Chi-cuadrado p-value: 8.158e-21
## OR por nivel vs. referencia (primer nivel):
## # A tibble: 1 × 5
## nivel OR OR_LI OR_LS p_glm
## <chr> <dbl> <dbl> <dbl> <dbl>
## 1 Si 3.77 2.83 5.03 1.35e-19
##
##
## ==== Variable: educacion ====
## f n rotacion
## 1 Primaria 170 0.1823529
## 2 Técnico/tecnólogo 572 0.1730769
## 3 Secundaria 282 0.1560284
## 4 Pregrado 398 0.1457286
## 5 Posgrado 48 0.1041667
## Chi-cuadrado p-value: 0.5455
## OR por nivel vs. referencia (primer nivel):
## # A tibble: 4 × 5
## nivel OR OR_LI OR_LS p_glm
## <chr> <dbl> <dbl> <dbl> <dbl>
## 1 Secundaria 0.829 0.502 1.38 0.467
## 2 Técnico/tecnólogo 0.938 0.607 1.48 0.780
## 3 Pregrado 0.765 0.477 1.25 0.272
## 4 Posgrado 0.521 0.170 1.32 0.204
##
##
## ==== Variable: satisfaccion_ambiental ====
## f n rotacion
## 1 Muy insatisfecho 284 0.2535211
## 2 Insatisfecho 287 0.1498258
## 3 Satisfecho 453 0.1368653
## 4 Muy satisfecho 446 0.1345291
## Chi-cuadrado p-value: 5.123e-05
## OR por nivel vs. referencia (primer nivel):
## # A tibble: 3 × 5
## nivel OR OR_LI OR_LS p_glm
## <chr> <dbl> <dbl> <dbl> <dbl>
## 1 Insatisfecho 0.519 0.339 0.787 0.00221
## 2 Satisfecho 0.467 0.319 0.681 0.0000801
## 3 Muy satisfecho 0.458 0.312 0.669 0.0000590
##
##
## ==== Variable: satisfacion_laboral ====
## f n rotacion
## 1 Muy insatisfecho 289 0.2283737
## 2 Satisfecho 442 0.1651584
## 3 Insatisfecho 280 0.1642857
## 4 Muy satisfecho 459 0.1132898
## Chi-cuadrado p-value: 0.0005563
## OR por nivel vs. referencia (primer nivel):
## # A tibble: 3 × 5
## nivel OR OR_LI OR_LS p_glm
## <chr> <dbl> <dbl> <dbl> <dbl>
## 1 Insatisfecho 0.664 0.435 1.01 0.0555
## 2 Satisfecho 0.668 0.461 0.971 0.0339
## 3 Muy satisfecho 0.432 0.289 0.642 0.0000359
##
##
## ==== Variable: rendimiento_laboral ====
## f n rotacion
## 1 Muy alto 226 0.1637168
## 2 Alto 1244 0.1607717
## Chi-cuadrado p-value: 0.9901
## OR por nivel vs. referencia (primer nivel):
## # A tibble: 1 × 5
## nivel OR OR_LI OR_LS p_glm
## <chr> <dbl> <dbl> <dbl> <dbl>
## 1 Muy alto 1.02 0.688 1.48 0.912
##
##
## ==== Variable: equilibrio_trabajo_vida ====
## f n rotacion
## 1 Muy bajo 80 0.3125000
## 2 Alto 153 0.1764706
## 3 Bajo 344 0.1686047
## 4 Medio 893 0.1422172
## Chi-cuadrado p-value: 0.0009726
## OR por nivel vs. referencia (primer nivel):
## # A tibble: 3 × 5
## nivel OR OR_LI OR_LS p_glm
## <chr> <dbl> <dbl> <dbl> <dbl>
## 1 Bajo 0.446 0.259 0.782 0.00407
## 2 Medio 0.365 0.221 0.615 0.000102
## 3 Alto 0.471 0.251 0.887 0.0192