Code
::p_load(MASS,
pacman
gtsummary,
sjPlot,
report, tidyverse)
::p_load(MASS,
pacman
gtsummary,
sjPlot,
report, tidyverse)
<- read_csv("https://docs.google.com/spreadsheets/d/e/2PACX-1vR4umwO85oAba8DDyNqhPNE4NLcm0sV2XHEsqhDUpu89hKlI8ye2341KhfIwSQ3RZFHHnG2HQlU5jtP/pub?gid=1705853449&single=true&output=csv") datosCA
Rows: 4273 Columns: 74
── Column specification ────────────────────────────────────────────────────────
Delimiter: ","
chr (57): Municipio de levantamiento, A, B, C, D, E, F, G, H, I, J, K, M, Ñ,...
dbl (15): L, N, S, AC, AF, AJ, BA, BE, BF, BH, BJ, BL, BM, BN, BÑ
num (2): Latitude, Longitude
ℹ Use `spec()` to retrieve the full column specification for this data.
ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
# Convertir la variable Likert (BG) en un factor ordenado con los niveles correctos
# Pregunta: ¿Qué tan satisfecho/a está con la forma en la que el municipio destina
# los recursos públicos en su comunidad? Codificada como BG en la base de datos.
$BG <- factor(datosCA$BG,levels = c("Muy satisfecho/a", "Satisfecho/a",
datosCA"Insatisfecho/a", "Muy insatisfecho/a"),
ordered = TRUE)
# Ajustar el modelo de regresión ordinal utilizando polr()
<- polr(BG ~ BF + BL + BM + BN + B + C,
modelo_ordinal data = datosCA,
Hess = TRUE)
summary(modelo_ordinal)
Call:
polr(formula = BG ~ BF + BL + BM + BN + B + C, data = datosCA,
Hess = TRUE)
Coefficients:
Value Std. Error t value
BF -0.25393 0.01628 -15.5974
BL -0.14143 0.02168 -6.5234
BM -0.05292 0.02249 -2.3529
BN -0.07334 0.02055 -3.5694
BMasculino -0.01792 0.06286 -0.2850
C30 a 45 0.23752 0.07957 2.9849
C45 a 59 0.39999 0.08700 4.5974
C60 o mas -0.02165 0.09746 -0.2222
Intercepts:
Value Std. Error t value
Muy satisfecho/a|Satisfecho/a -6.2446 0.1517 -41.1582
Satisfecho/a|Insatisfecho/a -3.2090 0.1245 -25.7750
Insatisfecho/a|Muy insatisfecho/a -0.3387 0.1113 -3.0440
Residual Deviance: 7838.93
AIC: 7860.93
(291 observations deleted due to missingness)
# Descripción de las variables predictoras:
# BF = En una escala del 1 al 10, ¿Cuál es el nivel de confianza que tiene usted sobre el actual gobierno municipal?
# BL = ¿Cómo evaluaría a su municipio en los siguientes atributos? Capacidad técnica y resolución de problemas
# BM = ¿Cómo evaluaría a su municipio en los siguientes atributos? Imparcialidad (trabaja para todxs)
# BN = ¿Cómo evaluaría a su municipio en los siguientes atributos? Transparencia y difusión de información
# B: Género (Masculino/Femenino/Otro)
# C: Edad (Grupos de edad)
|>
modelo_ordinal ::tbl_regression(exponentiate = T) gtsummary
Characteristic | OR1 | 95% CI1 |
---|---|---|
BF | 0.78 | 0.75, 0.80 |
BL | 0.87 | 0.83, 0.91 |
BM | 0.95 | 0.91, 0.99 |
BN | 0.93 | 0.89, 0.97 |
B | ||
Femenino | — | — |
Masculino | 0.98 | 0.87, 1.11 |
C | ||
18 a 29 | — | — |
30 a 45 | 1.27 | 1.09, 1.48 |
45 a 59 | 1.49 | 1.26, 1.77 |
60 o mas | 0.98 | 0.81, 1.18 |
1 OR = Odds Ratio, CI = Confidence Interval |
# Visualize the model coefficients using sjPlot
plot_model(modelo_ordinal, type = "est", show.values = TRUE,
value.offset = 0.3, title = "Regression Coefficients")
The odds ratios (ORs) represent how a one-unit increase in each predictor variable changes the odds of moving to a higher satisfaction category (e.g., from “Insatisfecho/a” to “Satisfecho/a”). Let’s break down the results for each variable:
BF (Nivel de confianza en el gobierno municipal):
OR = 0.78 (95% CI: 0.75, 0.80)
For each one-unit increase in confidence in the municipal government, the odds of reporting a higher level of satisfaction decrease by 22%. This negative relationship suggests that people who have lower confidence in their government are more likely to report dissatisfaction.
BL (Evaluación de la capacidad técnica del municipio):
OR = 0.87 (95% CI: 0.83, 0.91)
A one-unit increase in the perception of technical capacity and problem-solving decreases the odds of being more satisfied by 13%. This result shows that better evaluations of technical capacity are associated with lower dissatisfaction.
BM (Evaluación de imparcialidad del municipio):
OR = 0.95 (95% CI: 0.91, 0.99)
A one-unit increase in perceived impartiality reduces the odds of being more satisfied by 5%. Although the effect is small, there is still a slightly negative relationship between perceived impartiality and satisfaction.
BN (Evaluación de la transparencia del municipio):
OR = 0.93 (95% CI: 0.89, 0.97)
A one-unit increase in the perception of transparency and information dissemination is associated with a 7% decrease in the odds of higher satisfaction. Transparency seems to have a mild but significant negative relationship with satisfaction.
B (Género - Masculino):
OR = 0.98 (95% CI: 0.87, 1.11)
Gender (being male) has no significant effect on the odds of reporting higher satisfaction compared to other gender groups. The OR is very close to 1, meaning that being male neither increases nor decreases the likelihood of higher satisfaction significantly.
C (Edad - Comparado con el grupo 18 a 29 años):
30 a 45 años: OR = 1.27 (95% CI: 1.09, 1.48)
45 a 59 años: OR = 1.49 (95% CI: 1.26, 1.77)
60 o más años: OR = 0.98 (95% CI: 0.81, 1.18)
The intercepts represent the thresholds between the satisfaction categories (“Muy satisfecho/a,” “Satisfecho/a,” “Insatisfecho/a,” and “Muy insatisfecho/a”). They help determine where the category boundaries are in terms of the linear predictor.
Residual Deviance and AIC:
Negative Relationships: Confidence in the municipal government (BF), technical capacity (BL), impartiality (BM), and transparency (BN) are negatively associated with higher satisfaction. Higher values in these predictors reduce the likelihood of reporting greater satisfaction.
Age: Older age groups (30-45, 45-59) are more likely to report higher satisfaction compared to younger respondents (18-29). However, respondents aged 60 and older show no significant difference in satisfaction compared to the youngest group.
Gender: Being male does not significantly impact satisfaction compared to other gender groups.