# Sort data
mma_data <- mma_data %>%
arrange(state_name, event_date)
### Create Additive Index of Involvement Variables how many different types of security forces were deployed
mma_data$dep <- mma_data$police + mma_data$milpolice + mma_data$military + mma_data$militia + mma_data$secforc_amb
## Create indicator for past deployment
mma_data <- mma_data %>%
mutate(prev_dep = lag(dep))
# Create indicator for average past deployment
mma_data <- mma_data %>%
group_by(state_name) %>%
mutate(avg_dep = lag(cumsum(dep) / row_number()))
### Now for the Repression Variable
## Create indicator for past Repression
mma_data <- mma_data %>%
mutate(prev_rep = lag(sec_engagement_MMAD))
# Create indicator for average past Repression
mma_data <- mma_data %>%
group_by(state_name) %>%
mutate(avg_rep = lag(cumsum(sec_engagement_MMAD) / row_number()))
#change the variable to military
mma_data <- mma_data %>%
mutate(prev_mil = lag(military))
#new variable for the mean number of military used
mma_data <- mma_data %>%
mutate(mean_mil = mean(military))
#create a variable for the Middle Eastern Countries
mma_data <- mma_data %>%
mutate(middle_east = ifelse(state_name %in% c("Syria", "Jordan", "Yemen", "United Arab Emirates", "Tunisia", "Sudan", "Saudi Arabia", "Oman", "Morocco"), 1, 0))
#create a variable for Asian
mma_data <- mma_data %>%
mutate(Asian = ifelse(state_name %in% c("Vietnam", "Uzbekistan", "Turkmenistan", "Thailand", "Singapore", "Pakistan"), 1, 0))
#create a variable for African
mma_data <- mma_data %>%
mutate(African = ifelse(state_name %in% c("Namibia", "Uganda", "Namibia", "Gabon"), 1, 0))
#this analysis is concerned whether if there is a correlation between past mass repression and whether there is an increase OR decrease in protest within authoritarian regimes. This is a preliminary analysis and for now I am looking for a correlation between past mass repression and protests. Could past mass repression lead to more or less protestsin the future? The general litrature shows that it can go either way. The data is a time series data named Mass Mobalization in Authoritarian regimes. The unit of analysis protest events, which recorded each protests when it happened and the date of the event. This data was approved by Dr.Thurber, and he said that it is a reputable data to use and the authors are well known.
#lets get to know the varaibles, our dependant varible is the numbers of protest, and on page 3 in the codebook there is a variable by the name num_participants_num_mean.This variable recorded the number of protestors in the protest, which I think is suffecinat to measure the dependant varible. The IV is whether the authorities used the military or not. this is dichotomos variable, 0-1
hist (mma_data$dep)
#lets make this look nicer
levels(mma_data$dep) <- c("No","Yes")
table(mma_data$dep)
##
## 0 1 2 3 4 5
## 263 4869 743 188 34 4
counts <- table(mma_data$dep)
barplot(counts, main="figure 3 ",
xlab="number deployed", col=c("pink", "gold"),beside=TRUE)
#More on decrpitive statistics: Lets work with the independat variable, which is a catigorical variable. This is a variable that will look at mass repression. On page 3 on the code book the MMA authors measured the repressive actor identity. Here I want to use the military variable since I want to measure a harsh crackdown. The variables name is military, which showed that the military was used 483 times. Note that this variable will lagged to the previose use of military
#this is the military variable IV
levels(mma_data$military) <- c("No","Yes")
table(mma_data$military)
##
## 0 1
## 5618 483
counts <- table(mma_data$military)
barplot(counts, main="figure 2",
xlab="military used vs not", col=c("paleturquoise4", "lightcoral"),beside=TRUE)
legend("topright",
legend = c("No", "Yes"),
fill = c("paleturquoise4", "lightcoral"))
I checked for correlations between military and police, the correlation was -0.1736628, a 1 would be seen as high or 0 would be low, so a -0.1736628 shows a negative correlation.
#lets check for correlations, it turns out that it is small.-0.1736628 , but is correlated negatively
cor.test(mma_data$military, mma_data$police, method="spearman")
## Warning in cor.test.default(mma_data$military, mma_data$police, method =
## "spearman"): Cannot compute exact p-value with ties
##
## Spearman's rank correlation rho
##
## data: mma_data$military and mma_data$police
## S = 44421697766, p-value < 0.00000000000000022
## alternative hypothesis: true rho is not equal to 0
## sample estimates:
## rho
## -0.1736628
ggplot(data=mma_data, aes(event_date,prev_mil,group=1)) + geom_smooth() #I am checking for auto-correlation I used the DV event date that is the when the protest happened, with the IV that is previous use of military.
## `geom_smooth()` using method = 'gam' and formula = 'y ~ s(x, bs = "cs")'
## Warning: Removed 67 rows containing non-finite outside the scale range
## (`stat_smooth()`).
ggplot(data=mma_data, aes(num_participants_num_mean_log,prev_mil,group=1)) + geom_smooth() #this is another test of the data I used the number of participant in a protest DV, with the previous use of military (IV). It looks like both graphs show autocorrelation
## `geom_smooth()` using method = 'gam' and formula = 'y ~ s(x, bs = "cs")'
## Warning: Removed 2222 rows containing non-finite outside the scale range
## (`stat_smooth()`).
#lets do some regression models first a bivariate (DV) is num_participants_num_mean and (IV) is military, then lets add some conrols. Note that the controles I made were in the begining, I resorted the data for it would go by state name then event date. I lagged the military variable so it would measure if the use of the military is linked with the previose event (or year) (prev_mil)
model1<-lm(num_participants_num_mean_log ~ prev_mil, data=mma_data)
model2<-lm(num_participants_num_mean_log ~ prev_mil +police, data=mma_data)
model3<-lm(num_participants_num_mean_log ~ prev_mil +police+ military,data=mma_data)
model4<-lm(num_participants_num_mean_log ~ prev_mil+police+ military +mean_mil, data=mma_data)
model5<-lm(num_participants_num_mean_log ~ prev_mil+police+ military +mean_mil+dep+middle_east+African+Asian+factor(state_name), data=mma_data)
stargazer(model1, model2, model3,model4,model5, title="RegressionResults", align=TRUE,dep.var.labels=c("number of protestors"),covariate.labels=c("previous use of the military","police", " military used or not ","the mean number of the military used","deployment","middle east","African","Asian"), out="models.txt",type = "text")
##
## RegressionResults
## ========================================================================================================================================================================
## Dependent variable:
## -----------------------------------------------------------------------------------------------------------------------------
## number of protestors
## (1) (2) (3) (4) (5)
## ------------------------------------------------------------------------------------------------------------------------------------------------------------------------
## previous use of the military 0.812*** 0.743*** 0.505*** 0.328*** 0.344***
## (0.113) (0.113) (0.118) (0.120) (0.112)
##
## police -0.364*** -0.301*** -0.184*** -0.190**
## (0.069) (0.069) (0.071) (0.078)
##
## military used or not 0.771*** 0.610*** 0.288**
## (0.114) (0.116) (0.121)
##
## the mean number of the military used 2.727*** 3.348
## (0.391) (3.641)
##
## deployment 0.409***
## (0.056)
##
## middle east 1.368*
## (0.750)
##
## African 0.412
## (0.382)
##
## Asian -0.050
## (0.532)
##
## factor(state_name)Algeria -0.003
## (0.349)
##
## factor(state_name)Angola -0.799
## (0.578)
##
## factor(state_name)Armenia 2.029***
## (0.340)
##
## factor(state_name)Azerbaijan 0.769**
## (0.305)
##
## factor(state_name)Bangladesh 1.816***
## (0.345)
##
## factor(state_name)Belarus -0.171
## (0.271)
##
## factor(state_name)Burkina Faso 1.859**
## (0.866)
##
## factor(state_name)Cambodia 0.311
## (0.467)
##
## factor(state_name)Cameroon -0.059
## (0.674)
##
## factor(state_name)Central African Republic 0.384
## (1.585)
##
## factor(state_name)China 1.266***
## (0.219)
##
## factor(state_name)Congo - Kinshasa -0.076
## (0.320)
##
## factor(state_name)Côte d’Ivoire -0.131
## (1.064)
##
## factor(state_name)Cuba -0.831*
## (0.449)
##
## factor(state_name)Egypt 0.423
## (0.385)
##
## factor(state_name)Eswatini 1.114***
## (0.413)
##
## factor(state_name)Ethiopia 1.573***
## (0.509)
##
## factor(state_name)Gabon -0.723
## (0.760)
##
## factor(state_name)Gambia 0.105
## (2.364)
##
## factor(state_name)Georgia 1.312**
## (0.558)
##
## factor(state_name)Guinea 0.877
## (0.868)
##
## factor(state_name)Guinea-Bissau 2.473
## (1.760)
##
## factor(state_name)Haiti 1.499***
## (0.355)
##
## factor(state_name)Iran 1.040***
## (0.218)
##
## factor(state_name)Jordan -0.596
## (0.936)
##
## factor(state_name)Kazakhstan -0.266
## (0.378)
##
## factor(state_name)Kuwait 1.609***
## (0.441)
##
## factor(state_name)Kyrgyzstan 0.290
## (0.307)
##
## factor(state_name)Laos 0.170
## (1.760)
##
## factor(state_name)Liberia 1.262
## (0.912)
##
## factor(state_name)Libya 0.641
## (0.479)
##
## factor(state_name)Madagascar 1.590***
## (0.377)
##
## factor(state_name)Malaysia 1.275***
## (0.315)
##
## factor(state_name)Mauritania -0.361
## (0.417)
##
## factor(state_name)Morocco -1.118
## (0.910)
##
## factor(state_name)Mozambique -0.029
## (1.041)
##
## factor(state_name)Myanmar (Burma) -0.590
## (0.721)
##
## factor(state_name)Namibia -0.745
## (1.802)
##
## factor(state_name)Nepal 1.848***
## (0.256)
##
## factor(state_name)North Korea -2.201
## (2.365)
##
## factor(state_name)Oman -2.518***
## (0.572)
##
## factor(state_name)Pakistan 0.981*
## (0.525)
##
## factor(state_name)Russia 0.223
## (0.207)
##
## factor(state_name)Saudi Arabia -1.960**
## (0.996)
##
## factor(state_name)Singapore -1.491
## (1.177)
##
## factor(state_name)Sudan -1.379
## (0.932)
##
## factor(state_name)Syria 0.174
## (0.551)
##
## factor(state_name)Tajikistan 2.772**
## (1.260)
##
## factor(state_name)Tanzania 0.632
## (0.905)
##
## factor(state_name)Thailand 0.911
## (0.640)
##
## factor(state_name)Togo 1.578***
## (0.411)
##
## factor(state_name)Tunisia -1.062*
## (0.588)
##
## factor(state_name)Turkmenistan -1.892
## (1.843)
##
## factor(state_name)Uganda
##
##
## factor(state_name)United Arab Emirates -0.095
## (1.136)
##
## factor(state_name)Uzbekistan -0.659
## (0.933)
##
## factor(state_name)Venezuela 1.875***
## (0.304)
##
## factor(state_name)Vietnam
##
##
## factor(state_name)Yemen
##
##
## factor(state_name)Zambia 0.821
## (0.569)
##
## factor(state_name)Zimbabwe
##
##
## Constant 6.456*** 6.728*** 6.634*** 6.355*** 5.124***
## (0.032) (0.061) (0.062) (0.073) (0.290)
##
## ------------------------------------------------------------------------------------------------------------------------------------------------------------------------
## Observations 3,879 3,879 3,879 3,879 3,879
## R2 0.013 0.020 0.031 0.044 0.188
## Adjusted R2 0.013 0.020 0.031 0.043 0.174
## Residual Std. Error 1.899 (df = 3877) 1.892 (df = 3876) 1.881 (df = 3875) 1.870 (df = 3874) 1.737 (df = 3813)
## F Statistic 51.568*** (df = 1; 3877) 39.795*** (df = 2; 3876) 42.004*** (df = 3; 3875) 44.047*** (df = 4; 3874) 13.596*** (df = 65; 3813)
## ========================================================================================================================================================================
## Note: *p<0.1; **p<0.05; ***p<0.01
plot(model1)
plot(model5)
## Warning: not plotting observations with leverage one:
## 1368, 1799, 3431
## Warning in sqrt(crit * p * (1 - hh)/hh): NaNs produced
## Warning in sqrt(crit * p * (1 - hh)/hh): NaNs produced
# the regression models showed: for the bivariat model the IV the
previous military,was significant, which means that that the use of a
military in a previous year increses the protests by 0.812. Lets move on
to the final model (model5) that has the fixed effects of states along
with the other controlos. The model showed that when the military is
used in a previous year there was a 0.341 an increase in protests within
the subsequent year. The military variable by itself also was
significant, which means that when the state uses the military, there
was a 0.680 increase in protests. Another important aspect, is that when
controlling for regions the middle east showed to be significant.
#Lets do an advanced model, since I am using time series data, I will control for random effects for each state. The fixed effects model showed a -0.082 compared to the bivariat model 0.996, indicating that the model gained strength when accounted for other effects of each state.
library(lme4)
## Loading required package: Matrix
##
## Attaching package: 'Matrix'
## The following objects are masked from 'package:tidyr':
##
## expand, pack, unpack
#this is just another code for fixed effects mix.int <- lmer(num_participants_num_mean_log ~ military + (1 | state_name), data = mma_data)
#summary(mix.int)
#Robustness check lets add other type of repression: militia, militarized police and Ambiguous security force. al show no correlation with an increase with number of partcipants. Results showed no correlation with the other repression methods
model6<-lm(num_participants_num_mean_log~ prev_mil+police+military+mean_mil+dep+middle_east+African+Asian+militia+milpolice+secforc_amb+factor(state_name),data=mma_data)
stargazer(model6, title="RegressionResultsRobust", align=TRUE,dep.var.labels=c("number of protestors"),covariate.labels=c("previous use of the military","police", " military used or not ","the mean number of the military used","deployment","middle east","African","Asian","Militia", "militarized police","Ambiguous security force"), out="models.txt",type = "text")
##
## RegressionResultsRobust
## ======================================================================
## Dependent variable:
## ---------------------------
## number of protestors
## ----------------------------------------------------------------------
## previous use of the military 0.343***
## (0.112)
##
## police -0.229**
## (0.102)
##
## military used or not 0.247*
## (0.136)
##
## the mean number of the military used 3.237
## (3.649)
##
## deployment 0.450***
## (0.084)
##
## middle east 1.382*
## (0.750)
##
## African 0.407
## (0.382)
##
## Asian -0.051
## (0.532)
##
## Militia -0.203
## (0.202)
##
## militarized police -0.046
## (0.116)
##
## Ambiguous security force
##
##
## factor(state_name)Algeria -0.017
## (0.349)
##
## factor(state_name)Angola -0.797
## (0.578)
##
## factor(state_name)Armenia 2.030***
## (0.340)
##
## factor(state_name)Azerbaijan 0.764**
## (0.305)
##
## factor(state_name)Bangladesh 1.813***
## (0.345)
##
## factor(state_name)Belarus -0.177
## (0.271)
##
## factor(state_name)Burkina Faso 1.874**
## (0.866)
##
## factor(state_name)Cambodia 0.308
## (0.467)
##
## factor(state_name)Cameroon -0.076
## (0.675)
##
## factor(state_name)Central African Republic 0.394
## (1.585)
##
## factor(state_name)China 1.261***
## (0.220)
##
## factor(state_name)Congo - Kinshasa -0.080
## (0.320)
##
## factor(state_name)Côte d’Ivoire -0.094
## (1.065)
##
## factor(state_name)Cuba -0.854*
## (0.453)
##
## factor(state_name)Egypt 0.425
## (0.386)
##
## factor(state_name)Eswatini 1.105***
## (0.413)
##
## factor(state_name)Ethiopia 1.568***
## (0.509)
##
## factor(state_name)Gabon -0.703
## (0.762)
##
## factor(state_name)Gambia 0.156
## (2.366)
##
## factor(state_name)Georgia 1.319**
## (0.558)
##
## factor(state_name)Guinea 0.886
## (0.869)
##
## factor(state_name)Guinea-Bissau 2.472
## (1.760)
##
## factor(state_name)Haiti 1.522***
## (0.356)
##
## factor(state_name)Iran 1.050***
## (0.220)
##
## factor(state_name)Jordan -0.626
## (0.937)
##
## factor(state_name)Kazakhstan -0.272
## (0.378)
##
## factor(state_name)Kuwait 1.594***
## (0.442)
##
## factor(state_name)Kyrgyzstan 0.295
## (0.308)
##
## factor(state_name)Laos 0.124
## (1.762)
##
## factor(state_name)Liberia 1.244
## (0.913)
##
## factor(state_name)Libya 0.695
## (0.485)
##
## factor(state_name)Madagascar 1.576***
## (0.380)
##
## factor(state_name)Malaysia 1.268***
## (0.316)
##
## factor(state_name)Mauritania -0.370
## (0.417)
##
## factor(state_name)Morocco -1.152
## (0.912)
##
## factor(state_name)Mozambique -0.037
## (1.041)
##
## factor(state_name)Myanmar (Burma) -0.558
## (0.722)
##
## factor(state_name)Namibia -0.748
## (1.802)
##
## factor(state_name)Nepal 1.837***
## (0.257)
##
## factor(state_name)North Korea -2.192
## (2.366)
##
## factor(state_name)Oman -2.530***
## (0.572)
##
## factor(state_name)Pakistan 0.980*
## (0.525)
##
## factor(state_name)Russia 0.220
## (0.207)
##
## factor(state_name)Saudi Arabia -1.991**
## (0.997)
##
## factor(state_name)Singapore -1.498
## (1.177)
##
## factor(state_name)Sudan -1.405
## (0.933)
##
## factor(state_name)Syria 0.138
## (0.554)
##
## factor(state_name)Tajikistan 2.766**
## (1.260)
##
## factor(state_name)Tanzania 0.659
## (0.906)
##
## factor(state_name)Thailand 0.926
## (0.641)
##
## factor(state_name)Togo 1.554***
## (0.412)
##
## factor(state_name)Tunisia -1.080*
## (0.588)
##
## factor(state_name)Turkmenistan -1.899
## (1.843)
##
## factor(state_name)Uganda
##
##
## factor(state_name)United Arab Emirates -0.115
## (1.136)
##
## factor(state_name)Uzbekistan -0.637
## (0.934)
##
## factor(state_name)Venezuela 1.894***
## (0.305)
##
## factor(state_name)Vietnam
##
##
## factor(state_name)Yemen
##
##
## factor(state_name)Zambia 0.813
## (0.569)
##
## factor(state_name)Zimbabwe
##
##
## Constant 5.130***
## (0.291)
##
## ----------------------------------------------------------------------
## Observations 3,879
## R2 0.188
## Adjusted R2 0.174
## Residual Std. Error 1.737 (df = 3811)
## F Statistic 13.202*** (df = 67; 3811)
## ======================================================================
## Note: *p<0.1; **p<0.05; ***p<0.01