packages <- c("tidyverse", "Lock5Data", "modelsummary", "effects", "survey", "ggplot2", "interactions", "kableExtra", "flextable", "dplyr", "sjPlot", "marginaleffects", "emmeans", "ggrepel")
new_packages <- packages[!(packages %in% installed.packages()[,"Package"])]
if(length(new_packages)) install.packages(new_packages)
lapply(packages, library, character.only = TRUE)
## ── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
## ✔ dplyr 1.1.4 ✔ readr 2.1.5
## ✔ forcats 1.0.0 ✔ stringr 1.5.1
## ✔ ggplot2 3.5.1 ✔ tibble 3.2.1
## ✔ lubridate 1.9.3 ✔ tidyr 1.3.1
## ✔ purrr 1.0.2
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## ✖ dplyr::filter() masks stats::filter()
## ✖ dplyr::lag() masks stats::lag()
## ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
## `modelsummary` 2.0.0 now uses `tinytable` as its default table-drawing
## backend. Learn more at: https://vincentarelbundock.github.io/tinytable/
##
## Revert to `kableExtra` for one session:
##
## options(modelsummary_factory_default = 'kableExtra')
## options(modelsummary_factory_latex = 'kableExtra')
## options(modelsummary_factory_html = 'kableExtra')
##
## Silence this message forever:
##
## config_modelsummary(startup_message = FALSE)
##
## Loading required package: carData
##
## lattice theme set by effectsTheme()
## See ?effectsTheme for details.
##
## Loading required package: grid
##
## Loading required package: Matrix
##
##
## Attaching package: 'Matrix'
##
##
## The following objects are masked from 'package:tidyr':
##
## expand, pack, unpack
##
##
## Loading required package: survival
##
##
## Attaching package: 'survey'
##
##
## The following object is masked from 'package:graphics':
##
## dotchart
##
##
##
## Attaching package: 'kableExtra'
##
##
## The following object is masked from 'package:dplyr':
##
## group_rows
##
##
##
## Attaching package: 'flextable'
##
##
## The following objects are masked from 'package:kableExtra':
##
## as_image, footnote
##
##
## The following object is masked from 'package:purrr':
##
## compose
##
##
## Welcome to emmeans.
## Caution: You lose important information if you filter this package's results.
## See '? untidy'
## [[1]]
## [1] "lubridate" "forcats" "stringr" "dplyr" "purrr" "readr"
## [7] "tidyr" "tibble" "ggplot2" "tidyverse" "stats" "graphics"
## [13] "grDevices" "utils" "datasets" "methods" "base"
##
## [[2]]
## [1] "Lock5Data" "lubridate" "forcats" "stringr" "dplyr" "purrr"
## [7] "readr" "tidyr" "tibble" "ggplot2" "tidyverse" "stats"
## [13] "graphics" "grDevices" "utils" "datasets" "methods" "base"
##
## [[3]]
## [1] "modelsummary" "Lock5Data" "lubridate" "forcats" "stringr"
## [6] "dplyr" "purrr" "readr" "tidyr" "tibble"
## [11] "ggplot2" "tidyverse" "stats" "graphics" "grDevices"
## [16] "utils" "datasets" "methods" "base"
##
## [[4]]
## [1] "effects" "carData" "modelsummary" "Lock5Data" "lubridate"
## [6] "forcats" "stringr" "dplyr" "purrr" "readr"
## [11] "tidyr" "tibble" "ggplot2" "tidyverse" "stats"
## [16] "graphics" "grDevices" "utils" "datasets" "methods"
## [21] "base"
##
## [[5]]
## [1] "survey" "survival" "Matrix" "grid" "effects"
## [6] "carData" "modelsummary" "Lock5Data" "lubridate" "forcats"
## [11] "stringr" "dplyr" "purrr" "readr" "tidyr"
## [16] "tibble" "ggplot2" "tidyverse" "stats" "graphics"
## [21] "grDevices" "utils" "datasets" "methods" "base"
##
## [[6]]
## [1] "survey" "survival" "Matrix" "grid" "effects"
## [6] "carData" "modelsummary" "Lock5Data" "lubridate" "forcats"
## [11] "stringr" "dplyr" "purrr" "readr" "tidyr"
## [16] "tibble" "ggplot2" "tidyverse" "stats" "graphics"
## [21] "grDevices" "utils" "datasets" "methods" "base"
##
## [[7]]
## [1] "interactions" "survey" "survival" "Matrix" "grid"
## [6] "effects" "carData" "modelsummary" "Lock5Data" "lubridate"
## [11] "forcats" "stringr" "dplyr" "purrr" "readr"
## [16] "tidyr" "tibble" "ggplot2" "tidyverse" "stats"
## [21] "graphics" "grDevices" "utils" "datasets" "methods"
## [26] "base"
##
## [[8]]
## [1] "kableExtra" "interactions" "survey" "survival" "Matrix"
## [6] "grid" "effects" "carData" "modelsummary" "Lock5Data"
## [11] "lubridate" "forcats" "stringr" "dplyr" "purrr"
## [16] "readr" "tidyr" "tibble" "ggplot2" "tidyverse"
## [21] "stats" "graphics" "grDevices" "utils" "datasets"
## [26] "methods" "base"
##
## [[9]]
## [1] "flextable" "kableExtra" "interactions" "survey" "survival"
## [6] "Matrix" "grid" "effects" "carData" "modelsummary"
## [11] "Lock5Data" "lubridate" "forcats" "stringr" "dplyr"
## [16] "purrr" "readr" "tidyr" "tibble" "ggplot2"
## [21] "tidyverse" "stats" "graphics" "grDevices" "utils"
## [26] "datasets" "methods" "base"
##
## [[10]]
## [1] "flextable" "kableExtra" "interactions" "survey" "survival"
## [6] "Matrix" "grid" "effects" "carData" "modelsummary"
## [11] "Lock5Data" "lubridate" "forcats" "stringr" "dplyr"
## [16] "purrr" "readr" "tidyr" "tibble" "ggplot2"
## [21] "tidyverse" "stats" "graphics" "grDevices" "utils"
## [26] "datasets" "methods" "base"
##
## [[11]]
## [1] "sjPlot" "flextable" "kableExtra" "interactions" "survey"
## [6] "survival" "Matrix" "grid" "effects" "carData"
## [11] "modelsummary" "Lock5Data" "lubridate" "forcats" "stringr"
## [16] "dplyr" "purrr" "readr" "tidyr" "tibble"
## [21] "ggplot2" "tidyverse" "stats" "graphics" "grDevices"
## [26] "utils" "datasets" "methods" "base"
##
## [[12]]
## [1] "marginaleffects" "sjPlot" "flextable" "kableExtra"
## [5] "interactions" "survey" "survival" "Matrix"
## [9] "grid" "effects" "carData" "modelsummary"
## [13] "Lock5Data" "lubridate" "forcats" "stringr"
## [17] "dplyr" "purrr" "readr" "tidyr"
## [21] "tibble" "ggplot2" "tidyverse" "stats"
## [25] "graphics" "grDevices" "utils" "datasets"
## [29] "methods" "base"
##
## [[13]]
## [1] "emmeans" "marginaleffects" "sjPlot" "flextable"
## [5] "kableExtra" "interactions" "survey" "survival"
## [9] "Matrix" "grid" "effects" "carData"
## [13] "modelsummary" "Lock5Data" "lubridate" "forcats"
## [17] "stringr" "dplyr" "purrr" "readr"
## [21] "tidyr" "tibble" "ggplot2" "tidyverse"
## [25] "stats" "graphics" "grDevices" "utils"
## [29] "datasets" "methods" "base"
##
## [[14]]
## [1] "ggrepel" "emmeans" "marginaleffects" "sjPlot"
## [5] "flextable" "kableExtra" "interactions" "survey"
## [9] "survival" "Matrix" "grid" "effects"
## [13] "carData" "modelsummary" "Lock5Data" "lubridate"
## [17] "forcats" "stringr" "dplyr" "purrr"
## [21] "readr" "tidyr" "tibble" "ggplot2"
## [25] "tidyverse" "stats" "graphics" "grDevices"
## [29] "utils" "datasets" "methods" "base"
load("/Users/Gurleen/Desktop/Civil.Rdata")
Civil <- corruption
head(Civil)
## country_name country_text_id year region
## 1 Mexico MEX 2020 Latin America and the Caribbean
## 2 Suriname SUR 2020 Latin America and the Caribbean
## 3 Sweden SWE 2020 Western Europe and North America
## 4 Switzerland CHE 2020 Western Europe and North America
## 5 Ghana GHA 2020 Sub-Saharan Africa
## 6 South Africa ZAF 2020 Sub-Saharan Africa
## disclose_donations_ord public_sector_corruption polyarchy civil_liberties
## 1 3 48.8 64.7 71.2
## 2 1 24.8 76.1 87.7
## 3 2 1.3 90.8 96.9
## 4 0 1.4 89.4 94.8
## 5 2 65.2 72.0 90.4
## 6 1 57.1 70.3 82.2
## disclose_donations iso2c population gdp_percapita capital longitude
## 1 TRUE MX 128932753 8922.612 Mexico City -99.1276
## 2 FALSE SR 586634 7529.614 Paramaribo -55.1679
## 3 FALSE SE 10353442 51541.656 Stockholm 18.0645
## 4 FALSE CH 8636561 85685.290 Bern 7.44821
## 5 FALSE GH 31072945 2020.624 Accra -0.20795
## 6 FALSE ZA 59308690 5659.207 Pretoria 28.1871
## latitude income log_gdp_percapita
## 1 19.427 Upper middle income 9.096344
## 2 5.8232 Upper middle income 8.926599
## 3 59.3327 High income 10.850146
## 4 46.948 High income 11.358436
## 5 5.57045 Lower middle income 7.611162
## 6 -25.746 Upper middle income 8.641039
model <- lm(public_sector_corruption ~ polyarchy, data = Civil)
ggplot(Civil, aes(x = polyarchy, y = public_sector_corruption)) +
geom_point() +
geom_smooth(method = "lm", col = "blue") +
labs(title = "Scatter Plot with Regression Line",
x = "Polyarchy",
y = "Public Sector Corruption") +
theme_minimal()
## `geom_smooth()` using formula = 'y ~ x'
tab_model(model, show.ci = FALSE, show.se = TRUE, show.stat = TRUE)
| Â | public_sector_corruption | |||
|---|---|---|---|---|
| Predictors | Estimates | std. Error | Statistic | p |
| (Intercept) | 89.44 | 3.95 | 22.62 | <0.001 |
| polyarchy | -0.83 | 0.07 | -12.18 | <0.001 |
| Observations | 168 | |||
| R2 / R2 adjusted | 0.472 / 0.469 | |||
summary(model)
##
## Call:
## lm(formula = public_sector_corruption ~ polyarchy, data = Civil)
##
## Residuals:
## Min 1Q Median 3Q Max
## -69.498 -14.334 1.448 16.985 44.436
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 89.44444 3.95373 22.62 <2e-16 ***
## polyarchy -0.82641 0.06786 -12.18 <2e-16 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 21.68 on 166 degrees of freedom
## Multiple R-squared: 0.4718, Adjusted R-squared: 0.4686
## F-statistic: 148.3 on 1 and 166 DF, p-value: < 2.2e-16
The regression analysis reveals a significant inverse relationship between polyarchy and public sector corruption. The intercept value of 89.44 suggests that when polyarchy is zero, the predicted level of public sector corruption is 89.44, although it’s important to consider whether a zero value for polyarchy is meaningful in this context. The coefficient for polyarchy is -0.83, indicating that for each one-unit increase in polyarchy, public sector corruption decreases by 0.83 units. This negative coefficient highlights that higher levels of polyarchy are associated with lower levels of public sector corruption.
Both the intercept and polyarchy coefficients are statistically significant, with t-statistics of 22.62 and -12.18, respectively, and p-values less than 0.001. This significance indicates that both the intercept and the relationship between polyarchy and public sector corruption are reliably different from zero.
The model’s R-squared value is 0.472, meaning that approximately 47.2% of the variance in public sector corruption can be explained by polyarchy. The adjusted R-squared value of 0.469, which accounts for the number of predictors in the model, confirms this moderately strong relationship. Overall, the findings suggest that polyarchy is a substantial predictor of public sector corruption, with higher levels of polyarchy leading to lower levels of corruption.
model_sq <- lm(public_sector_corruption ~ polyarchy + I(polyarchy^2), data = Civil)
summary(model_sq)
##
## Call:
## lm(formula = public_sector_corruption ~ polyarchy + I(polyarchy^2),
## data = Civil)
##
## Residuals:
## Min 1Q Median 3Q Max
## -64.462 -7.475 1.418 14.107 35.187
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 53.116104 7.019792 7.567 2.55e-12 ***
## polyarchy 0.974653 0.305335 3.192 0.00169 **
## I(polyarchy^2) -0.017310 0.002874 -6.023 1.08e-08 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 19.69 on 165 degrees of freedom
## Multiple R-squared: 0.567, Adjusted R-squared: 0.5618
## F-statistic: 108 on 2 and 165 DF, p-value: < 2.2e-16
ggplot(Civil, aes(x = polyarchy, y = public_sector_corruption)) +
geom_point() +
geom_smooth(method = "lm", formula = y ~ poly(x, 2), col = "blue") +
labs(title = "Polynomial Relationship between Polyarchy and Public Sector Corruption",
x = "Polyarchy",
y = "Public Sector Corruption") +
theme_minimal()
polyarchy1 <- coef(model_sq)["polyarchy"]
polyarchy2 <- coef(model_sq)["I(polyarchy^2)"]
polyarchy_slope <- function(x) polyarchy1 + (2 * polyarchy2 * x)
marginal_effects_manual <- polyarchy_slope(c(30, 60, 90))
marginal_effects_manual
## [1] -0.06392759 -1.10250800 -2.14108840
model_sq %>%
slopes(newdata = datagrid(polyarchy = c(30, 60, 90)), eps = 0.001)
##
## Term polyarchy Estimate Std. Error z Pr(>|z|) S 2.5 % 97.5 %
## polyarchy 30 -0.0639 0.1404 -0.455 0.649 0.6 -0.339 0.211
## polyarchy 60 -1.1025 0.0767 -14.375 <0.001 153.2 -1.253 -0.952
## polyarchy 90 -2.1411 0.2268 -9.439 <0.001 67.9 -2.586 -1.697
##
## Columns: rowid, term, estimate, std.error, statistic, p.value, s.value, conf.low, conf.high, polyarchy, predicted_lo, predicted_hi, predicted, public_sector_corruption
## Type: response
At a polyarchy value of 30, the marginal effect is -0.064. This means that around this level of polyarchy, a small increase in polyarchy is associated with only a slight decrease in public sector corruption.
At a polyarchy value of 60, the marginal effect is -1.103, indicating that an increase in polyarchy at this level leads to a more substantial reduction in public sector corruption.
At a polyarchy value of 90, the marginal effect is -2.141, which shows a stronger negative relationship at higher levels of polyarchy, meaning that increases in polyarchy significantly reduce public sector corruption.
model2 <- glm(disclose_donations ~ public_sector_corruption + log_gdp_percapita,
data = Civil,
family = binomial(link = "logit"))
summary(model2)
##
## Call:
## glm(formula = disclose_donations ~ public_sector_corruption +
## log_gdp_percapita, family = binomial(link = "logit"), data = Civil)
##
## Coefficients:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) -0.50466 2.18953 -0.230 0.818
## public_sector_corruption -0.05964 0.01191 -5.007 5.54e-07 ***
## log_gdp_percapita 0.24907 0.21785 1.143 0.253
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for binomial family taken to be 1)
##
## Null deviance: 217.79 on 167 degrees of freedom
## Residual deviance: 131.30 on 165 degrees of freedom
## AIC: 137.3
##
## Number of Fisher Scoring iterations: 5
tab_model(model2, show.ci = TRUE, show.se = TRUE, show.stat = TRUE,
show.p = TRUE, show.aic = TRUE)
| Â | disclose_donations | ||||
|---|---|---|---|---|---|
| Predictors | Odds Ratios | std. Error | CI | Statistic | p |
| (Intercept) | 0.60 | 1.32 | 0.00 – Inf | -0.23 | 0.818 |
| public_sector_corruption | 0.94 | 0.01 | 0.00 – Inf | -5.01 | <0.001 |
|
GDP per capita (constant 2015 US$) |
1.28 | 0.28 | 0.00 – Inf | 1.14 | 0.253 |
| Observations | 168 | ||||
| R2 Tjur | 0.454 | ||||
| AIC | 137.297 | ||||
The logistic regression analysis results for the presence of campaign finance disclosure laws (disclose_donations) in relation to public sector corruption and GDP per capita are insightful. The odds ratio for the intercept is 0.60, with a standard error of 1.32, and a p-value of 0.818. This indicates that the base odds of having campaign finance disclosure laws, when all predictors are at zero, are not statistically significant and essentially indistinguishable from random chance.
For public sector corruption, the odds ratio is 0.94, with a standard error of 0.01 and a p-value of less than 0.001. This result is statistically significant and suggests a strong negative relationship between public sector corruption and the presence of campaign finance disclosure laws. Specifically, for each unit increase in public sector corruption, the odds of having such laws decrease by 6% (1 - 0.94).
On the other hand, the GDP per capita (constant 2015 US$) has an odds ratio of 1.28 with a standard error of 0.28 and a p-value of 0.253. Although this indicates that higher GDP per capita is associated with increased odds of having campaign finance disclosure laws (by 28%), the relationship is not statistically significant, implying that the effect could be due to random chance.
The analysis reveals a significant negative impact of public sector corruption on the likelihood of having campaign finance disclosure laws, while the association with GDP per capita is not statistically significant. The model explains a substantial portion of the variability in the presence of these laws, providing valuable insights into the factors influencing campaign finance disclosure policies.
intercept <- coef(model2)["(Intercept)"]
psc_coef <- coef(model2)["public_sector_corruption"]
gdp_coef <- coef(model2)["log_gdp_percapita"]
psc_slope <- function(x, gdp) {
exp(intercept + psc_coef * x + gdp_coef * gdp) /
(1 + exp(intercept + psc_coef * x + gdp_coef * gdp)) * (1 - exp(intercept + psc_coef * x + gdp_coef * gdp) /
(1 + exp(intercept + psc_coef * x + gdp_coef * gdp))) * psc_coef
}
psc_slope(20, mean(Civil$log_gdp_percapita))
## (Intercept)
## -0.01422113
psc_slope(50, mean(Civil$log_gdp_percapita))
## (Intercept)
## -0.009734756
psc_slope(80, mean(Civil$log_gdp_percapita))
## (Intercept)
## -0.002367714
marginal_effects <- model2 %>%
slopes(newdata = datagrid(public_sector_corruption = c(20, 50, 80)), eps = 0.001)
marginal_effects
##
## Term public_sector_corruption Estimate Std. Error z
## log_gdp_percapita 20 0.05939 0.053999 1.100
## log_gdp_percapita 50 0.04066 0.037099 1.096
## log_gdp_percapita 80 0.00989 0.011752 0.841
## public_sector_corruption 20 -0.01422 0.002330 -6.103
## public_sector_corruption 50 -0.00973 0.001635 -5.956
## public_sector_corruption 80 -0.00237 0.000819 -2.890
## Pr(>|z|) S 2.5 % 97.5 %
## 0.27137 1.9 -0.04644 0.165229
## 0.27312 1.9 -0.03206 0.113369
## 0.40009 1.3 -0.01314 0.032921
## < 0.001 29.8 -0.01879 -0.009654
## < 0.001 28.5 -0.01294 -0.006531
## 0.00385 8.0 -0.00397 -0.000762
##
## Columns: rowid, term, estimate, std.error, statistic, p.value, s.value, conf.low, conf.high, public_sector_corruption, predicted_lo, predicted_hi, predicted, log_gdp_percapita, disclose_donations
## Type: response
em_trends <- model2 %>%
emtrends(~ public_sector_corruption, var = "public_sector_corruption", at = list(public_sector_corruption = c(20, 50, 80)), delta.var = 0.001) %>%
test()
em_trends
## public_sector_corruption public_sector_corruption.trend SE df z.ratio
## 20 -0.0596 0.0119 Inf -5.007
## 50 -0.0596 0.0119 Inf -5.007
## 80 -0.0596 0.0119 Inf -5.007
## p.value
## <.0001
## <.0001
## <.0001
psc_values <- data.frame(
public_sector_corruption = seq(min(Civil$public_sector_corruption), max(Civil$public_sector_corruption), by = 1),
log_gdp_percapita = mean(Civil$log_gdp_percapita, na.rm = TRUE) # Include log_gdp_percapita
)
psc_values$predicted_prob <- predict(model2, newdata = psc_values, type = "response")
ggplot(psc_values, aes(x = public_sector_corruption, y = predicted_prob)) +
geom_line(color = "blue") +
labs(title = "Predicted Probabilities of Having Campaign Finance Disclosure Laws",
x = "Public Sector Corruption",
y = "Predicted Probability") +
theme_minimal()
Civil$region <- as.factor(Civil$region)
model_interaction <- glm(disclose_donations ~ public_sector_corruption * region + log_gdp_percapita,
data = Civil,
family = binomial(link = "logit"))
summary(model_interaction)
##
## Call:
## glm(formula = disclose_donations ~ public_sector_corruption *
## region + log_gdp_percapita, family = binomial(link = "logit"),
## data = Civil)
##
## Coefficients:
## Estimate
## (Intercept) 3.21658
## public_sector_corruption -0.06335
## regionLatin America and the Caribbean -2.47593
## regionMiddle East and North Africa -0.65585
## regionSub-Saharan Africa -1.61845
## regionWestern Europe and North America -1.05205
## regionAsia and Pacific -0.92044
## log_gdp_percapita 0.01539
## public_sector_corruption:regionLatin America and the Caribbean 0.02499
## public_sector_corruption:regionMiddle East and North Africa -0.05436
## public_sector_corruption:regionSub-Saharan Africa -0.02279
## public_sector_corruption:regionWestern Europe and North America -0.03829
## public_sector_corruption:regionAsia and Pacific -0.03145
## Std. Error
## (Intercept) 3.52849
## public_sector_corruption 0.02299
## regionLatin America and the Caribbean 1.53294
## regionMiddle East and North Africa 2.36552
## regionSub-Saharan Africa 1.79649
## regionWestern Europe and North America 1.57290
## regionAsia and Pacific 1.85141
## log_gdp_percapita 0.34500
## public_sector_corruption:regionLatin America and the Caribbean 0.03045
## public_sector_corruption:regionMiddle East and North Africa 0.06720
## public_sector_corruption:regionSub-Saharan Africa 0.03978
## public_sector_corruption:regionWestern Europe and North America 0.07872
## public_sector_corruption:regionAsia and Pacific 0.04645
## z value
## (Intercept) 0.912
## public_sector_corruption -2.755
## regionLatin America and the Caribbean -1.615
## regionMiddle East and North Africa -0.277
## regionSub-Saharan Africa -0.901
## regionWestern Europe and North America -0.669
## regionAsia and Pacific -0.497
## log_gdp_percapita 0.045
## public_sector_corruption:regionLatin America and the Caribbean 0.821
## public_sector_corruption:regionMiddle East and North Africa -0.809
## public_sector_corruption:regionSub-Saharan Africa -0.573
## public_sector_corruption:regionWestern Europe and North America -0.486
## public_sector_corruption:regionAsia and Pacific -0.677
## Pr(>|z|)
## (Intercept) 0.36198
## public_sector_corruption 0.00586 **
## regionLatin America and the Caribbean 0.10628
## regionMiddle East and North Africa 0.78158
## regionSub-Saharan Africa 0.36764
## regionWestern Europe and North America 0.50358
## regionAsia and Pacific 0.61908
## log_gdp_percapita 0.96442
## public_sector_corruption:regionLatin America and the Caribbean 0.41188
## public_sector_corruption:regionMiddle East and North Africa 0.41851
## public_sector_corruption:regionSub-Saharan Africa 0.56671
## public_sector_corruption:regionWestern Europe and North America 0.62666
## public_sector_corruption:regionAsia and Pacific 0.49833
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for binomial family taken to be 1)
##
## Null deviance: 217.79 on 167 degrees of freedom
## Residual deviance: 114.37 on 155 degrees of freedom
## AIC: 140.37
##
## Number of Fisher Scoring iterations: 7
new_data <- datagrid(model = model_interaction,
public_sector_corruption = seq(min(Civil$public_sector_corruption),
max(Civil$public_sector_corruption),
by = 10),
region = levels(Civil$region))
new_data$predicted_prob <- predict(model_interaction, newdata = new_data, type = "response")
ggplot(new_data, aes(x = public_sector_corruption, y = predicted_prob, color = region)) +
geom_line() +
labs(title = "Interaction Effect of Public Sector Corruption and Region on Predicted Probabilities of Having Campaign Finance Disclosure Laws",
x = "Public Sector Corruption",
y = "Predicted Probability",
color = "Region") +
theme_minimal()
summary(model_interaction)
##
## Call:
## glm(formula = disclose_donations ~ public_sector_corruption *
## region + log_gdp_percapita, family = binomial(link = "logit"),
## data = Civil)
##
## Coefficients:
## Estimate
## (Intercept) 3.21658
## public_sector_corruption -0.06335
## regionLatin America and the Caribbean -2.47593
## regionMiddle East and North Africa -0.65585
## regionSub-Saharan Africa -1.61845
## regionWestern Europe and North America -1.05205
## regionAsia and Pacific -0.92044
## log_gdp_percapita 0.01539
## public_sector_corruption:regionLatin America and the Caribbean 0.02499
## public_sector_corruption:regionMiddle East and North Africa -0.05436
## public_sector_corruption:regionSub-Saharan Africa -0.02279
## public_sector_corruption:regionWestern Europe and North America -0.03829
## public_sector_corruption:regionAsia and Pacific -0.03145
## Std. Error
## (Intercept) 3.52849
## public_sector_corruption 0.02299
## regionLatin America and the Caribbean 1.53294
## regionMiddle East and North Africa 2.36552
## regionSub-Saharan Africa 1.79649
## regionWestern Europe and North America 1.57290
## regionAsia and Pacific 1.85141
## log_gdp_percapita 0.34500
## public_sector_corruption:regionLatin America and the Caribbean 0.03045
## public_sector_corruption:regionMiddle East and North Africa 0.06720
## public_sector_corruption:regionSub-Saharan Africa 0.03978
## public_sector_corruption:regionWestern Europe and North America 0.07872
## public_sector_corruption:regionAsia and Pacific 0.04645
## z value
## (Intercept) 0.912
## public_sector_corruption -2.755
## regionLatin America and the Caribbean -1.615
## regionMiddle East and North Africa -0.277
## regionSub-Saharan Africa -0.901
## regionWestern Europe and North America -0.669
## regionAsia and Pacific -0.497
## log_gdp_percapita 0.045
## public_sector_corruption:regionLatin America and the Caribbean 0.821
## public_sector_corruption:regionMiddle East and North Africa -0.809
## public_sector_corruption:regionSub-Saharan Africa -0.573
## public_sector_corruption:regionWestern Europe and North America -0.486
## public_sector_corruption:regionAsia and Pacific -0.677
## Pr(>|z|)
## (Intercept) 0.36198
## public_sector_corruption 0.00586 **
## regionLatin America and the Caribbean 0.10628
## regionMiddle East and North Africa 0.78158
## regionSub-Saharan Africa 0.36764
## regionWestern Europe and North America 0.50358
## regionAsia and Pacific 0.61908
## log_gdp_percapita 0.96442
## public_sector_corruption:regionLatin America and the Caribbean 0.41188
## public_sector_corruption:regionMiddle East and North Africa 0.41851
## public_sector_corruption:regionSub-Saharan Africa 0.56671
## public_sector_corruption:regionWestern Europe and North America 0.62666
## public_sector_corruption:regionAsia and Pacific 0.49833
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for binomial family taken to be 1)
##
## Null deviance: 217.79 on 167 degrees of freedom
## Residual deviance: 114.37 on 155 degrees of freedom
## AIC: 140.37
##
## Number of Fisher Scoring iterations: 7
The logistic regression model, incorporating an interaction term between public_sector_corruption and region along with log_gdp_percapita, provides the following insights:
The intercept of 3.21658 represents the log-odds of having campaign finance disclosure laws when public_sector_corruption is zero, and all regions and log_gdp_percapita are at their reference levels. The coefficient for public sector corruption is -0.06335 (p = 0.00586), indicating a statistically significant negative relationship: as corruption increases, the likelihood of having disclosure laws decreases.
Regional coefficients show how the effect of corruption varies by region compared to the reference region. For instance, Latin America and the Caribbean has a coefficient of -2.47593, suggesting a significantly lower likelihood of having disclosure laws compared to the reference region. Middle East and North Africa and Sub-Saharan Africa also show negative effects, with the latter being more pronounced. Western Europe and North America and Asia and Pacific have negative effects with varying levels of significance.
The interaction terms for regions, such as Latin America and the Caribbean (0.02499, p = 0.41188), indicate that while the effect of corruption on disclosure laws is slightly moderated in this region, the interaction is not statistically significant. Similar non-significant moderation effects are observed in other regions.
Log GDP per Capita (0.01539, p = 0.96442) does not significantly impact the likelihood of having disclosure laws in this model.
Model fit statistics show a reduction from null deviance (217.79) to residual deviance (114.37), indicating that the model improves upon the baseline model. The AIC of 140.37 suggests the model’s relative quality, with lower values indicating better fit. However, comparing AIC values across models would provide a more comprehensive assessment.
Additionally, The interaction term will reveal whether the effect of public sector corruption on the likelihood of having campaign finance disclosure laws varies significantly across regions. If the interaction term is significant, it suggests that the impact of corruption on the likelihood of enacting these laws is not uniform across different regions. Understanding these regional differences can inform policymakers about the contexts in which anti-corruption measures and transparency initiatives are more or less likely to be adopted. For example, if certain regions show a stronger negative relationship between corruption and the likelihood of having disclosure laws, targeted interventions may be necessary. Regions with weaker relationships might require different strategies to combat corruption or to encourage the adoption of transparency laws. Policymakers could use this information to allocate resources and design interventions that are tailored to the specific needs and conditions of each region. The findings can prompt further investigation into why these regional differences exist. Factors such as political culture, historical context, and economic conditions might play a role and could be explored in future studies.