-
Notifications
You must be signed in to change notification settings - Fork 0
/
Empirical analysis - Coupled Catastrophes - share on Github.nb
15718 lines (15203 loc) · 614 KB
/
Empirical analysis - Coupled Catastrophes - share on Github.nb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
(* Content-type: application/vnd.wolfram.mathematica *)
(*** Wolfram Notebook File ***)
(* http://www.wolfram.com/nb *)
(* CreatedBy='Mathematica 10.4' *)
(*CacheID: 234*)
(* Internal cache information:
NotebookFileLineBreakTest
NotebookFileLineBreakTest
NotebookDataPosition[ 158, 7]
NotebookDataLength[ 628163, 15710]
NotebookOptionsPosition[ 607802, 15037]
NotebookOutlinePosition[ 608160, 15053]
CellTagsIndexPosition[ 608117, 15050]
WindowFrame->Normal*)
(* Beginning of Notebook Content *)
Notebook[{
Cell[CellGroupData[{
Cell["\<\
Coupled catastrophes: sudden shifts cascade and hop among interdependent \
systems\
\>", "Title",
CellChangeTimes->{{3.6686115627618513`*^9, 3.668611579185033*^9}}],
Cell[CellGroupData[{
Cell["Charles D. Brummitt, George Barnett, Raissa M. \
D\[CloseCurlyQuote]Souza", "Chapter",
CellChangeTimes->{{3.668611582705346*^9, 3.668611598459258*^9}}],
Cell[CellGroupData[{
Cell["About this document", "Section",
CellChangeTimes->{{3.668611669534007*^9, 3.668611671573916*^9}}],
Cell["\<\
This document provides the code used to make the figures for the empirical \
data in the open access paper \
\>", "Text",
CellChangeTimes->{{3.668611608340171*^9, 3.66861166053407*^9}, {
3.668613745720118*^9, 3.668613755428829*^9}, {3.6686838572024117`*^9,
3.668683860752387*^9}}],
Cell[TextData[{
"Brummitt, C. D., Barnett, G., & D\[CloseCurlyQuote]Souza, R. M. (2015). ",
StyleBox["Coupled catastrophes: sudden shifts cascade and hop among \
interdependent systems",
FontWeight->"Bold"],
". ",
StyleBox["Journal of the Royal Society Interface",
FontSlant->"Italic"],
", 12(112), 20150712. ",
ButtonBox["http://doi.org/10.1098/rsif.2015.0712",
BaseStyle->"Hyperlink",
ButtonData->{
URL["http://doi.org/10.1098/rsif.2015.0712"], None},
ButtonNote->"http://doi.org/10.1098/rsif.2015.0712"]
}], "Text",
CellChangeTimes->{{3.668611630873197*^9, 3.66861164614281*^9}}],
Cell[CellGroupData[{
Cell["Contact information", "Subsection",
CellChangeTimes->{{3.6686116793028173`*^9, 3.668611681893882*^9}}],
Cell[TextData[{
"Charlie Brummitt: ",
ButtonBox["[email protected]",
BaseStyle->"Hyperlink",
ButtonData->{
URL["mailto:[email protected]"], None},
ButtonNote->"mailto:[email protected]"]
}], "Text",
CellChangeTimes->{{3.668611665638721*^9, 3.6686117213550453`*^9}}]
}, Open ]]
}, Open ]],
Cell[CellGroupData[{
Cell["Facebook graph among countries involved in the Arab Spring", "Section",
CellChangeTimes->{{3.668683830077209*^9, 3.6686838304684772`*^9}, {
3.66868386818503*^9, 3.668683884319744*^9}}],
Cell[CellGroupData[{
Cell["Data", "Subsection",
CellChangeTimes->{{3.6686841019463587`*^9, 3.668684102432086*^9}}],
Cell[CellGroupData[{
Cell["Facebook 2012 data", "Subsubsection",
CellChangeTimes->{{3.66868619179561*^9, 3.668686197937648*^9}}],
Cell["We scraped data from the Facebook blog:", "Text",
CellChangeTimes->{{3.668686339496911*^9, 3.6686863852435427`*^9}}],
Cell[TextData[{
"\tNewman M. 2012 ",
StyleBox["Interactive: mapping the world\[CloseCurlyQuote]s friendships",
FontWeight->"Bold"],
". ",
ButtonBox["http://www.facebookstories.com/ stories/1574/",
BaseStyle->"Hyperlink",
ButtonData->{
URL["http://www.facebookstories.com/ stories/1574/"], None},
ButtonNote->"http://www.facebookstories.com/ stories/1574/"],
" (accessed 17 March 2014)."
}], "Text",
CellChangeTimes->{{3.668686387276204*^9, 3.6686863887158737`*^9}}],
Cell["Import the raw data:", "Text",
CellChangeTimes->{{3.668686266242929*^9, 3.6686862686185627`*^9}}],
Cell[BoxData[
RowBox[{
RowBox[{"FacebookRawData", "=",
RowBox[{"Import", "[",
RowBox[{"FileNameJoin", "[",
RowBox[{"{",
RowBox[{
RowBox[{"NotebookDirectory", "[", "]"}], ",", "\"\<data\>\"", ",",
"\"\<Facebook_Friends_dirty.xlsx\>\""}], "}"}], "]"}], "]"}]}],
";"}]], "Input",
InitializationCell->True,
CellChangeTimes->{{3.611333849297422*^9, 3.611333880767188*^9}, {
3.6686865072396803`*^9, 3.668686508157213*^9}}],
Cell["List of all countries in the Facebook data:", "Text",
CellChangeTimes->{{3.6686865288613367`*^9, 3.668686535756822*^9}}],
Cell[BoxData[
RowBox[{
RowBox[{"countries", "=",
RowBox[{"Rest", "[",
RowBox[{"FacebookRawData", "\[LeftDoubleBracket]",
RowBox[{"1", ",", "1"}], "\[RightDoubleBracket]"}], "]"}]}],
";"}]], "Input",
InitializationCell->True],
Cell["Convert this raw data to a list of directed edges:", "Text",
CellChangeTimes->{{3.668686271114931*^9, 3.668686277002599*^9}}],
Cell[BoxData[
RowBox[{
RowBox[{"FacebookRawEdgeList", "=",
RowBox[{
RowBox[{"(",
RowBox[{
RowBox[{
RowBox[{
RowBox[{"Property", "[",
RowBox[{
RowBox[{
RowBox[{"First", "[", "#", "]"}], "\[DirectedEdge]",
RowBox[{"#", "\[LeftDoubleBracket]",
RowBox[{"2", ",", "1"}], "\[RightDoubleBracket]"}]}], ",",
RowBox[{"EdgeWeight", "\[Rule]",
RowBox[{"#", "\[LeftDoubleBracket]",
RowBox[{"2", ",", "2"}], "\[RightDoubleBracket]"}]}]}], "]"}],
"&"}], "/@",
RowBox[{"Transpose", "[",
RowBox[{"{",
RowBox[{
RowBox[{"Table", "[",
RowBox[{
RowBox[{"First", "[", "#", "]"}], ",",
RowBox[{"{",
RowBox[{"Length", "[",
RowBox[{"Last", "[", "#", "]"}], "]"}], "}"}]}], "]"}], ",",
RowBox[{"Last", "[", "#", "]"}]}], "}"}], "]"}]}], "&"}], ")"}], "/@",
"\[IndentingNewLine]",
RowBox[{"(",
RowBox[{
RowBox[{
RowBox[{"{",
RowBox[{
RowBox[{"First", "[", "#", "]"}], ",",
RowBox[{"Select", "[",
RowBox[{
RowBox[{"Transpose", "[",
RowBox[{"{",
RowBox[{"countries", ",",
RowBox[{"Rest", "[", "#", "]"}]}], "}"}], "]"}], ",",
RowBox[{
RowBox[{
RowBox[{"Last", "[", "#", "]"}], "\[NotEqual]", "\"\<\>\""}],
"&"}]}], "]"}]}], "}"}], "&"}], "/@",
RowBox[{"FacebookRawData", "\[LeftDoubleBracket]",
RowBox[{"1", ",",
RowBox[{"2", ";;",
RowBox[{"-", "1"}]}]}], "\[RightDoubleBracket]"}]}], ")"}]}]}],
";"}]], "Input",
InitializationCell->True,
CellChangeTimes->{{3.61133474812041*^9, 3.611334844046793*^9}}],
Cell["\<\
Flatten the list of edges and reverse those edges so that the arrows indicate \
direction of influence (so that A \[DirectedEdge] B means that A is on B\
\[CloseCurlyQuote]s top-five list of countries to which it has the most \
cross-border friendships): \
\>", "Text",
CellChangeTimes->{{3.668686402451612*^9, 3.6686864737411747`*^9}, {
3.668687614240893*^9, 3.66868762196109*^9}}],
Cell[BoxData[
RowBox[{
RowBox[{"FacebookRawEdgeListReversed", "=",
RowBox[{
RowBox[{"Flatten", "[",
RowBox[{"FacebookRawEdgeList", ",", "1"}], "]"}], "/.",
RowBox[{"{",
RowBox[{
RowBox[{"Property", "[",
RowBox[{
RowBox[{"x_", "\[DirectedEdge]", "y_"}], ",",
RowBox[{"EdgeWeight", "\[Rule]", "w_"}]}], "]"}], "->",
RowBox[{"Property", "[",
RowBox[{
RowBox[{"y", "\[DirectedEdge]", "x"}], ",",
RowBox[{"EdgeWeight", "\[Rule]", "w"}]}], "]"}]}], "}"}]}]}],
";"}]], "Input",
InitializationCell->True,
CellChangeTimes->{{3.612885665564355*^9, 3.612885700915373*^9}, {
3.6128859751825666`*^9, 3.612885977404683*^9}}]
}, Closed]],
Cell[CellGroupData[{
Cell["dates of protests", "Subsubsection",
CellChangeTimes->{{3.668684114734438*^9, 3.6686841519497547`*^9}, {
3.6686853532355213`*^9, 3.668685354409186*^9}, 3.668685854252679*^9}],
Cell[TextData[{
"See ",
ButtonBox["http://en. wikipedia.org/wiki/Arab_Spring#Summary _of _ \
conflicts_by _country",
BaseStyle->"Hyperlink",
ButtonData->{
URL["http://en. wikipedia.org/wiki/Arab_Spring#Summary_of_ \
conflicts_by_country"], None},
ButtonNote->
"http://en. wikipedia.org/wiki/Arab_Spring#Summary_of_ \
conflicts_by_country"],
" (accessed May 14, 2014)."
}], "Text",
CellChangeTimes->{{3.668684171540766*^9, 3.668684182461321*^9}}],
Cell[BoxData[{
RowBox[{
RowBox[{"datesOfProtests", "=",
RowBox[{"Map", "[",
RowBox[{
RowBox[{
RowBox[{"{",
RowBox[{
RowBox[{"#", "\[LeftDoubleBracket]", "1", "\[RightDoubleBracket]"}],
",",
RowBox[{"If", "[",
RowBox[{
RowBox[{
RowBox[{
"#", "\[LeftDoubleBracket]", "2", "\[RightDoubleBracket]"}], "===",
"None"}], ",",
RowBox[{"#", "\[LeftDoubleBracket]", "2", "\[RightDoubleBracket]"}],
",",
RowBox[{"DateList", "[",
RowBox[{
"#", "\[LeftDoubleBracket]", "2", "\[RightDoubleBracket]"}],
"]"}]}], "]"}], ",",
RowBox[{"If", "[",
RowBox[{
RowBox[{
RowBox[{
"#", "\[LeftDoubleBracket]", "2", "\[RightDoubleBracket]"}], "===",
"None"}], ",",
RowBox[{"#", "\[LeftDoubleBracket]", "2", "\[RightDoubleBracket]"}],
",",
RowBox[{"AbsoluteTime", "@",
RowBox[{"DateList", "[",
RowBox[{
"#", "\[LeftDoubleBracket]", "2", "\[RightDoubleBracket]"}],
"]"}]}]}], "]"}]}], "}"}], "&"}], ",",
RowBox[{"{",
RowBox[{
RowBox[{"{",
RowBox[{"\"\<Tunisia\>\"", ",", "\"\<18 December 2010\>\""}], "}"}],
",",
RowBox[{"{",
RowBox[{"\"\<Algeria\>\"", ",", "\"\<29 December 2010\>\""}], "}"}],
",",
RowBox[{"{",
RowBox[{"\"\<Jordan\>\"", ",", "\"\<14 January 2011\>\""}], "}"}],
",",
RowBox[{"{",
RowBox[{"\"\<Oman\>\"", ",", "\"\<17 January 2011\>\""}], "}"}], ",",
RowBox[{"{",
RowBox[{"\"\<Egypt\>\"", ",", "\"\<25 January 2011\>\""}], "}"}], ",",
RowBox[{"{",
RowBox[{"\"\<Yemen\>\"", ",", "\"\<27 January 2011\>\""}], "}"}], ",",
RowBox[{"{",
RowBox[{"\"\<Bahrain\>\"", ",", "\"\<14 February 2011\>\""}], "}"}],
",",
RowBox[{"{",
RowBox[{"\"\<Libya\>\"", ",", "\"\<17 February 2011\>\""}], "}"}],
",",
RowBox[{"{",
RowBox[{"\"\<Syria\>\"", ",", "\"\<11 March 2011\>\""}], "}"}], ",",
RowBox[{"{",
RowBox[{"\"\<Saudi Arabia\>\"", ",", "\"\<15 March 2011\>\""}], "}"}],
",",
RowBox[{"{",
RowBox[{"\"\<Albania\>\"", ",", "None"}], "}"}], ",",
RowBox[{"{",
RowBox[{"\"\<Iran\>\"", ",", "None"}], "}"}], ",",
RowBox[{"{",
RowBox[{"\"\<Qatar\>\"", ",", "None"}], "}"}], ",",
RowBox[{"{",
RowBox[{"\"\<United Arab Emirates\>\"", ",", "None"}], "}"}], ",",
RowBox[{"{",
RowBox[{"\"\<Djibouti\>\"", ",", "\"\<28 January 2011\>\""}], "}"}],
",",
RowBox[{"{",
RowBox[{"\"\<Iraq\>\"", ",", "\"\<23 December 2012\>\""}], "}"}], ",",
RowBox[{"{",
RowBox[{"\"\<Israel\>\"", ",", "\"\<15 May 2011\>\""}], "}"}], ",",
RowBox[{"{",
RowBox[{"\"\<Kuwait\>\"", ",", "\"\<19 February 2011\>\""}], "}"}],
",",
RowBox[{"{",
RowBox[{"\"\<Mauritania\>\"", ",", "\"\<25 February 2011\>\""}],
"}"}], ",",
RowBox[{"{",
RowBox[{"\"\<Morocco\>\"", ",", "\"\<20 February 2011\>\""}], "}"}],
",",
RowBox[{"{",
RowBox[{
"\"\<Palestinian Territory\>\"", ",", "\"\<4 September 2012\>\""}],
"}"}], ",",
RowBox[{"{",
RowBox[{"\"\<Somalia\>\"", ",", "\"\<28 January 2011\>\""}], "}"}],
",",
RowBox[{"{",
RowBox[{"\"\<Sudan\>\"", ",", "\"\<30 January 2011\>\""}], "}"}], ",",
RowBox[{"{",
RowBox[{"\"\<Lebanon\>\"", ",", "\"\<27 February 2011\>\""}], "}"}]}],
"}"}]}], "]"}]}], ";"}], "\[IndentingNewLine]",
RowBox[{
RowBox[{"datesOfProtestsRules", "=",
RowBox[{
RowBox[{"(",
RowBox[{
RowBox[{
RowBox[{"First", "[", "#", "]"}], "\[Rule]",
RowBox[{"Part", "[",
RowBox[{"#", ",", "2"}], "]"}]}], "&"}], ")"}], "/@",
"datesOfProtests"}]}], ";"}], "\[IndentingNewLine]",
RowBox[{
RowBox[{"datesOfProtestsAssociation", "=",
RowBox[{"Association", "[", "datesOfProtestsRules", "]"}]}],
";"}]}], "Input",
InitializationCell->True,
CellChangeTimes->{{3.611335617629999*^9, 3.611335687434569*^9}, {
3.611335717897855*^9, 3.611335732696842*^9}, {3.6113357806870604`*^9,
3.6113357821829863`*^9}, {3.6113358348323603`*^9, 3.611336022616294*^9},
3.611336058914494*^9, {3.6113361753678417`*^9, 3.611336179677698*^9}, {
3.611338958229265*^9, 3.611338964630192*^9}, {3.612035816017919*^9,
3.6120358244910383`*^9}, {3.668686042381062*^9, 3.6686860426216497`*^9}}],
Cell[BoxData[{
RowBox[{
RowBox[{"countriesWithProtests", "=",
RowBox[{"Sort", "[",
RowBox[{"First", "/@",
RowBox[{"Select", "[",
RowBox[{"datesOfProtests", ",",
RowBox[{
RowBox[{
RowBox[{"Last", "[", "#", "]"}], "=!=", "None"}], "&"}]}], "]"}]}],
"]"}]}], ";"}], "\[IndentingNewLine]",
RowBox[{
RowBox[{"countriesThatDidNotProtest", "=",
RowBox[{"Complement", "[",
RowBox[{"countries", ",",
RowBox[{"First", "/@", "datesOfProtests"}]}], "]"}]}], ";"}]}], "Input",
InitializationCell->True,
CellChangeTimes->{{3.668684197824703*^9, 3.6686842004546423`*^9},
3.668684496580759*^9, {3.668686164380478*^9, 3.668686165403132*^9}}],
Cell["\<\
Rescale these protest dates so that we can easily plot them on a horizontal \
axis:\
\>", "Text",
CellChangeTimes->{{3.668684289310018*^9, 3.668684321477295*^9}}],
Cell[BoxData[
RowBox[{
RowBox[{"rescaledProtestOutbreakDatesRules", "=",
RowBox[{
RowBox[{
RowBox[{"(",
RowBox[{"Rule", "@@", "#"}], ")"}], "&"}], "/@",
RowBox[{"(",
RowBox[{
RowBox[{
RowBox[{"{",
RowBox[{
RowBox[{"First", "[", "#", "]"}], ",",
FractionBox[
RowBox[{
RowBox[{"N", "@",
RowBox[{"Last", "[", "#", "]"}]}], "-",
RowBox[{"Min", "[",
RowBox[{"Last", "/@",
RowBox[{"Select", "[",
RowBox[{"datesOfProtests", ",",
RowBox[{
RowBox[{
RowBox[{"Last", "[", "#", "]"}], "=!=", "None"}], "&"}]}],
"]"}]}], "]"}]}],
RowBox[{
RowBox[{
RowBox[{"(",
RowBox[{
RowBox[{"Max", "[", "#", "]"}], "-",
RowBox[{"Min", "[", "#", "]"}]}], ")"}], "&"}], "[",
RowBox[{"Last", "/@",
RowBox[{"Select", "[",
RowBox[{"datesOfProtests", ",",
RowBox[{
RowBox[{
RowBox[{"Last", "[", "#", "]"}], "=!=", "None"}], "&"}]}],
"]"}]}], "]"}]]}], "}"}], "&"}], "/@",
RowBox[{"Select", "[",
RowBox[{"datesOfProtests", ",",
RowBox[{
RowBox[{
RowBox[{"Last", "[", "#", "]"}], "=!=", "None"}], "&"}]}], "]"}]}],
")"}]}]}], ";"}]], "Input",
InitializationCell->True,
CellChangeTimes->{{3.611339140077496*^9, 3.61133925151866*^9}, {
3.6686843371915503`*^9, 3.66868434125594*^9}, 3.668684506703024*^9, {
3.66868794350049*^9, 3.668687948261945*^9}}],
Cell["\<\
We may consider also showing other countries that could have played a role in \
propagating influence to protest but did not have protests according to \
Wikipedia:\
\>", "Text",
CellChangeTimes->{{3.668684348231801*^9, 3.6686843721970367`*^9}}],
Cell[BoxData[
RowBox[{
RowBox[{"rescaledProtestOutbreakDatesRulesAll", "=",
RowBox[{"rescaledProtestOutbreakDatesRules", "~", "Join", "~",
RowBox[{"{",
RowBox[{
RowBox[{"\"\<Albania\>\"", "\[Rule]", "2."}], ",",
RowBox[{"\"\<Iran\>\"", "\[Rule]", "2."}], ",",
RowBox[{"\"\<United Arab Emirates\>\"", "\[Rule]", "2."}], ",",
RowBox[{"\"\<Qatar\>\"", "\[Rule]", "2."}]}], "}"}]}]}], ";"}]], "Input",\
InitializationCell->True,
CellChangeTimes->{{3.611339579471554*^9, 3.611339595930435*^9},
3.611347070357983*^9, {3.612035646538579*^9, 3.6120356643921757`*^9}, {
3.612036349174396*^9, 3.612036358630322*^9}}],
Cell[BoxData[
RowBox[{
RowBox[{"countriesInvolvedInArabSpring", "=",
RowBox[{"{",
RowBox[{
"\"\<Albania\>\"", ",", "\"\<Algeria\>\"", ",", "\"\<Bahrain\>\"", ",",
"\"\<Djibouti\>\"", ",", "\"\<Egypt\>\"", ",", "\"\<Iran\>\"", ",",
"\"\<Iraq\>\"", ",", "\"\<Israel\>\"", ",", "\"\<Jordan\>\"", ",",
"\"\<Kuwait\>\"", ",", "\"\<Lebanon\>\"", ",", "\"\<Libya\>\"", ",",
"\"\<Mauritania\>\"", ",", "\"\<Morocco\>\"", ",", "\"\<Oman\>\"", ",",
"\"\<Palestinian Territory\>\"", ",", "\"\<Saudi Arabia\>\"", ",",
"\"\<Somalia\>\"", ",", "\"\<Sudan\>\"", ",", "\"\<Syria\>\"", ",",
"\"\<Tunisia\>\"", ",", "\"\<Yemen\>\"", ",",
"\"\<United Arab Emirates\>\"", ",", "\"\<Qatar\>\""}], "}"}]}],
";"}]], "Input",
InitializationCell->True]
}, Closed]],
Cell[CellGroupData[{
Cell["unemployment data from the World Bank", "Subsubsection",
CellChangeTimes->{{3.609693952470006*^9, 3.6096939611809063`*^9}, {
3.611336815651071*^9, 3.611336816882916*^9}}],
Cell[TextData[{
"Source: The World Bank, 2010. ",
ButtonBox["http://data.worldbank.org",
BaseStyle->"Hyperlink",
ButtonData->{
URL["http://data.worldbank.org"], None},
ButtonNote->"http://data.worldbank.org"],
". (accessed 14 May 2014)."
}], "Text",
CellChangeTimes->{{3.6686851550358543`*^9, 3.668685178617371*^9}}],
Cell[BoxData[
RowBox[{
RowBox[{"convertWorldBankCountryNamesToFacebookNames", "=",
RowBox[{"{",
RowBox[{
RowBox[{"\"\<Syrian Arab Republic\>\"", "\[Rule]", "\"\<Syria\>\""}],
",",
RowBox[{"\"\<Egypt, Arab Rep.\>\"", "->", "\"\<Egypt\>\""}], ",",
RowBox[{"\"\<Yemen, Rep.\>\"", "\[Rule]", "\"\<Yemen\>\""}], ",",
RowBox[{
"\"\<West Bank and Gaza\>\"", "\[Rule]",
"\"\<Palestinian Territory\>\""}], ",",
RowBox[{"\"\<Iran, Islamic Rep.\>\"", "\[Rule]", "\"\<Iran\>\""}]}],
"}"}]}], ";"}]], "Input",
InitializationCell->True,
CellChangeTimes->{{3.6113363120355167`*^9, 3.61133637191632*^9}, {
3.611336968240851*^9, 3.6113369804770193`*^9}, 3.61133702758941*^9, {
3.61133739371351*^9, 3.611337422006727*^9}}],
Cell[BoxData[
RowBox[{
RowBox[{"actualUnemploymentData", "=",
RowBox[{"Import", "[",
RowBox[{"FileNameJoin", "[",
RowBox[{"{",
RowBox[{
RowBox[{"NotebookDirectory", "[", "]"}], ",", "\"\<data\>\"", ",",
"\"\<sl.uem.totl.zs_Indicator_en_csv_v2\>\"", ",",
"\"\<sl.uem.totl.zs_Indicator_en_csv_v2.csv\>\""}], "}"}], "]"}],
"]"}]}], ";"}]], "Input",
InitializationCell->True,
CellChangeTimes->{{3.609694036833164*^9, 3.6096940805262337`*^9}, {
3.668684648820941*^9, 3.668684649884479*^9}}],
Cell[BoxData[
RowBox[{
RowBox[{"unemploymentRatioIn2010", "=",
RowBox[{
RowBox[{
RowBox[{"{",
RowBox[{
RowBox[{"First", "[", "#", "]"}], ",",
RowBox[{"#", "\[LeftDoubleBracket]",
RowBox[{"-", "5"}], "\[RightDoubleBracket]"}]}], "}"}], "&"}], "/@",
RowBox[{"actualUnemploymentData", "\[LeftDoubleBracket]",
RowBox[{"4", ";;",
RowBox[{"-", "1"}]}], "\[RightDoubleBracket]"}]}]}], ";"}]], "Input",
InitializationCell->True,
CellChangeTimes->{{3.609694104472714*^9, 3.609694105772791*^9},
3.60969422845219*^9}],
Cell[CellGroupData[{
Cell[BoxData[
RowBox[{"unemploymentRatioIn2010ForCountriesInvolvedInArabSpringRules", "=",
RowBox[{
RowBox[{
RowBox[{"Rule", "@@", "#"}], "&"}], "/@",
RowBox[{"Select", "[",
RowBox[{
RowBox[{
"unemploymentRatioIn2010", "/.",
"convertWorldBankCountryNamesToFacebookNames"}], ",", " ",
RowBox[{
RowBox[{"MemberQ", "[",
RowBox[{"countriesInvolvedInArabSpring", ",",
RowBox[{"First", "[", "#", "]"}]}], "]"}], "&"}]}], "]"}],
RowBox[{"(*",
RowBox[{"~", "Join", "~",
RowBox[{"{",
RowBox[{"{",
RowBox[{"\"\<Palestinian Territory\>\"", ",", "24."}], "}"}], "}"}]}],
"*)"}]}]}]], "Input",
InitializationCell->True,
CellChangeTimes->{{3.611336595923449*^9, 3.6113366259126263`*^9}, {
3.611336755632152*^9, 3.6113367648450727`*^9}, 3.611337034547412*^9,
3.61133709524431*^9, 3.668684784914686*^9}],
Cell[BoxData[
RowBox[{"{",
RowBox[{
RowBox[{"\<\"Albania\"\>", "\[Rule]", "14.1999998092651`"}], ",",
RowBox[{"\<\"United Arab Emirates\"\>", "\[Rule]", "4"}], ",",
RowBox[{"\<\"Bahrain\"\>", "\[Rule]", "7.5`"}], ",",
RowBox[{"\<\"Djibouti\"\>", "\[Rule]", "\<\"\"\>"}], ",",
RowBox[{"\<\"Algeria\"\>", "\[Rule]", "10"}], ",",
RowBox[{"\<\"Egypt\"\>", "\[Rule]", "9"}], ",",
RowBox[{"\<\"Iran\"\>", "\[Rule]", "13.5`"}], ",",
RowBox[{"\<\"Iraq\"\>", "\[Rule]", "15.1999998092651`"}], ",",
RowBox[{"\<\"Israel\"\>", "\[Rule]", "6.59999990463257`"}], ",",
RowBox[{"\<\"Jordan\"\>", "\[Rule]", "12.5`"}], ",",
RowBox[{"\<\"Kuwait\"\>", "\[Rule]", "1.60000002384186`"}], ",",
RowBox[{"\<\"Lebanon\"\>", "\[Rule]", "8.89999961853027`"}], ",",
RowBox[{"\<\"Libya\"\>", "\[Rule]", "8.60000038146973`"}], ",",
RowBox[{"\<\"Morocco\"\>", "\[Rule]", "9.10000038146973`"}], ",",
RowBox[{"\<\"Mauritania\"\>", "\[Rule]", "31.1000003814697`"}], ",",
RowBox[{"\<\"Oman\"\>", "\[Rule]", "8.30000019073486`"}], ",",
RowBox[{"\<\"Qatar\"\>", "\[Rule]", "0.400000005960464`"}], ",",
RowBox[{"\<\"Saudi Arabia\"\>", "\[Rule]", "5.5`"}], ",",
RowBox[{"\<\"Sudan\"\>", "\[Rule]", "14.8000001907349`"}], ",",
RowBox[{"\<\"Somalia\"\>", "\[Rule]", "7.59999990463257`"}], ",",
RowBox[{"\<\"Syria\"\>", "\[Rule]", "8.39999961853027`"}], ",",
RowBox[{"\<\"Tunisia\"\>", "\[Rule]", "13"}], ",",
RowBox[{"\<\"Palestinian Territory\"\>", "\[Rule]", "23.7000007629395`"}],
",",
RowBox[{"\<\"Yemen\"\>", "\[Rule]", "17.7999992370605`"}]}],
"}"}]], "Output",
CellChangeTimes->{
3.611336596928575*^9, 3.61133662754146*^9, 3.611336766201653*^9,
3.6113369934430513`*^9, 3.611337035496533*^9, 3.6113370958270073`*^9, {
3.611337404487323*^9, 3.61133742331885*^9}, 3.6113378484180737`*^9,
3.61134987016925*^9, 3.6113499187803164`*^9, 3.611350090416429*^9,
3.6113503912809067`*^9, 3.611350725400773*^9, 3.61203585669366*^9,
3.612545043980413*^9, 3.612549704824183*^9, 3.615666513958194*^9,
3.618896159361145*^9, 3.619155088332662*^9, 3.619239861545795*^9,
3.619329779796962*^9, 3.619341961315382*^9, 3.6195248035243883`*^9,
3.619774601428692*^9, 3.622275182695153*^9, 3.622461816003312*^9,
3.6362091457167883`*^9, 3.637344949364976*^9, 3.641660032751227*^9,
3.646625245205374*^9, 3.668684738714321*^9, 3.668684786114143*^9,
3.6686875910377903`*^9, {3.668687649325387*^9, 3.668687670525137*^9}}]
}, Open ]],
Cell[TextData[{
"Djbouti had 54% unemployment in 2010. Citation: ",
ButtonBox["http://www.tradingeconomics.com/djibouti/unemployment-rate",
BaseStyle->"Hyperlink",
ButtonData->{
URL["http://www.tradingeconomics.com/djibouti/unemployment-rate"], None},
ButtonNote->"http://www.tradingeconomics.com/djibouti/unemployment-rate"]
}], "Text",
CellChangeTimes->{{3.611350712952518*^9, 3.611350722897146*^9}, {
3.6686847571486177`*^9, 3.668684768050089*^9}}],
Cell[CellGroupData[{
Cell[BoxData[
RowBox[{"unemploymentRatioIn2010ForCountriesInvolvedInArabSpringRules", "=",
RowBox[{
RowBox[{
RowBox[{"(",
RowBox[{"Rule", "@@", "#"}], ")"}], "&"}], "/@",
RowBox[{"ReplacePart", "[",
RowBox[{
RowBox[{"Select", "[",
RowBox[{
RowBox[{
"unemploymentRatioIn2010", "/.",
"convertWorldBankCountryNamesToFacebookNames"}], ",", " ",
RowBox[{
RowBox[{"MemberQ", "[",
RowBox[{"countriesInvolvedInArabSpring", ",",
RowBox[{"First", "[", "#", "]"}]}], "]"}], "&"}]}], "]"}], ",",
RowBox[{
RowBox[{"{",
RowBox[{"4", ",", "2"}], "}"}], "\[Rule]", " ", "54."}]}],
"]"}]}]}]], "Input",
InitializationCell->True,
CellChangeTimes->{{3.611350741113285*^9, 3.611350763849539*^9}, {
3.6125498016187143`*^9, 3.612549809586273*^9}, {3.668684809487965*^9,
3.668684817522221*^9}}],
Cell[BoxData[
RowBox[{"{",
RowBox[{
RowBox[{"\<\"Albania\"\>", "\[Rule]", "14.1999998092651`"}], ",",
RowBox[{"\<\"United Arab Emirates\"\>", "\[Rule]", "4"}], ",",
RowBox[{"\<\"Bahrain\"\>", "\[Rule]", "7.5`"}], ",",
RowBox[{"\<\"Djibouti\"\>", "\[Rule]", "54.`"}], ",",
RowBox[{"\<\"Algeria\"\>", "\[Rule]", "10"}], ",",
RowBox[{"\<\"Egypt\"\>", "\[Rule]", "9"}], ",",
RowBox[{"\<\"Iran\"\>", "\[Rule]", "13.5`"}], ",",
RowBox[{"\<\"Iraq\"\>", "\[Rule]", "15.1999998092651`"}], ",",
RowBox[{"\<\"Israel\"\>", "\[Rule]", "6.59999990463257`"}], ",",
RowBox[{"\<\"Jordan\"\>", "\[Rule]", "12.5`"}], ",",
RowBox[{"\<\"Kuwait\"\>", "\[Rule]", "1.60000002384186`"}], ",",
RowBox[{"\<\"Lebanon\"\>", "\[Rule]", "8.89999961853027`"}], ",",
RowBox[{"\<\"Libya\"\>", "\[Rule]", "8.60000038146973`"}], ",",
RowBox[{"\<\"Morocco\"\>", "\[Rule]", "9.10000038146973`"}], ",",
RowBox[{"\<\"Mauritania\"\>", "\[Rule]", "31.1000003814697`"}], ",",
RowBox[{"\<\"Oman\"\>", "\[Rule]", "8.30000019073486`"}], ",",
RowBox[{"\<\"Qatar\"\>", "\[Rule]", "0.400000005960464`"}], ",",
RowBox[{"\<\"Saudi Arabia\"\>", "\[Rule]", "5.5`"}], ",",
RowBox[{"\<\"Sudan\"\>", "\[Rule]", "14.8000001907349`"}], ",",
RowBox[{"\<\"Somalia\"\>", "\[Rule]", "7.59999990463257`"}], ",",
RowBox[{"\<\"Syria\"\>", "\[Rule]", "8.39999961853027`"}], ",",
RowBox[{"\<\"Tunisia\"\>", "\[Rule]", "13"}], ",",
RowBox[{"\<\"Palestinian Territory\"\>", "\[Rule]", "23.7000007629395`"}],
",",
RowBox[{"\<\"Yemen\"\>", "\[Rule]", "17.7999992370605`"}]}],
"}"}]], "Output",
CellChangeTimes->{
3.61135076419915*^9, 3.6120036174278193`*^9, 3.612014665693643*^9,
3.6120358599103394`*^9, 3.612549716465963*^9, {3.6125498020075397`*^9,
3.612549809879961*^9}, {3.668684793870812*^9, 3.668684818317677*^9},
3.668687591109932*^9, {3.668687649371117*^9, 3.668687670546751*^9}}]
}, Open ]],
Cell[CellGroupData[{
Cell[BoxData[
RowBox[{"Length", "@",
"unemploymentRatioIn2010ForCountriesInvolvedInArabSpring"}]], "Input",
CellChangeTimes->{{3.6113373517311153`*^9, 3.611337353396378*^9}}],
Cell[BoxData["0"], "Output",
CellChangeTimes->{
3.611337353735558*^9, 3.611337424469655*^9, 3.611337850203092*^9,
3.611350779656885*^9, 3.612035861293562*^9, {3.668687649420197*^9,
3.668687670589923*^9}}]
}, Open ]],
Cell[CellGroupData[{
Cell[BoxData[
RowBox[{"Length", "@", "countriesInvolvedInArabSpring"}]], "Input",
CellChangeTimes->{{3.6113373600781527`*^9, 3.611337361954256*^9}}],
Cell[BoxData["24"], "Output",
CellChangeTimes->{
3.611337362268998*^9, 3.6113378510886803`*^9, 3.612035861911106*^9, {
3.668687649471155*^9, 3.6686876706236353`*^9}}]
}, Open ]]
}, Closed]],
Cell[CellGroupData[{
Cell["\<\
income data from the World Bank: GDP per capita, PPP (constant 2011 \
international $)\
\>", "Subsubsection",
CellChangeTimes->{{3.611336806037672*^9, 3.611336810007545*^9}, {
3.612570976644788*^9, 3.612570977019189*^9}}],
Cell[TextData[{
"Source: The World Bank, 2010. ",
ButtonBox["http://data.worldbank.org",
BaseStyle->"Hyperlink",
ButtonData->{
URL["http://data.worldbank.org"], None},
ButtonNote->"http://data.worldbank.org"],
". (accessed 14 May 2014)."
}], "Text",
CellChangeTimes->{{3.6686851550358543`*^9, 3.668685178617371*^9}}],
Cell["File: ny.gdp.pcap.cd_Indicator_en_csv_v2", "Text",
CellChangeTimes->{
3.611337182345791*^9, {3.668684957932599*^9, 3.668684963747377*^9}}],
Cell[TextData[{
"GDP per capita in current USD: \n",
ButtonBox["http://data.worldbank.org/indicator/NY.GDP.PCAP.CD",
BaseStyle->"Hyperlink",
ButtonData->{
URL["http://data.worldbank.org/indicator/NY.GDP.PCAP.PP.KD"], None},
ButtonNote->"http://data.worldbank.org/indicator/NY.GDP.PCAP.PP.KD"]
}], "Text",
CellChangeTimes->{{3.611337197827055*^9, 3.61133720631562*^9}, {
3.6125710047369957`*^9, 3.612571004742199*^9}}],
Cell["\<\
Description: \[OpenCurlyDoubleQuote]GDP per capita based on purchasing power \
parity (PPP). PPP GDP is gross domestic product converted to international \
dollars using purchasing power parity rates. An international dollar has the \
same purchasing power over GDP as the U.S. dollar has in the United States. \
GDP at purchaser\[CloseCurlyQuote]s prices is the sum of gross value added by \
all resident producers in the economy plus any product taxes and minus any \
subsidies not included in the value of the products. It is calculated without \
making deductions for depreciation of fabricated assets or for depletion and \
degradation of natural resources. Data are in constant 2011 international \
dollars.\[CloseCurlyDoubleQuote]\
\>", "Text",
CellChangeTimes->{{3.612570988750988*^9, 3.6125709902100554`*^9}, {
3.668685193365415*^9, 3.66868520362645*^9}}],
Cell[BoxData[
RowBox[{
RowBox[{"gdpPerCapitaData", "=",
RowBox[{"Import", "[",
RowBox[{"FileNameJoin", "[",
RowBox[{"{",
RowBox[{
RowBox[{"NotebookDirectory", "[", "]"}], ",", "\"\<data\>\"", ",",
"\"\<ny.gdp.pcap.cd_Indicator_en_csv_v2\>\"", ",",
"\"\<ny.gdp.pcap.cd_Indicator_en_csv_v2.csv\>\""}], "}"}], "]"}],
"]"}]}], ";"}]], "Input",
InitializationCell->True,
CellChangeTimes->{{3.609694036833164*^9, 3.6096940805262337`*^9}, {
3.611337190022169*^9, 3.6113372346498747`*^9}, {3.668684967907393*^9,
3.6686849690435057`*^9}}],
Cell[BoxData[
RowBox[{
RowBox[{"gdpPerCapita2010", "=",
RowBox[{
RowBox[{
RowBox[{"{",
RowBox[{
RowBox[{"First", "[", "#", "]"}], ",",
RowBox[{"#", "\[LeftDoubleBracket]",
RowBox[{"-", "5"}], "\[RightDoubleBracket]"}]}], "}"}], "&"}], "/@",
RowBox[{"gdpPerCapitaData", "\[LeftDoubleBracket]",
RowBox[{"4", ";;",
RowBox[{"-", "1"}]}], "\[RightDoubleBracket]"}]}]}], ";"}]], "Input",
InitializationCell->True,
CellChangeTimes->{{3.609694104472714*^9, 3.609694105772791*^9},
3.60969422845219*^9, {3.611337243209848*^9, 3.611337250539225*^9}}],
Cell[CellGroupData[{
Cell[BoxData[
RowBox[{"gdpPerCapitaIn2010ForCountriesInvolvedInArabSpring", "=",
RowBox[{"Select", "[",
RowBox[{
RowBox[{
"gdpPerCapita2010", "/.", "convertWorldBankCountryNamesToFacebookNames"}],
",", " ",
RowBox[{
RowBox[{"MemberQ", "[",
RowBox[{"countriesInvolvedInArabSpring", ",",
RowBox[{"First", "[", "#", "]"}]}], "]"}], "&"}]}], "]"}]}]], "Input",
CellChangeTimes->{{3.611337328121996*^9, 3.611337340810543*^9}}],
Cell[BoxData[
RowBox[{"{",
RowBox[{
RowBox[{"{",
RowBox[{"\<\"Albania\"\>", ",", "3764.32634799148`"}], "}"}], ",",
RowBox[{"{",
RowBox[{"\<\"United Arab Emirates\"\>", ",", "34048.5173453316`"}], "}"}],
",",
RowBox[{"{",
RowBox[{"\<\"Bahrain\"\>", ",", "20545.9694536416`"}], "}"}], ",",
RowBox[{"{",
RowBox[{"\<\"Djibouti\"\>", ",", "\<\"\"\>"}], "}"}], ",",
RowBox[{"{",
RowBox[{"\<\"Algeria\"\>", ",", "4349.56932474256`"}], "}"}], ",",
RowBox[{"{",
RowBox[{"\<\"Egypt\"\>", ",", "2803.53296265274`"}], "}"}], ",",
RowBox[{"{",
RowBox[{"\<\"Iran\"\>", ",", "5674.92392735085`"}], "}"}], ",",
RowBox[{"{",
RowBox[{"\<\"Iraq\"\>", ",", "4612.52347575944`"}], "}"}], ",",
RowBox[{"{",
RowBox[{"\<\"Israel\"\>", ",", "30389.107581936`"}], "}"}], ",",
RowBox[{"{",
RowBox[{"\<\"Jordan\"\>", ",", "4370.72103318115`"}], "}"}], ",",
RowBox[{"{",
RowBox[{"\<\"Kuwait\"\>", ",", "40090.7462727442`"}], "}"}], ",",
RowBox[{"{",
RowBox[{"\<\"Lebanon\"\>", ",", "8551.85241627055`"}], "}"}], ",",
RowBox[{"{",
RowBox[{"\<\"Libya\"\>", ",", "\<\"\"\>"}], "}"}], ",",
RowBox[{"{",
RowBox[{"\<\"Morocco\"\>", ",", "2822.73373914854`"}], "}"}], ",",
RowBox[{"{",
RowBox[{"\<\"Mauritania\"\>", ",", "1017.16627752181`"}], "}"}], ",",
RowBox[{"{",
RowBox[{"\<\"Oman\"\>", ",", "20983.9003354042`"}], "}"}], ",",
RowBox[{"{",
RowBox[{"\<\"Qatar\"\>", ",", "72773.314202226`"}], "}"}], ",",
RowBox[{"{",
RowBox[{"\<\"Saudi Arabia\"\>", ",", "19326.5825548176`"}], "}"}], ",",
RowBox[{"{",
RowBox[{"\<\"Sudan\"\>", ",", "1422.3681025837`"}], "}"}], ",",
RowBox[{"{",
RowBox[{"\<\"Somalia\"\>", ",", "\<\"\"\>"}], "}"}], ",",
RowBox[{"{",
RowBox[{"\<\"Syria\"\>", ",", "\<\"\"\>"}], "}"}], ",",
RowBox[{"{",
RowBox[{"\<\"Tunisia\"\>", ",", "4206.77992157625`"}], "}"}], ",",
RowBox[{"{",
RowBox[{"\<\"Palestinian Territory\"\>", ",", "\<\"\"\>"}], "}"}], ",",
RowBox[{"{",
RowBox[{"\<\"Yemen\"\>", ",", "1400.66768498865`"}], "}"}]}],
"}"}]], "Output",
CellChangeTimes->{
3.611337344153296*^9, 3.611337429460937*^9, 3.611337858284029*^9,
3.611349870944788*^9, 3.611349928096842*^9, 3.611350090717196*^9,
3.6113503915157137`*^9, 3.6120036177093763`*^9, 3.612014666012128*^9,
3.612035867468273*^9, 3.614517110707778*^9, 3.6156662821373453`*^9,
3.618896159627282*^9, 3.6191550886558123`*^9, 3.619239861776351*^9,
3.6193297800501842`*^9, 3.61934196166317*^9, 3.668685001543626*^9, {
3.6686876559665413`*^9, 3.668687670728531*^9}}]
}, Open ]],
Cell[CellGroupData[{
Cell[BoxData[
RowBox[{"Length", "@", "%"}]], "Input",
CellChangeTimes->{{3.611337345737669*^9, 3.611337346576882*^9}}],
Cell[BoxData["24"], "Output",
CellChangeTimes->{
3.6113373468743067`*^9, 3.6113374302449102`*^9, 3.6113378599188023`*^9,
3.61203586840471*^9, 3.66868500706096*^9, {3.66868765601921*^9,
3.668687670771316*^9}}]
}, Open ]],
Cell[BoxData[
RowBox[{
RowBox[{"gdpPerCapitaIn2010ForCountriesInvolvedInArabSpringRules", "=",
RowBox[{
RowBox[{
RowBox[{"(",
RowBox[{"Rule", "@@", "#"}], ")"}], "&"}], "/@",
"gdpPerCapitaIn2010ForCountriesInvolvedInArabSpring"}]}], ";"}]], "Input",\
CellChangeTimes->{{3.611339338356979*^9, 3.6113393999336023`*^9}}],
Cell["\<\
Patch the missing data from the world bank with WolframAlpha data for \
Djbouti, Libya, Syria, Somalia (query for 2011 given that the WorldBank data \
is for 2011 PPP):\
\>", "Text",
CellChangeTimes->{{3.668685019133769*^9, 3.668685022675786*^9}}],
Cell[CellGroupData[{
Cell[BoxData[
RowBox[{"gdpPerCapitaIn2010ForCountriesInvolvedInArabSpring", "=",
RowBox[{"{",
RowBox[{
RowBox[{"{",
RowBox[{"\"\<Albania\>\"", ",", "3764.32634799148`"}], "}"}], ",",
RowBox[{"{",
RowBox[{"\"\<United Arab Emirates\>\"", ",", "34048.5173453316`"}],
"}"}], ",",
RowBox[{"{",
RowBox[{"\"\<Bahrain\>\"", ",", "20545.9694536416`"}], "}"}], ",",
RowBox[{"{",
RowBox[{"\"\<Djibouti\>\"", ",", "1464."}], "}"}], ",",
RowBox[{"{",
RowBox[{"\"\<Algeria\>\"", ",", "4349.56932474256`"}], "}"}], ",",
RowBox[{"{",
RowBox[{"\"\<Egypt\>\"", ",", "2803.53296265274`"}], "}"}], ",",
RowBox[{"{",
RowBox[{"\"\<Iran\>\"", ",", "5674.92392735085`"}], "}"}], ",",
RowBox[{"{",
RowBox[{"\"\<Iraq\>\"", ",", "4612.52347575944`"}], "}"}], ",",
RowBox[{"{",
RowBox[{"\"\<Israel\>\"", ",", "30389.107581936`"}], "}"}], ",",
RowBox[{"{",
RowBox[{"\"\<Jordan\>\"", ",", "4370.72103318115`"}], "}"}], ",",
RowBox[{"{",
RowBox[{"\"\<Kuwait\>\"", ",", "40090.7462727442`"}], "}"}], ",",
RowBox[{"{",
RowBox[{"\"\<Lebanon\>\"", ",", "8551.85241627055`"}], "}"}], ",",
RowBox[{"{",
RowBox[{"\"\<Libya\>\"", ",", "5685."}], "}"}], ",",
RowBox[{"{",
RowBox[{"\"\<Morocco\>\"", ",", "2822.73373914854`"}], "}"}], ",",
RowBox[{"{",
RowBox[{"\"\<Mauritania\>\"", ",", "1017.16627752181`"}], "}"}], ",",
RowBox[{"{",
RowBox[{"\"\<Oman\>\"", ",", "20983.9003354042`"}], "}"}], ",",
RowBox[{"{",
RowBox[{"\"\<Qatar\>\"", ",", "72773.314202226`"}], "}"}], ",",
RowBox[{"{",
RowBox[{"\"\<Saudi Arabia\>\"", ",", "19326.5825548176`"}], "}"}], ",",
RowBox[{"{",
RowBox[{"\"\<Sudan\>\"", ",", "1422.3681025837`"}], "}"}], ",",
RowBox[{"{",
RowBox[{"\"\<Somalia\>\"", ",", "145.1"}], "}"}], ",",
RowBox[{"{",
RowBox[{"\"\<Syria\>\"", ",", "2066."}], "}"}], ",",
RowBox[{"{",
RowBox[{"\"\<Tunisia\>\"", ",", "4206.77992157625`"}], "}"}], ",",
RowBox[{"{",
RowBox[{"\"\<Palestinian Territory\>\"", ",", "\"\<\>\""}], "}"}], ",",
RowBox[{"{",
RowBox[{"\"\<Yemen\>\"", ",", "1400.66768498865`"}], "}"}]}],
"}"}]}]], "Input",
InitializationCell->True,
CellChangeTimes->{{3.6193561892288322`*^9, 3.619356268144802*^9}}],
Cell[BoxData[
RowBox[{"{",
RowBox[{
RowBox[{"{",
RowBox[{"\<\"Albania\"\>", ",", "3764.32634799148`"}], "}"}], ",",
RowBox[{"{",
RowBox[{"\<\"United Arab Emirates\"\>", ",", "34048.5173453316`"}], "}"}],
",",
RowBox[{"{",
RowBox[{"\<\"Bahrain\"\>", ",", "20545.9694536416`"}], "}"}], ",",
RowBox[{"{",
RowBox[{"\<\"Djibouti\"\>", ",", "1464.`"}], "}"}], ",",
RowBox[{"{",
RowBox[{"\<\"Algeria\"\>", ",", "4349.56932474256`"}], "}"}], ",",
RowBox[{"{",
RowBox[{"\<\"Egypt\"\>", ",", "2803.53296265274`"}], "}"}], ",",
RowBox[{"{",