KPopiela_Finalp2

library(poliscidata)
Registered S3 method overwritten by 'gdata':
  method         from  
  reorder.factor gplots
library(dplyr)

Attaching package: 'dplyr'
The following objects are masked from 'package:stats':

    filter, lag
The following objects are masked from 'package:base':

    intersect, setdiff, setequal, union
library(tidyr)
library(stats)
library(ggplot2)

##Intro and Background Info

I’ve had more time to think about my final, and I’ve decided to simplify my research topic. Rather than look at ethnic conflict, I’m going to look at how internet usage affects a people’s confidence in their country (institutions and governance). In order to focus on this relationship, I will be using the ‘world’ data set in the ‘poliscidata’ package, and I will be using the following variables: ‘country’, ‘unnetuse’ (internet usage per 100 people), confidence (population’s confidence in their country’s institutions; scaled out of 100), and ‘effectiveness’ (government effectiveness scale).

Below is a general presentation of the data I will be using, filtered down as I described.

library(poliscidata) %>%
  data("world")
Warning in data(., "world"): data set '.' not found
world %>%
  select(country,regime_type3,unnetuse,confidence,effectiveness)
                              country        regime_type3 unnetuse confidence
1                         Afghanistan        Dictatorship      1.7         NA
2                             Albania Parliamentary democ     23.9  49.335926
3                             Algeria        Dictatorship     11.9  52.055735
4                              Angola        Dictatorship      3.1         NA
5                           Argentina  Presidential democ     28.1   7.299325
6                             Armenia                <NA>      6.2  27.132735
7                           Australia Parliamentary democ     70.8  46.838886
8                             Austria Parliamentary democ     71.2  49.680190
9                          Azerbaijan        Dictatorship     28.2  54.168485
10                            Bahrain        Dictatorship     51.9         NA
11                         Bangladesh Parliamentary democ      0.3  71.644389
12                            Belarus        Dictatorship     32.1  15.645705
13                            Belgium Parliamentary democ     68.1  43.315162
14                              Benin  Presidential democ      1.8         NA
15                             Bhutan        Dictatorship      6.6         NA
16                            Bolivia  Presidential democ     10.8         NA
17             Bosnia and Herzegovina        Dictatorship     34.7  70.204136
18                           Botswana        Dictatorship      6.2         NA
19                             Brazil  Presidential democ     37.5  32.501337
20                           Bulgaria Parliamentary democ     34.7  38.976006
21                       Burkina Faso        Dictatorship      0.9         NA
22                    Burma (Myanmar)                <NA>      0.2         NA
23                            Burundi        Dictatorship      0.8         NA
24                           Cambodia        Dictatorship      0.5         NA
25                           Cameroon        Dictatorship      3.8         NA
26                             Canada Parliamentary democ     75.3  58.203871
27                         Cape Verde Parliamentary democ     20.6         NA
28           Central African Republic                <NA>      0.4         NA
29                               Chad        Dictatorship      1.2         NA
30                              Chile  Presidential democ     32.5  58.368495
31                              China        Dictatorship     22.5  73.788814
32                           Colombia  Presidential democ     38.5         NA
33                            Comoros        Dictatorship      3.6         NA
34  Congo, Democratic Republic of the                <NA>       NA         NA
35             Congo, Republic of the                <NA>      4.3         NA
36                         Costa Rica  Presidential democ     32.3         NA
37                      Cote d'Ivoire  Presidential democ      3.2         NA
38                            Croatia                <NA>     50.5  44.175465
39                               Cuba        Dictatorship     12.9         NA
40                             Cyprus  Presidential democ     38.8         NA
41                     Czech Republic Parliamentary democ     57.8  35.172868
42                            Denmark Parliamentary democ     83.3  63.137017
43                           Djibouti        Dictatorship      2.3         NA
44                 Dominican Republic                <NA>     21.6         NA
45                            Ecuador        Dictatorship     28.8         NA
46                              Egypt        Dictatorship     16.6  59.227665
47                        El Salvador  Presidential democ     10.6  41.978817
48                  Equatorial Guinea        Dictatorship      1.8         NA
49                            Eritrea        Dictatorship      4.1         NA
50                            Estonia Parliamentary democ     66.2  39.182308
51                           Ethiopia        Dictatorship      0.4         NA
52                               Fiji        Dictatorship     12.2         NA
53                            Finland Parliamentary democ     82.0  46.875924
54                             France                <NA>     67.9  55.116509
55                              Gabon        Dictatorship      6.2         NA
56                        Gambia, The                <NA>      6.9         NA
57                            Georgia        Dictatorship     23.8  38.627903
58                            Germany Parliamentary democ     75.5  52.728927
59                              Ghana  Presidential democ      4.3         NA
60                             Greece Parliamentary democ     43.1         NA
61                          Guatemala  Presidential democ     14.3         NA
62                             Guinea        Dictatorship      0.9         NA
63                      Guinea-Bissau  Presidential democ      2.4         NA
64                             Guyana  Presidential democ     26.9         NA
65                              Haiti                <NA>     10.1         NA
66                           Honduras  Presidential democ     13.1         NA
67                          Hong Kong                <NA>     67.0         NA
68                            Hungary Parliamentary democ     58.5  45.543249
69                            Iceland                <NA>     59.0  63.628568
70                              India Parliamentary democ      4.5  62.205316
71                          Indonesia  Presidential democ      7.9  50.531385
72                               Iran        Dictatorship     32.0  57.685353
73                               Iraq Parliamentary democ      1.0         NA
74                            Ireland Parliamentary democ     62.7  68.497642
75                             Israel Parliamentary democ     47.9         NA
76                              Italy Parliamentary democ     41.8  37.016570
77                            Jamaica Parliamentary democ     57.3         NA
78                              Japan Parliamentary democ     75.2  37.033760
79                             Jordan        Dictatorship     27.0  73.628692
80                         Kazakhstan        Dictatorship     10.9         NA
81                              Kenya  Presidential democ      8.7         NA
82                       Korea, North                <NA>      0.0         NA
83                       Korea, South                <NA>     75.8         NA
84                             Kuwait        Dictatorship     36.7         NA
85                         Kyrgyzstan        Dictatorship     16.1         NA
86                               Laos        Dictatorship      8.5         NA
87                             Latvia Parliamentary democ     60.4  39.220066
88                            Lebanon        Dictatorship     22.5         NA
89                            Lesotho Parliamentary democ      3.6         NA
90                            Liberia        Dictatorship      0.5         NA
91                              Libya        Dictatorship      5.1         NA
92                          Lithuania                <NA>     54.4  48.126086
93                         Luxembourg Parliamentary democ     79.2         NA
94                          Macedonia Parliamentary democ     41.5  12.330052
95                         Madagascar                <NA>      1.7         NA
96                             Malawi  Presidential democ      2.1         NA
97                           Malaysia        Dictatorship     55.8         NA
98                               Mali                <NA>      1.6         NA
99                              Malta Parliamentary democ     48.3         NA
100                        Mauritania        Dictatorship      1.9         NA
101                         Mauritius Parliamentary democ     22.2         NA
102                            Mexico  Presidential democ     22.2  26.040388
103                           Moldova                <NA>     23.4  42.191709
104                          Mongolia                <NA>     12.5         NA
105                        Montenegro                <NA>     47.2         NA
106                           Morocco        Dictatorship     33.0         NA
107                        Mozambique        Dictatorship      1.6         NA
108                           Namibia  Presidential democ      5.3         NA
109                             Nepal Parliamentary democ      1.7         NA
110                       Netherlands Parliamentary democ     87.0  58.481013
111                       New Zealand Parliamentary democ     71.4  38.105963
112                         Nicaragua  Presidential democ      3.3         NA
113                             Niger                <NA>      0.5         NA
114                           Nigeria  Presidential democ     15.9  59.358170
115                            Norway Parliamentary democ     82.5  66.453811
116                              Oman        Dictatorship     20.0         NA
117                          Pakistan        Dictatorship     11.1  51.238722
118                         Palestine                <NA>      9.0         NA
119                            Panama  Presidential democ     27.5         NA
120                  Papua New Guinea Parliamentary democ      1.8         NA
121                          Paraguay        Dictatorship     14.3         NA
122                              Peru        Dictatorship     24.7   6.494946
123                       Philippines  Presidential democ      6.2  63.305240
124                            Poland                <NA>     49.0  65.605741
125                          Portugal                <NA>     42.1  37.364882
126                             Qatar        Dictatorship     34.0         NA
127                           Romania                <NA>     28.8  26.884683
128                            Russia                <NA>     31.9  41.145354
129                            Rwanda        Dictatorship      3.1         NA
130                      Saudi Arabia        Dictatorship     31.5         NA
131                           Senegal                <NA>      8.4         NA
132                            Serbia                <NA>     44.9         NA
133                      Sierra Leone  Presidential democ      0.3         NA
134                         Singapore        Dictatorship     69.6         NA
135                          Slovakia Parliamentary democ     66.0  25.269169
136                          Slovenia Parliamentary democ     55.7  39.855957
137                      South Africa Parliamentary democ      8.6  66.400869
138                             Spain Parliamentary democ     55.4  42.274258
139                         Sri Lanka                <NA>      5.8         NA
140                             Sudan        Dictatorship     10.2         NA
141                          Suriname  Presidential democ      9.7         NA
142                         Swaziland        Dictatorship      6.9         NA
143                            Sweden Parliamentary democ     87.7  56.535110
144                       Switzerland  Presidential democ     75.9  56.553995
145                             Syria        Dictatorship     17.3         NA
146                            Taiwan                <NA>       NA  49.197820
147                        Tajikistan        Dictatorship      8.8         NA
148                          Tanzania        Dictatorship      1.2  78.852623
149                          Thailand Parliamentary democ     23.9         NA
150                       Timor-Leste                <NA>       NA         NA
151                              Togo        Dictatorship      5.4         NA
152               Trinidad and Tobago                <NA>     17.0         NA
153                           Tunisia        Dictatorship     27.1         NA
154                            Turkey Parliamentary democ     34.4  57.070574
155                      Turkmenistan        Dictatorship      1.5         NA
156                            Uganda        Dictatorship      7.9  70.747317
157                           Ukraine                <NA>     10.5  36.022627
158              United Arab Emirates                <NA>     65.2         NA
159                    United Kingdom Parliamentary democ     76.0  56.467760
160                     United States  Presidential democ     75.9  61.785208
161                           Uruguay  Presidential democ     40.2  43.417722
162                        Uzbekistan        Dictatorship      9.0         NA
163                         Venezuela  Presidential democ     25.7  21.375093
164                           Vietnam        Dictatorship     24.2  99.862411
165                             Yemen        Dictatorship      1.6         NA
166                            Zambia  Presidential democ      5.5         NA
167                          Zimbabwe        Dictatorship     11.4  60.019029
    effectiveness
1       13.711584
2       35.460993
3       32.624114
4       19.148937
5       34.988179
6       36.643026
7       90.070923
8       88.888888
9       23.877069
10      65.011820
11      34.042554
12      22.222223
13      90.307329
14      31.914894
15      68.557920
16      34.042554
17      25.295509
18      67.139480
19      41.371158
20      45.153664
21      30.260047
22             NA
23      12.056737
24      33.333333
25      31.914894
26      91.016548
27      41.843972
28      12.765959
29      28.841608
30      74.704493
31      50.827423
32      37.352246
33      26.713949
34             NA
35             NA
36      55.319149
37      25.531915
38      51.063830
39      40.425532
40      70.212766
41      63.120567
42      93.617022
43      25.768322
44             NA
45      23.877069
46      39.007092
47      34.042554
48      14.184397
49      36.170213
50      65.011820
51      25.531915
52      47.990544
53      94.089834
54      86.052008
55      35.933806
56             NA
57      28.368795
58      88.179669
59      46.808511
60      65.248227
61      32.151300
62      28.132388
63      14.657210
64      39.007092
65       9.692673
66      29.314420
67             NA
68      65.011820
69      93.380615
70      43.498818
71      33.333333
72      35.697399
73       7.801419
74      84.869976
75      70.685579
76      68.085107
77      44.917258
78      71.867614
79      55.082743
80      27.659574
81      26.477541
82             NA
83             NA
84      50.354610
85      27.423168
86      27.659574
87      62.411348
88      36.879433
89      40.425532
90      10.874705
91      26.004728
92      60.992908
93      96.926717
94      37.352246
95      37.588653
96      30.496454
97      68.321513
98      26.713949
99      73.995271
100     42.789598
101     59.101654
102     50.118203
103     31.678487
104     42.316785
105            NA
106     48.226950
107     36.879433
108     50.827423
109     34.515367
110     97.163123
111     93.144209
112     26.004728
113     27.895981
114     20.094563
115     90.070923
116     62.884161
117     34.751773
118            NA
119     43.262411
120     28.132388
121     16.075651
122     35.460993
123     45.153664
124     60.992908
125     70.921985
126     62.884161
127     38.770685
128     37.115839
129     27.186761
130     45.390071
131     42.316785
132            NA
133     10.165486
134    100.000000
135     56.028369
136     65.957447
137     58.865248
138     82.742316
139     47.281324
140     20.330969
141     42.789598
142     36.170213
143     90.070923
144    100.000000
145     33.096927
146     70.212766
147     17.494089
148     34.515367
149     53.191489
150            NA
151     18.912531
152            NA
153     61.938534
154     41.843972
155     11.820330
156     36.879433
157     29.078014
158            NA
159     94.562647
160     86.761230
161     58.628841
162     20.567375
163     19.621750
164     40.189125
165     26.004728
166     24.586288
167     27.659574

The internet and media consumption play a massive role in politics now; at this point, it’s pretty much expected to find out what is happening in the world on the internet (newspapers, social media, etc.). And as we’ve seen since the 2016 election, the internet also plays a substantial role in domestic politics, whether it be through neutral journalism, activism, whistle-blowing, or misinformation. It is both good and bad, and as Stanford professor Evgeny Morozov writes, the internet’s impact “will depend on individual conditions” such as a given country’s political atmosphere (peaceful, volatile, conservative, liberal, etc.), ease of access to the internet, and how united a population is either in favor or against their current government (“The Internet, Politics and the Politics of Internet Debate”). So, what /is/ the relationship between internet use and domestic politics?

Based on my personal and academic experience, I hypothesize that while internet usage definitely does affect people’s confidence in their government, I do not think that it automatically hinders government effectiveness. If a certain country’s subjects have extremely little confidence in its government, the government would have no legitimacy (and would therefore be ineffective); a government’s power largely comes from its subjects’ willingness to accept it. However, there are instances where a country’s population has little confidence in its government with no effect on its efficacy. But, again, for this project I will be focusing on how internet usage impacts confidence in a given regime.

Now to transcribe my research question: Does internet usage (social media, news, etc.) have an impact on people’s confidence in their government (‘confidence’)? If so, is said government more or less effective in its duties?

First, lets look at some summary statistics.

1) ‘regime_type3’, ‘confidence’, ‘effectiveness’, ‘regime_type3’, and ‘unnetuse’

world_filter <- world %>%
  select(country,regime_type3,confidence,effectiveness,unnetuse)
summary(world_filter)
        country                 regime_type3   confidence     effectiveness    
 Afghanistan:  1   Dictatorship       :61    Min.   : 6.495   Min.   :  7.801  
 Albania    :  1   Parliamentary democ:41    1st Qu.:38.889   1st Qu.: 28.132  
 Algeria    :  1   Presidential democ :31    Median :49.508   Median : 39.007  
 Angola     :  1   NA's               :34    Mean   :48.900   Mean   : 46.036  
 Argentina  :  1                             3rd Qu.:59.523   3rd Qu.: 62.884  
 Armenia    :  1                             Max.   :99.862   Max.   :100.000  
 (Other)    :161                             NA's   :99       NA's   :14       
    unnetuse    
 Min.   : 0.00  
 1st Qu.: 5.25  
 Median :18.65  
 Mean   :26.78  
 3rd Qu.:42.35  
 Max.   :87.70  
 NA's   :3      
  1. regime_type3 – There are 167 entries in the filtered down dataset I am using. Dividing that, 61 countries are classified as dictatorships, 41 as a parliamentary democracy, 34 N/A responses/unclassified regimes, and 31 presidential democracies. Not having doen any statistical analysis yet I can’t speak for the values’ mathematical significance, but politically, it is important to note that 61/167 countries in the data set are classified as dictatorships.

  2. confidence – Confidence scores in this data set are scaled from 1-100. The minimum confidence score is 6.495 and the maximum, obviously is 100.000. The mean value, 48.508, is below 50.000 which indicates that there are slightly more scores under than 50.000 than over. The median is 49.508 and the 1st and 3rd quantiles are 38.889 and 59.523 respectively. However, these values are not so low that there’s an implication of a widespread (and severe) sense that peoples’ governments are incompetent.

  3. effectiveness – Similar to ‘confidence’, ‘effectiveness’ is scaled out of 100. Unlike ‘confidence’, however, this variable presents a numerical representation of how effective regimes are at governance (actual governance, welfare, infrastructure/services). The summary values for this variable are, overall, lower than their counterparts under ‘confidence’. The minimum value is 7.801, and the mean is 46.036. The median, 1st, and 3rd quantiles are 39.007, 28.132, and 62.884 respectively. While currently untested, these figures indicate that whether or not people have confidence in their government, said government is not necessarily effective to the same degree.

  4. unnetuse – Unlike the previous 2 variables, this one is scaled as a percentage of each country’s total population, specifically the number of internet users per 100 people. This variable is more practically tangible; the values are calculated as a percentage, but since it’s also out of 100 people, it’s easy to conceptualize the 1st quantile value for instance: 5.25, which would be about 5 people per 100. On that note, the maximum value, 87.70, is indicative of a high percentage of internet users in a given state.

Hypothesis Testing, Analysis

I will start with some preliminary graphs/visualizations.

ggplot(data=world_filter, aes(x=unnetuse,y=confidence, color=regime_type3)) + geom_point() 
Warning: Removed 100 rows containing missing values (geom_point).

This scatterplot, which measures the relationship between internet usage and popular confidence in government, has no obvious relationship or correlation. The points are grouped by color based on regime type, but there is no notable increase or decrease in the points’ location as a variable increases or decreases. The vast majority of values are located in the middle of the graph.

ggplot(data=world_filter, aes(x=confidence,y=effectiveness, color=regime_type3)) + geom_point() 
Warning: Removed 99 rows containing missing values (geom_point).

While there still isn’t a traditional positive or negative relationship between ‘confidence’ and ‘effectiveness’, it is noteworthy that the majority of values are in the center of the graph. They have a wide range, but they are mostly within 25 and 75 on the x-axis, which does make sense giving that the 1st and 3rd quantiles are included in the initial summary statistics.

ggplot(world_filter, aes(x=unnetuse,y=confidence,color=regime_type3)) + geom_point() + stat_smooth(method="lm",col="blue")
`geom_smooth()` using formula 'y ~ x'
Warning: Removed 100 rows containing non-finite values (stat_smooth).
Warning: Removed 100 rows containing missing values (geom_point).

This visualization is a recreation of the first scatterplot, but with a multiple regression line. The line, at first glance, is straight, but upon closer inspection it ever so slightly slopes down toward the right. This indicates a slightly negative relationship between internet usage (x) and confidence in government institutions (y).

ggplot(world_filter, aes(x=unnetuse,y=effectiveness,color=regime_type3)) + geom_point() + stat_smooth(method="lm",col="blue")
`geom_smooth()` using formula 'y ~ x'
Warning: Removed 15 rows containing non-finite values (stat_smooth).
Warning: Removed 15 rows containing missing values (geom_point).

The above scatterplot, however, depicts a very clear positive relationship between variables ‘unnetuse’ (x) and ‘effectiveness’ (y). This is indicative of a strong relationship between internet use and government effectiveness. There is what appears to be a heavier concentration of points below 50 on the x-axis, but the general trend is pretty clear that government effectiveness increases as nationals’ internet use does. Although ‘unnetuse’ comes from a 2008 survey, I would argue that this trend still holds up; especially due to COVID-19, the main way that politicians engage with their constituents is on the internet (social media). There is not really a culture of “visit your politician and talk to them” culture anymore, the new norm is for sucht things to be done over the phone, over email, or in some form, over the internet.

My next step is to go into modeling. I’m going to start with a linear regression model. ‘confidence’ is the dependent variable, and ‘unnetuse’, ‘effectiveness’, and ‘regime_type3’ are all independent.

confidence_lm <- lm(confidence~unnetuse+effectiveness+regime_type3, data=world_filter)
confidence_lm

Call:
lm(formula = confidence ~ unnetuse + effectiveness + regime_type3, 
    data = world_filter)

Coefficients:
                    (Intercept)                         unnetuse  
                        43.0725                          -0.5805  
                  effectiveness  regime_type3Parliamentary democ  
                         0.7574                         -15.4561  
 regime_type3Presidential democ  
                       -19.0101  

And here is a visualization of the above values.

plot(fitted(confidence_lm))
abline(h=50, lty=2)

summary(confidence_lm)

Call:
lm(formula = confidence ~ unnetuse + effectiveness + regime_type3, 
    data = world_filter)

Residuals:
    Min      1Q  Median      3Q     Max 
-49.097  -6.527   0.075   7.993  40.399 

Coefficients:
                                Estimate Std. Error t value Pr(>|t|)    
(Intercept)                      43.0725     5.6175   7.668 4.82e-10 ***
unnetuse                         -0.5805     0.1561  -3.719 0.000498 ***
effectiveness                     0.7574     0.1700   4.455 4.61e-05 ***
regime_type3Parliamentary democ -15.4561     6.3577  -2.431 0.018608 *  
regime_type3Presidential democ  -19.0101     6.1730  -3.080 0.003336 ** 
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Residual standard error: 15.37 on 51 degrees of freedom
  (111 observations deleted due to missingness)
Multiple R-squared:  0.3376,    Adjusted R-squared:  0.2856 
F-statistic: 6.497 on 4 and 51 DF,  p-value: 0.0002642

I’m honestly not entirely sure what these values mean, but I input what I had into the function and I got results.

AIC(confidence_lm)
[1] 471.6936
BIC(confidence_lm)
[1] 483.8457