1. How many assassination attempts are recorded in the data? How many countries experience at least one leader assassination attempt? What is the average number of such attempts (per year) among these countries?
Leaders <- read.csv("leaders.csv")
str(Leaders)
## 'data.frame': 250 obs. of 11 variables:
## $ year : int 1929 1933 1934 1924 1931 1968 1992 1908 1916 1929 ...
## $ country : Factor w/ 88 levels "Afghanistan",..: 1 1 1 2 2 3 3 4 4 4 ...
## $ leadername : Factor w/ 196 levels "Abdullah Al-Hussein",..: 72 128 77 196 196 27 26 6 46 92 ...
## $ age : int 39 53 50 29 36 41 73 48 76 77 ...
## $ politybefore : num -6 -6 -6 0 -9 -9 -2 1 2 2 ...
## $ polityafter : num -6 -7.33 -8 -9 -9 ...
## $ interwarbefore: int 0 0 0 0 0 0 0 0 0 0 ...
## $ interwarafter : int 0 0 0 0 0 0 0 0 0 0 ...
## $ civilwarbefore: int 1 0 0 0 0 0 0 0 0 0 ...
## $ civilwarafter : int 0 0 0 0 0 0 1 0 0 0 ...
## $ result : Factor w/ 10 levels "dies between a day and a week",..: 6 3 9 10 6 10 3 7 6 6 ...
length(Leaders$year)
## [1] 250
250 assassination attempts (observations) in total (both methods above can be used to obtain the answer).
length(unique(Leaders$country))
## [1] 88
88 countries experience at least one leader assassination attempt.
mean(tapply(Leaders$country, Leaders$year, length))
## [1] 2.45098
The average number of assassination attempts per year is 2.45098.
2. Create a new binary variable named success that is equal to 1 if a leader dies from the attack and 0 if the leader survives. Store this new variable as part of the original data frame.
summary(Leaders$result)
## dies between a day and a week
## 2
## dies between a week and a month
## 2
## dies within a day after the attack
## 46
## dies, timing unknown
## 4
## hospitalization but no permanent disability
## 20
## not wounded
## 96
## plot stopped
## 40
## survives but wounded severely
## 1
## survives, whether wounded unknown
## 14
## wounded lightly
## 25
str(Leaders$result)
## Factor w/ 10 levels "dies between a day and a week",..: 6 3 9 10 6 10 3 7 6 6 ...
table(Leaders$result)
##
## dies between a day and a week
## 2
## dies between a week and a month
## 2
## dies within a day after the attack
## 46
## dies, timing unknown
## 4
## hospitalization but no permanent disability
## 20
## not wounded
## 96
## plot stopped
## 40
## survives but wounded severely
## 1
## survives, whether wounded unknown
## 14
## wounded lightly
## 25
First off, using summary and str functions or table function, we can see there are 10 levels of factors in result column and there are 4 caterogies of “a leader dies”; dies between a day and a week, dies between a week and a month, dies within a day after the attack, dies, timing unknown.
Leaders$success <- c(ifelse(Leaders$result == "dies between a day and a week"|Leaders$result == "dies between a week and a month"| Leaders$result == "dies within a day after the attack"| Leaders$result == "dies, timing unknown", 1, 0))
Created above a new binary variable ‘success’.
What is the overall success rate of leader assassination? Does the result speak to the validity of the assumption that the success of assassination attempts is randomly determined?
mean(Leaders$success)
## [1] 0.216
The overall success rate of leader assassination is 21.6 %.
3. Investigate whether the average polity score over three years prior to an assassination attempt differs on average between successful and failed attempts. Also, examine whether there is any difference in the age of targeted leaders between successful and failed attempts. Briefly interpret the results in light of the validity of the aforem4. Repeat the same analysis as in the previous question, but this time using the country’s experience of civil and international war. Create a new binary variable in the data frame called warbefore. Code the variable such that it is equal to 1 if a country is in either civil or international war during the three years prior to an assassination attempt. Provide a brief interpretation of the result.entioned assumption.
tapply(Leaders$politybefore, Leaders$success, mean)
## 0 1
## -1.7431973 -0.7037037
The result above shows that the average polity score over three years prior to an assassination attempt differs on average between successful and failed attempts by -1.
tapply(Leaders$age, Leaders$success, mean)
## 0 1
## 52.71429 56.46296
The difference in leaders’ average age between successful and failed attempts is 3.74867.
4. Repeat the same analysis as in the previous question, but this time using the country’s experience of civil and international war. Create a new binary variable in the data frame called warbefore. Code the variable such that it is equal to 1 if a country is in either civil or international war during the three years prior to an assassination attempt. Provide a brief interpretation of the result.
Leaders$warbefore <- ifelse(Leaders$interwarbefore == 1 | Leaders$civilwarbefore == 1, 1, 0)
tapply(Leaders$warbefore, Leaders$success, mean)
## 0 1
## 0.3724490 0.3518519
Since the difference does not seem significantly big, it is hardly regarded as a possible confounding factor.
5. Does successful leader assassination cause democratization? Does successful leader assassination lead countries to war? When analyzing these data, be sure to state your assumptions and provide a brief interpretation of the results.
Comparison of scores (compute the difference-in-means; e.g) success (polityafter - politybefore) - fail (polityafter - politybefore):
tapply(Leaders$polityafter - Leaders$politybefore, Leaders$success, mean)
## 0 1
## -0.15136054 -0.05864198
-0.05864198 - (-0.15136054)
## [1] 0.09271856
tapply(Leaders$interwarafter - Leaders$interwarbefore, Leaders$success, mean)
## 0 1
## -0.01020408 -0.14814815
-0.14814815 - (-0.01020408)
## [1] -0.1379441
tapply(Leaders$civilwarafter - Leaders$civilwarbefore, Leaders$success, mean)
## 0 1
## -0.04081633 0.00000000
-0.04081633 - (0.00000000)
## [1] -0.04081633
Overall, the results show that there is not much difference, therefore, we cannot conclude that successful leader assassination causes democratization nor successful leader assassination leads countries to war.