For the scope of the discussion, I have removed the observations that NA values. There are about eleven rows with NA values.
#Variables and Description
miltcoup - number of successful military coups from independence to 1989
oligarchy - number years country ruled by military oligarchy from independence to 1989
pollib - Political liberalization - 0 = no civil rights for political expression, 1 = limited civil rights for expression but right to form political parties, 2 = full civil rights
parties - Number of legal political parties in 1993
pctvote - Percent voting in last election
popn - Population in millions in 1989
size - Area in 1000 square km
numelec - Total number of legislative and presidential elections
numregim - Number of regime types
library(dplyr)
library(knitr)
library(kableExtra)
library(faraway)
library(fBasics)
library(ggplot2)
Africa.df <- data.frame(africa)
Africa.C.df <- Africa.df[complete.cases(Africa.df), ]
Africa.C.df <- within(Africa.C.df, {pollib <- factor(pollib, levels = 0:2, labels = c("No Civil Rights","Limited Civil Rights","Full Civil Rights"))})
Africa.S.df <- Africa.C.df %>% select(miltcoup, oligarchy, parties, pctvote, popn, size, numelec, numregim)
tmp <-basicStats(Africa.S.df)
tmp <- data.frame(t(tmp))
tmp <- tmp[ , -which(names(tmp) %in% c("SE.Mean","LCL.Mean","UCL.Mean"))]
colnames(tmp)[which(names(tmp) == "X1..Quartile")] <- "1st. Quartile"
colnames(tmp)[which(names(tmp) == "X3..Quartile")] <- "3st. Quartile"
colnames(tmp)[which(names(tmp) == "nobs")] <- "Observations"
tmp %>%
kable(format="html", digits= 2, caption = "Sub-Saharan Africa - Miltary Coups And Politics Summary") %>%
kable_styling(bootstrap_options = c("striped", "hover", "condensed", "respons
ive"), full_width = F, position = "left")
| Observations | NAs | Minimum | Maximum | 1st. Quartile | 3st. Quartile | Mean | Median | Sum | Variance | Stdev | Skewness | Kurtosis | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| miltcoup | 36 | 0 | 0.00 | 6.0 | 0.00 | 2.00 | 1.58 | 1.00 | 57.00 | 3.11 | 1.76 | 1.30 | 0.58 |
| oligarchy | 36 | 0 | 0.00 | 18.0 | 0.00 | 10.00 | 5.22 | 2.00 | 188.00 | 36.18 | 6.01 | 0.68 | -1.05 |
| parties | 36 | 0 | 2.00 | 62.0 | 10.00 | 19.50 | 17.08 | 14.00 | 615.00 | 138.99 | 11.79 | 1.68 | 3.71 |
| pctvote | 36 | 0 | 0.00 | 77.4 | 18.55 | 43.32 | 32.11 | 29.62 | 1156.01 | 321.53 | 17.93 | 0.60 | -0.11 |
| popn | 36 | 0 | 0.07 | 113.8 | 1.70 | 11.38 | 11.57 | 5.55 | 416.62 | 420.29 | 20.50 | 3.62 | 14.58 |
| size | 36 | 0 | 0.50 | 2506.0 | 34.50 | 770.75 | 484.60 | 271.00 | 17445.50 | 309546.53 | 556.37 | 1.51 | 2.54 |
| numelec | 36 | 0 | 0.00 | 14.0 | 4.00 | 10.00 | 6.72 | 6.00 | 242.00 | 13.41 | 3.66 | 0.07 | -0.97 |
| numregim | 36 | 0 | 1.00 | 4.0 | 2.00 | 3.25 | 2.75 | 3.00 | 99.00 | 0.94 | 0.97 | -0.24 | -1.01 |
table(Africa.C.df$pollib)
##
## No Civil Rights Limited Civil Rights Full Civil Rights
## 2 9 25
Distribution of military coups(miltcoup) and Political liberalization(pollib).
ggplot(Africa.C.df, aes(miltcoup, fill = pollib)) +
geom_histogram(binwidth=.5, position="dodge") +
labs(title = sprintf("Military Coups Vs. Political Liberalization")) + xlab("Number Of Successful Military Coups") +
ylab("Count") + guides(fill=guide_legend(title="Political Liberalization"))
The plot shows the count of successful military coups is lower when countries have Full Civil Rights. In other words, the number of successful military coups increase when a country has No Civil Rights. It also tells, variable pollib could be a useful predictor in the model.
To solve the problem, I will be using Poisson regression method. Response variable of this model is count. Poisson regression is also known as log-linear model or count regression. The main assumption of Poisson regression is mean and variance is same.
Poisson regression, \[log(\mu) = \alpha + \beta X\]
\[\mu = e^{(\alpha + \beta X)}\] \[\mu = e^{\alpha}\times e^{\beta X}\]
Where \(\mu\) is expected value\((E(Y))\) or counts.
When \(\beta = 0, e^{\beta X} = 1\), resulting in expecting count\((E(Y) = \mu)\), meaning predictor variable \(X\) has no impact on response variable \(Y\).
\(\beta > 1\), expecting count\((E(Y))\), is \(e^{\beta}\) times larger compared to when \(\beta = 0\).
\(\beta < 1\), expecting count\((E(Y))\), is \(e^{\beta}\) times smaller compared to when \(\beta = 0\).
Coefficients have a multiplicative effect on response variable \(Y\).
As model contains all the variables, it is known as a full model.
Africa.glm <- glm(miltcoup~., family = poisson, data = Africa.C.df)
summary(Africa.glm)
##
## Call:
## glm(formula = miltcoup ~ ., family = poisson, data = Africa.C.df)
##
## Deviance Residuals:
## Min 1Q Median 3Q Max
## -1.5075 -0.9533 -0.3100 0.4859 1.6459
##
## Coefficients:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) -0.2334274 0.9976112 -0.234 0.81500
## oligarchy 0.0725658 0.0353457 2.053 0.04007 *
## pollibLimited Civil Rights -1.1032439 0.6558114 -1.682 0.09252 .
## pollibFull Civil Rights -1.6903057 0.6766503 -2.498 0.01249 *
## parties 0.0312212 0.0111663 2.796 0.00517 **
## pctvote 0.0154413 0.0101027 1.528 0.12641
## popn 0.0109586 0.0071490 1.533 0.12531
## size -0.0002651 0.0002690 -0.985 0.32444
## numelec -0.0296185 0.0696248 -0.425 0.67054
## numregim 0.2109432 0.2339330 0.902 0.36720
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for poisson family taken to be 1)
##
## Null deviance: 65.945 on 35 degrees of freedom
## Residual deviance: 28.249 on 26 degrees of freedom
## AIC: 113.06
##
## Number of Fisher Scoring iterations: 5
As oligarchy increases by one unit, miltcoup, number of successful military coups will increase by \(e^{-0.2334274} \times e^{0.0725658} = 0.85141 = 1\) (rounded to zero), when all other variables held constant.
As parties increases by one unit, miltcoup, number of successful military coups will increase by \(e^{-0.2334274} \times e^{0.0312212} = 0.8169266 = 1\) (rounded to zero), when all other variables held constant.
As pctvote increases by one unit, miltcoup, number of successful military coups will increase by \(e^{-0.2334274} \times e^{0.0154413} = 0.8041367 = 1\) (rounded to zero), when all other variables held constant.
As popn increases by one unit, miltcoup, number of successful military coups will increase by \(e^{-0.2334274} \times e^{0.0109586} = 0.8005401 = 1\) (rounded to zero), when all other variables held constant.
As size increases by one unit, miltcoup, number of successful military coups will increase by \(e^{-0.2334274} \times e^{-0.0002651} = 0.7916053 = 1\) (rounded to zero), when all other variables held constant.
As numelec increases by one unit, miltcoup, number of successful military coups will increase by \(e^{-0.2334274} \times e^{-0.0296185} = 0.7687067 = 1\) (rounded to zero), when all other variables held constant.
As numregim increases by one unit, miltcoup, number of successful military coups will increase by \(e^{-0.2334274} \times e^{0.2109432} = 0.9777667 = 1\) (rounded to zero), when all other variables held constant.
pollib describes political liberalization of a country, has an impact on miltcoup. Estimates Limited Civil Rights and Full Civil Rights of the model are in comparison to No Civil Rights. It can be explained as count of miltcoup will decrease to \(e^{-1.1032439} = 0.3317933\), when pollib takes value of Limited Civil Rights over No Civil Rights. In other words, the count of successful military coup slightly reduces when a country has Limited Civil Rights. Also, miltcoup will decrease to \(e^{-1.6903057} = 0.1844633\), when pollib takes value of Full Civil Rights over No Civil Rights. In other words, the count of successful military coup greatly reduces when a country has Full Civil Rights.
Full model also suggests variables pctvote, popn, size, numelec and numregim are not contributing to the model. In other words, variables are not useful in predicting an increase or decrease counts of miltcoup when other variables(oligarchy, pollib and parties) are not taken into account.
Generating model without variables pctvote, popn, size, numelec and numregim.
Africa_2.glm <- glm(miltcoup~oligarchy + pollib + parties, family = poisson, data = Africa.C.df)
summary(Africa_2.glm)
##
## Call:
## glm(formula = miltcoup ~ oligarchy + pollib + parties, family = poisson,
## data = Africa.C.df)
##
## Deviance Residuals:
## Min 1Q Median 3Q Max
## -1.3609 -1.0407 -0.3153 0.6145 1.7536
##
## Coefficients:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) 0.207981 0.445679 0.467 0.6407
## oligarchy 0.091466 0.022563 4.054 5.04e-05 ***
## pollibLimited Civil Rights -0.495414 0.475645 -1.042 0.2976
## pollibFull Civil Rights -1.112086 0.459492 -2.420 0.0155 *
## parties 0.022358 0.009098 2.458 0.0140 *
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for poisson family taken to be 1)
##
## Null deviance: 65.945 on 35 degrees of freedom
## Residual deviance: 32.822 on 31 degrees of freedom
## AIC: 107.63
##
## Number of Fisher Scoring iterations: 5
As oligarchy increases by one unit, miltcoup, number of successful military coups will increase by \(e^{0.207981} \times e^{0.091466} = 1.3491123 = 1\) (rounded to zero), when all other variables held constant.
As parties increases by one unit, miltcoup, number of successful military coups will increase by \(e^{0.207981} \times e^{0.022358} = 1.2590266 = 1\) (rounded to zero), when all other variables held constant.
pollib estimates Limited Civil Rights and Full Civil Rights of the model are in comparison to No Civil Rights. It can be explained as a count of miltcoup will decrease to \(e^{-0.495414} = 0.6093188\), when pollib takes the value of Limited Civil Rights over No Civil Rights. In other words, the count of successful military coup slightly reduces when a country has Limited Civil Rights. Also, miltcoup will decrease to \(e^{-1.112086} = 0.3288725\), when pollib takes value of Full Civil Rights over No Civil Rights. In other words, a count of successful military coup greatly reduces when a country has Full Civil Rights.