### Loading the data
terrorism <- read_dta("~/Documents/R coding/terrorism.dta")
terrorism<-terrorism%>%
filter(!is.na(gdppc) & ftmpop > 0)
terrorism<-terrorism%>%
mutate(gdppc.median=median(gdppc))
terrorism_new_file<- terrorism%>%
mutate(higdppc=ifelse(gdppc>=gdppc.median, 1, 0), hi_lack=higdppc*lackpf, lackpf2=(lackpf)^2, hi_lack2=higdppc*lackpf2, lnftmpop=log(ftmpop),hi_ethnic=higdppc*ethnic,hi_religion=higdppc*religion)
model_1<- lm(data=terrorism_new_file, formula=lnftmpop~higdppc+lackpf+hi_lack) #Coefficients:(Intercept) -0.7172 higdppc -2.8380 lackpf -0.2483 hi_lack 0.6449
model_2<- lm(data=terrorism_new_file, formula=lnftmpop~higdppc+lackpf+lackpf2+hi_lack+hi_lack2) #int:-1.51736,higgdppc:-3.84411, lackpf:0.13124, lackpf2:-0.04028, hi_lack:1.88905, hi_lack2:-0.19593
model_3<- lm(data=terrorism_new_file, formula=lnftmpop~higdppc+lackpf+lackpf2+ethnic+religion+hi_ethnic+hi_religion)#inte:-4.3760, higdppc:-0.3837, lackpf: 1.6219, lackpf2:-0.1886, ethnic:1.4617 , religion: -3.0074, hi_ethnic: -1.2973 , hi_religion: 2.6547
model_4<- lm(data=terrorism_new_file, formula=lnftmpop~higdppc+lackpf+lackpf2+ethnic+religion+hi_ethnic+hi_religion+mideast+latinam+easteurope+africa+eastasia)
stargazer(model_1, model_2,model_3,model_4,type = "html",dep.var.labels = c("log Fatalities"), title = "Fatalities and Poverty", style = "qje",notes.append = FALSE,notes = c("<sup>⋆</sup>p<0.1; <sup>⋆⋆</sup>p<0.05; <sup>⋆⋆⋆</sup>p<0.01"))
| log Fatalities | ||||
| (1) | (2) | (3) | (4) | |
| higdppc | -2.838** | -3.844 | -0.384 | -0.593 |
| (1.124) | (3.080) | (1.127) | (1.278) | |
| lackpf | -0.248 | 0.131 | 1.622*** | 1.977*** |
| (0.194) | (1.331) | (0.575) | (0.661) | |
| lackpf2 | -0.040 | -0.189*** | -0.228*** | |
| (0.140) | (0.070) | (0.078) | ||
| hi_lack | 0.645** | 1.889 | ||
| (0.246) | (1.501) | |||
| hi_lack2 | -0.196 | |||
| (0.171) | ||||
| ethnic | 1.462 | 1.237 | ||
| (1.283) | (1.484) | |||
| religion | -3.007* | -3.406* | ||
| (1.612) | (1.910) | |||
| hi_ethnic | -1.297 | -0.501 | ||
| (1.912) | (2.117) | |||
| hi_religion | 2.655 | 2.511 | ||
| (2.014) | (2.185) | |||
| mideast | -1.253 | |||
| (1.271) | ||||
| latinam | -1.586 | |||
| (1.079) | ||||
| easteurope | -0.966 | |||
| (0.927) | ||||
| africa | -0.848 | |||
| (1.148) | ||||
| eastasia | -0.940 | |||
| (0.971) | ||||
| Constant | -0.717 | -1.517 | -4.376*** | -3.782** |
| (0.999) | (2.943) | (1.295) | (1.505) | |
| N | 76 | 76 | 74 | 74 |
| R2 | 0.122 | 0.189 | 0.201 | 0.229 |
| Adjusted R2 | 0.085 | 0.131 | 0.117 | 0.077 |
| Residual Std. Error | 1.808 (df = 72) | 1.762 (df = 70) | 1.769 (df = 66) | 1.808 (df = 61) |
| F Statistic | 3.333** (df = 3; 72) | 3.264** (df = 5; 70) | 2.379** (df = 7; 66) | 1.510 (df = 12; 61) |
| Notes: | ⋆p<0.1; ⋆⋆p<0.05; ⋆⋆⋆p<0.01 | |||
p1<- ggplot(data=terrorism_new_file,aes(x=lackpf, y=lnftmpop, color=factor(higdppc)))+
geom_point()+
geom_smooth(method="lm", se=F)+
xlab("Lack of Political Freedom")+
ylab("Log of Fatalities from Terrorists Incidents per Population")
p1
\[lnftmpop = -0.7172 - 2.8380 \beta_1 -0.2483 \beta_2 + 0.6449 \beta_3\]
When GDP per capita is greater than or equal to the median, our regression line is:
\[lnftmpop = -0.7172 -0.2483 \beta_2 + 0.6449 \beta_3\] When GDP per capita is less than the median, our regression line is:
\[lnftmpop = -3.5552 -0.2483 \beta_2 + 0.6449 \beta_3\]
\[H_{0} : \beta_{higdppc} = 0\] \[H_{1} : \beta_{lngdppc} \neq 0\]
\(t = -2.52\). Hence,so \(|t_{calculated}| < |t_{critical}|\),\(|-2.52| > |1.96|\). The hypothesis is rejected at the 5 % significance level. The estimated coefficient, \(-2.8380\), means that a 1 unit increase in GDP per capita is associated with a -2.838% decrease in terrorist fatalities.
\[H_{0} : \beta_{hilack} = 0 , \beta_{hilack2} = 0\] \[H_{1} : \beta_{hilack} \neq 0 , \beta_{hilack2} \neq 0\]
F= 1.3385 with P-value=0.2689. So, the hypothesis that both coefficients are zero. In other words, we are trying to test whether either hi_lack or hi_lack2 have a relationship with log of Fatalities keeping lackpf, lackpf2, higdppc constant
linearHypothesis(model_2, c(" hi_lack = 0 ", "hi_lack2 = 0")) ## Homoskedastic Errors
## Linear hypothesis test
##
## Hypothesis:
## hi_lack = 0
## hi_lack2 = 0
##
## Model 1: restricted model
## Model 2: lnftmpop ~ higdppc + lackpf + lackpf2 + hi_lack + hi_lack2
##
## Res.Df RSS Df Sum of Sq F Pr(>F)
## 1 72 222.73
## 2 70 217.30 2 5.4277 0.8742 0.4217
linearHypothesis(model_2, c(" hi_lack = 0 ","hi_lack2 = 0"),white.adjust = "hc1") ## heteroskedasticity robust standard errors
## Linear hypothesis test
##
## Hypothesis:
## hi_lack = 0
## hi_lack2 = 0
##
## Model 1: restricted model
## Model 2: lnftmpop ~ higdppc + lackpf + lackpf2 + hi_lack + hi_lack2
##
## Note: Coefficient covariance matrix supplied.
##
## Res.Df Df F Pr(>F)
## 1 72
## 2 70 2 1.3385 0.2689
linearHypothesis(model_2, c(" lackpf2 = 0 ", "hi_lack2 = 0")) ## Homoskedastic Errors
## Linear hypothesis test
##
## Hypothesis:
## lackpf2 = 0
## hi_lack2 = 0
##
## Model 1: restricted model
## Model 2: lnftmpop ~ higdppc + lackpf + lackpf2 + hi_lack + hi_lack2
##
## Res.Df RSS Df Sum of Sq F Pr(>F)
## 1 72 235.29
## 2 70 217.30 2 17.985 2.8968 0.06184 .
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
linearHypothesis(model_2, c(" lackpf2 = 0 ","hi_lack2 = 0"),white.adjust = "hc1") ## heteroskedasticity robust standard errors
## Linear hypothesis test
##
## Hypothesis:
## lackpf2 = 0
## hi_lack2 = 0
##
## Model 1: restricted model
## Model 2: lnftmpop ~ higdppc + lackpf + lackpf2 + hi_lack + hi_lack2
##
## Note: Coefficient covariance matrix supplied.
##
## Res.Df Df F Pr(>F)
## 1 72
## 2 70 2 4.1159 0.02042 *
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
linearHypothesis(model_4, c("latinam = 0","easteurope = 0","eastasia = 0","africa = 0")) ## Homoskedastic Errors
## Linear hypothesis test
##
## Hypothesis:
## latinam = 0
## easteurope = 0
## eastasia = 0
## africa = 0
##
## Model 1: restricted model
## Model 2: lnftmpop ~ higdppc + lackpf + lackpf2 + ethnic + religion + hi_ethnic +
## hi_religion + mideast + latinam + easteurope + africa + eastasia
##
## Res.Df RSS Df Sum of Sq F Pr(>F)
## 1 65 206.61
## 2 61 199.50 4 7.1024 0.5429 0.7048
linearHypothesis(model_4, c("latinam = 0","easteurope = 0","eastasia = 0","africa = 0"),white.adjust = "hc1") ## heteroskedasticity robust standard errors
## Linear hypothesis test
##
## Hypothesis:
## latinam = 0
## easteurope = 0
## eastasia = 0
## africa = 0
##
## Model 1: restricted model
## Model 2: lnftmpop ~ higdppc + lackpf + lackpf2 + ethnic + religion + hi_ethnic +
## hi_religion + mideast + latinam + easteurope + africa + eastasia
##
## Note: Coefficient covariance matrix supplied.
##
## Res.Df Df F Pr(>F)
## 1 65
## 2 61 4 0.6311 0.6422
F = 0.6311 with p-value = 0.6422, so the hypothesis is not rejected at 5% (or 10%) significance level. The number of restrictions is the number of coefficients that are zero under the null, here q = 4 (coefficients on latinam, easteurope, africa, eastasia). The 5% critical value of the \(F_{4,\infty}\) distribution is 2.37
The possible omitted variables will be lack of mental health resources, abortion rate, education, family support, establishments, encarcelation rate.
p2 <- ggplot(data=terrorism_new_file,aes(x=ethnic, y=lnftmpop, color=factor(higdppc)))+
geom_point()+
geom_smooth(method="lm", se=F)+
xlab("Ethnic")+
ylab("Log of Fatalities from Terrorists Incidents per Population")
p3<- ggplot(data=terrorism_new_file,aes(x=religion, y=lnftmpop, color=factor(higdppc)))+
geom_point()+
geom_smooth(method="lm", se=F)+
xlab("Religion*higdppc")+
ylab("Log of Fatalities from Terrorists Incidents per Population")
gridExtra::grid.arrange(p2,p3, ncol = 1)
Conclusion: Religious diversity is still tolerated when either the GDP per capita is below or above the median according to P3 which shows a negative slope when the economic conditions are both strong and poor. On the other hand, according to P2, as we move ethnic diversity to the right of the graph, the number of fatalities from terrorists incidents increases. Therefore, when ethnic diversity is closer to 1, it is not tolerated when economic conditions are strong and poor. According to our table in “Part 2 Regression Results”, in regression (8) and (9), the slopes for ethnic is 1.462 and 1.237, respectfully, and the slopes for religion are -3.007 and -3.406, respectfully. In conclusion, regressions (8) and (9) do support this theory because the slope coefficient is concise with our findings.
We compared variables that will have a possible linear relationship to the number of terrorist fatalities. Based on our findings, there seem to be higher terrorist fatalities when ethnic diversity increases compared to religion when economic conditions are strong. We derived this conclusion by conducting two linear regression (p2, p3) graphs for both (8) and (9) that plot the “religion” and “ethnic” linear regressions while taking into consideration high GDP per capita and low GDP per capita. We also noticed that locations with higher political freedom have a lower number of Terrorist Fatalities when GDP per capita is high and countries with higher political freedom have a higher number of Terrorist Fatalities when GDP per capita is low based on the regression line conducted in Part 3 (p1). In other words, countries that have strong economic conditions have a positive relationship between political freedom and Log of Fatalities from Terrorist Incidents while keeping everything else constant. On the other hand, when countries have poor economic conditions, political freedom and the number of Terrorist Fatalities have an inverse relationship while keeping everything else constant. Furthermore, many other variables may have been omitted from the data that we can take into consideration when analyzing these relationships. These omitted variables can be the lack of mental health resources, lack of education, abortion rate, family support, institutional organizations, and the incarceration rate.