-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathui.R
More file actions
1301 lines (1213 loc) · 53.7 KB
/
Copy pathui.R
File metadata and controls
1301 lines (1213 loc) · 53.7 KB
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
##########################################
# MetaZipf | ui file
# Clementine Cottineau, 2016
# UCL - CASA - UDL
##########################################
library(shiny)
library(leaflet)
shinyUI(
fluidPage(
theme = "flatly_bootstrap.css",
tags$head(tags$link(rel = "shortcut icon", href = "favicon.png")),
tags$head(includeScript("www/google_analytics.js")),
tags$head(tags$style(
HTML(
"
@import url('//fonts.googleapis.com/css?family=Orbitron|Cabin:400,700');
"
)
)),
headerPanel("MetaZipf"),
titlePanel(h2(
"A Dynamic and Open Meta Review of Zipf's law for cities"
)),
navlistPanel(
tabPanel("A. About",
tabsetPanel(
tabPanel(
"1. The Project",
column(3, img(src = "favicon.png", class = "img-responsive")),
column(
9,
h1("Open Review and Meta Analysis of Empirical Zipf's Estimates")
),
tags$hr(),
tags$p(
class = "text-justify",
"This application presents a dynamic and open meta analysis of Zipf's law, based on a large scale interactive review of urban literature.",
br(),
br(),
"Indeed, this famous 'urban mystery' (Krugman, 1996) of a regular distribution of city sizes, found in many city systems at various points in history,
has been an on-going subject of scientific discussion for a century. Despite hundreds of empirical evidences, it is still not clear whether there is a universal
Zipf's law (i.e. a power law relating city population to their rank in the system, with a exponent equal to -1) because in many cases, a value significantly different
from 1 is measured. Comparative papers (Singer, 1936; Rosen, Resnick, 1980; Parr, 1985; Soo, 2005) and meta analyses (Nitsch, 2005) provide a first idea of the magnitude of this variation and they try to
understand why deviations are observed: is it because this law simply does not apply in some countries (where controls over migrations are strong for example)?
Is it because the system is not consistently defined (Cristelli et al., 2012), in terms of territory, city definition, etc.?
Is it because the city size inequality tends to increase over time (Pumain, 1997)?",
br(),
br(),
"Building on the work of V. Nitsch (2005), we bring it further by:",
tags$ul(
tags$li(
"creating a much larger review of empirical papers,
in particular through crowdsourcing to enhance representativity across dates, areas and study fields."
),
tags$li(
"testing a broader pool of hypotheses regarding the variability of the exponent measured. In particular,
we plug additional data to the metadatabase to describe the structure and evolution of the territories for which Zipf's law is estimated."
),
tags$li(
"focusing on the evolution of city size unevenness measured by the alpha parameter of Zipf's law. We therefore
introduce the concept of a dynamic meta analysis."
),
tags$li(
"making this meta analysis transparent, open, interactive and adaptable to future developments."
)
),
tags$b(
"The present application allows interactive queries into a pool of empirical papers formatted in a comparable way. It provides a summary of the
numeric, spatial and temporal distribution of alpha found in this vast literature. It provides a static and dynamic meta analysis of Zipf's law and its evolution over time.
It disentangles the statistical effects of the regression specification, of fixed study effects, of characteristics of territories and their evolution,
as well as of historical events and public policies."
),
br(),
br(),
HTML(
'The current database covers 2134 estimations from 89 studies, spanning over more than 400 years in more than 100 countries.
It is open for download (<a href="https://github.com/ClementineCttn/MetaZipf">https://github.com/ClementineCttn/MetaZipf</a>) and you are
strongly invited to contribute by submitting your own empirical estimates using the \'Contribute !\' form.'
),
br(),
br(),
h5("Before starting, choose the way results will be expressed.")
),
tags$hr(),
fluidRow(
column(
6,
selectInput(
"alpha",
"I prefer results to be expressed in the regression form of:",
choices = c("Lotka", "Pareto"),
multiple = FALSE
)
),
column(6,
withMathJax(
h6(
"The Lotka form : $$\\log(P_i) = -\\alpha \\times \\log(R_i) + \\beta + \\epsilon_i$$"
)
),
withMathJax(
h6(
"The Pareto form : $$\\log(R_i) = -\\alpha' \\times \\log(P_i) + \\beta' + \\epsilon'_i$$"
)
),
withMathJax(
h6(
"with: \\(P_i\\) the population of city \\(i\\),
\\(R_i\\) its rank in the urban hierarchy,
\\(\\alpha' = \\frac{1}{\\alpha}\\) and
\\(\\beta' = -\\frac{\\beta}{\\alpha}\\)"
)
))
),
tags$hr(),
"Select the references to include in the analysis...",
fluidRow(
column(
6,
selectizeInput("references", "References", "", multiple = T)
)
,
column(
6,
selectInput(
"reproducePaperSelection",
"Select the set of references used",
c(
"Custom Selection" = "current",
"PLoS-ONE submission (collection ends 03/2017)" = "plosone",
"ArXiv preprint (collection ends 06/2016)" = "arxiv"
),
selected = "current",
multiple = F
)
),
column(
12,
HTML(
'Cottineau C. , 2017, « MetaZipf. A dynamic meta-analysis of city size distributions », PLoS ONE 12(8): e0183919, <a href="https://doi.org/10.1371/journal.pone.0183919">https://doi.org/10.1371/journal.pone.0183919</a>'
)
)),
tags$hr(),
h5("Clémentine Cottineau, 2016, University College London (CASA)."),
h6(
"For any information / comment / suggestion, contact: c.cottineau@ucl.ac.uk"
),
h6("Credits: T. Park from bootswatch.com for Flatly css file."),
h6(
'Nitsch, V. (2005). Zipf zipped. Journal of Urban Economics, 57(1), 86-100'
)
),
tabPanel(
"2. An Example of Zipf's law for cities",
h6(
"Empirical studies are based on urban databases, and the measurement of Zipf's coefficient
may be affected by the sample size, date and definition of cities used, as in the example
of Soviet cities below. "
),
tags$hr(),
h3("Explore variations of Zipf estimations with..."),
fluidRow(
column(4, selectInput(
"dariusyear",
"Year",
choice = c(2010, 2002, 1989, 1979, 1970, 1959, 1939, 1926, 1897),
multiple = F
)),
column(
4,
sliderInput(
"dariuscutoff",
"Minimum Population",
min = 10000,
max = 1000000,
value = 10000
)
),
column(
4,
selectInput(
"dariusdef",
"Urban Definition",
choices = c("Local", "Morpho"),
selected = "Morpho"
)
),
column(12, dataTableOutput('DARIUSestim')),
column(12, plotOutput('DARIUSgraph')),
column(12, leafletOutput("DARIUS")),
#plotOutput('DARIUSmap')),
column(12, h6(
HTML(
'DARIUS Dataset,
Cottineau C. (2014), figshare.
<a href=https://figshare.com/articles/DARIUS_Database/1108081/1">https://figshare.com/articles/DARIUS_Database/1108081/1</a>'
)
))
)
)
)),
tabPanel(
"B. 100 years of publication",
tabsetPanel(
tabPanel(
"1. Literature Overview",
h6(
"This tab summarises the extent of studies of Zipf's law for cities in the literature."
),
tags$hr(),
h4('Coverage by Continent:'),
dataTableOutput('continent'),
h4('TOP journals where the estimations* are drawn from:'),
'*Each reference count as one, irrespective of the number of estimations',
tags$hr(),
dataTableOutput('topjournals'),
h4('TOP authors* providing estimations:'),
'*the estimations published by the same author(s) in different publications are not added.',
tags$hr(),
dataTableOutput('topauthors'),
h4('TOP countries for the dispersion of results*:'),
'*measured by the standard deviation of alpha for countries with more than 5 estimations.',
tags$hr(),
dataTableOutput('topcountries')
),
tabPanel(
"2. Where & When",
h6(
"This law has been estimated for a wide array of countries and periods, with particular
focuses on cases with reliable available data (i.e. developed countries in recent years)."
),
tags$hr(),
fluidRow(column(
9,
h4("Geographical Distribution of estimations"),
h6('!! It might take a few seconds to load and update !!')
),
column(
3,
selectInput(
'alphaVarToMap',
'Alpha Statistics',
choices = c(
"Mean Alpha" = 'meanAlpha',
"Standard Deviation" = 'diversity',
"Number of Estimations" = 'n'
),
selected = "meanAlpha",
multiple = F
)
)),
tags$hr(),
leafletOutput('worldmap'),
h6('Click on the countries to see all the estimated values'),
tags$hr(),
h4('Temporal Coverage'),
plotOutput('temporal')
),
tabPanel(
"3. Distribution of Alpha",
h6(
"Although Zipf's Law states that alpha should be equal to 1,
empirical estimations are found to be distributed widely around this value.
The meta analysis precisely looks for explanations for this diversity, by relating the value
of alpha to some characteristics of the urban system (territory, population, age, type of cities)
and to potential biases (city definition, regression form, etc.)."
),
tags$hr(),
h4("Statistical Distribution of estimations"),
h2("Subset by:"),
fluidRow(
column(4, selectizeInput("territorys", "Continent", "", multiple = T)),
column(4, selectizeInput("scales", "City Definition", "", multiple =
T)),
column(4, selectizeInput("decades", "Decade", "", multiple =
T)),
plotOutput('histalpha')
),
br(),
tags$hr(),
tags$hr(),
h4("Summary Statistics"),
fluidRow(column(6, dataTableOutput('summaryAlpha')),
column(6, dataTableOutput('summaryMeta')))
),
tabPanel(
"4. References",
h6(
"The analysis is based on estimations found in the following references."
),
tags$hr(),
h4("Bibliographical References"),
dataTableOutput('references')
)
)
),
tabPanel(
"C. Static Meta-Analysis",
tabsetPanel(
tabPanel(
"1. Hypotheses",
h6(
"'Almost no data set corresponds exactly to the rank-size rule, so interpretations are based on how the data set diverges from the expected results' - Savage, 1997"
),
tags$hr(),
h4("Hypotheses to explain deviations from Zipf's Law"),
h2("1. Recently urbanised systems are more unequal than ancient ones"),
h6(
"Because the transport networks available at the time of urbanisation were slower in old systems, a larger amount of small cities were necessary. In areas urbanised with railroads and highways, these small cities tend to have been short-circuited."
),
h6("References: Moriconi-Ebrard, 1993; Pumain, 1997"),
h2("2. Small territories are more unequal than large ones"),
h6(
"Because the concentration of power in the largest cities is not balanced by a sufficiently large set of secondary cities."
),
h6("References: Morrill, 1970; Rosen & Resnick, 1980"),
h2(
"3. Metropolitan areas (and built-up areas to a lesser extent) are more unevenly populated than 'city propers'"
),
h6(
"Because the inclusion of suburbs causes a larger proportional increase in large cities than for small city populations, increasing the unevenness measured."
),
h6(
"References: Auerbach, 1913; Rosen & Resnick, 1980; Soo, 2005; Nitsch, 2005"
),
h2("4. Systems of cities tend to be more uneven with time"),
h6(
"Because larger cities grow faster on average, due to first-mover advantages in innovations."
),
h6("References: Pumain, 1997; Nitsch, 2005"),
h2("5. Loosely-integrated systems deviate more than integrated ones"),
h6(
"Because they duplicate small to medium-sized cities and/or lack a primate city."
),
h6("References: Harris, 1970; Johnson, 1977; Rosen & Resnick, 1980"),
h2("6. Smaller sets of cities are more likely to deviate from Zipf's law"),
h6(
"Because they do not represent sufficiently well the complete distribution of cities."
),
h6("References: Rosen & Resnick, 1980; Critelli et al, 2012"),
h2(
"7. The minimum population used to define cities affects the measure"
),
h6(
"Because empirical rank-size distributions can be convex or concave."
),
h6(
"References: Rosen & Resnick, 1980; Moriconi-Ebrard, 1993; Savage, 1997; Soo, 2005"
)#,
# h2("8. "),
# h6("Because ."),
# h6("References: ")
),
tabPanel(
"2. Data",
h6(
"In a meta-analysis, we do not work directly with the cities' data: we use the estimations published by other researchers. The data is thus made by the result of their
analysis along with the description of how they made the analysis. Each observation is thus
composed of a single estimation of alpha, of variables describing the regression performed,
of variables describing the study scope and of additional variables describing the territory within which alpha is estimated."
),
tags$hr(),
h4("Default Variables"),
# withMathJax(h6("$$\\log(P_i) = -\\alpha \\times \\log(R_i) + \\beta + \\epsilon_i$$ $$\\log(R_i) = -\\alpha' \\times \\log(P_i) + \\beta' + \\epsilon'_i$$ ")),
h2("ALPHA"),
"The scaling coefficient reported in the study or its transformed value, depending on the form chosen in the first tab (Lotka or Pareto).",
br(),
h2("DATE"),
"The date of observation used in the meta analysis is the date to which the cities' population refer.",
br(),
h2("TERRITORY"),
"The territory to which the cities' population refer.",
br(),
h4("Estimation variables"),
h2("CITY DEFINITION"),
"City definitions are a categorization of original definitions reported in the papers. LocalUnits correspond to all types of local administrative units. MorphoCities are aggregations of Local units based on density or the built-up area. MetroAreas correspond to functional aggregations of Local units based on flows (typically commuters as in the American SMAs). VariaMixed indicate that the definition is heterogenous or uncommon.
",
br(),
h2("POPULATION CUTOFF"),
"The population cutoff of an estimation corresponds to the minimum population (if any) of the cities selected to estimate Zipf's coefficient.
",
br(),
h2("NUMBER OF CITIES"),
"The number of cities refers to the number of observations (cities) used to estimate Zipf's coefficient.
",
br(),
h2("ESTIMATION METHOD"),
"The estimation method is a categorical variable which can take the value 'OLS' if the estimation was performed
using the Ordinal Least Squares Method on logged varibles, 'GI' if it used Gabaix & Ibragimov's trick of replacing
ranks by <ranks - 1/2>, 'MC' if it used Markov Chains and 'ML' if it used Maximum Likelihood Estimation.
",
br(),
h2("REGRESSION FORM"),
"The regression form is a categorical variable which can take the value 'Lotka' if the estimation was performed
using the regression form log(Pi) = β - α log(i) or the value 'Pareto' if the regression form chosen was: log(i) = β' - α' log(Pi). In any case, the values of α and α' were made comparable by expressing all results in the Lotka form: transforming α' in 1/α'.
",
br(),
h4("Study variables"),
h2("YEAR OF PUBLICATION"),
"The year of publication is that of the study.
",
br(),
h2("NUMBER OF ESTIMATES"),
"The number of estimates refers to the number of Zipf's coefficients reported in the study and included in this meta-analysis (i.e. those with sufficient specification details).
",
br(),
h2("PERIOD COVERED"),
"The period covered corresponds to the difference between the date of observation of the latest estimation and the date of observation of the earliest estimation of the study.
",
br(),
h2("NUMBER OF COUNTRIES COVERED"),
" The number of countries covered is the number of different territories for which an estimate is reported in the study.
",
br(),
h4("Territorial variables"),
h2("URBANISATION LEVEL"),
"The urbanisation level of the territory for which Zipf's coefficient is estimated corresponds to percentage of population urban according to the 2014 World Urbanization Prospects UN estimates for the years 1950-2050 .
",
HTML(
'<a href=https://esa.un.org/unpd/wup/CD-ROM">https://esa.un.org/unpd/wup/CD-ROM/</a>'
),
br(),
h2("AGE OF URBANISATION"),
"The age of urbanisation is an indication whether urbanisation is a relatively recent or ancient phenomenon in the territory. 'OLD' continents refer to zones of early urbanisation, in Europe, South-East Asia and the Middle East. America, Oceania, Africa and central Asia are considered 'NEW' in that respect.
",
br(),
h2("TOTAL POPULATION"),
"The total population of the territory for which Zipf's coefficient is estimated corresponds to the UN estimates for the years 1950-2015 .
",
HTML(
'<a href=http://esa.un.org/unpd/wpp/Download/Standard/Population/">http://esa.un.org/unpd/wpp/Download/Standard/Population/</a>'
),
br(),
h2("GDP PER CAPITA"),
" The GDP per Capita in current $ of the territory for which Zipf's coefficient is estimated corresponds to the World Bank estimates for the years 1960-2015 .
",
HTML(
'<a href=http://data.worldbank.org/indicator/NY.GDP.PCAP.CD">http://data.worldbank.org/indicator/NY.GDP.PCAP.CD</a>'
),
br(),
h4("Dynamic variables"),
h2("POPULATION GROWTH"),
"The population growth of the territory for which Zipf's coefficient is estimated corresponds to the annual average growth rates of its total population (C3).
",
br(),
h2("GDP GROWTH"),
"The GDP growth of the territory for which Zipf's coefficient is estimated corresponds to the annual average growth rates of its GDP per Capita (C4).
",
br(),
h2("URBANISATION GROWTH"),
"The urbanisation growth of the territory for which Zipf's coefficient is estimated corresponds to the annual average growth rates of its urbanisation level (C1).
",
br(),
h2("GROWTH OF THE NUMBER OF CITIES"),
"The growth of the number of cities of the territory for which Zipf's coefficient is estimated corresponds to the annual average growth rates of the number of cities used in the estimation (A3).
",
br(),
h4("Event variables"),
h2("INTERNATIONAL WARS"),
"International Wars are recorded from the Wikipedia list of wars by date . Only the 196 international wars involving national States between 1700 and 2014 were selected and geocoded.
",
HTML(
'<a https://en.wikipedia.org/wiki/Outline_of_war#Wars">https://en.wikipedia.org/wiki/Outline_of_war#Wars</a>'
),
br(),
h2("CIVIL WARS"),
"Civil Wars are recorded from the Wikipedia list of civil wars . Only the 106 civil wars which happened at a national scale between 1775 and 2015 were selected and geocoded.
",
HTML(
'<a https://en.wikipedia.org/wiki/List_of_civil_wars">https://en.wikipedia.org/wiki/List_of_civil_wars</a>'
),
br(),
h2("REVOLUTIONS"),
"Revolutions are recorded from the Wikipedia list of revolutions and rebellions . Only the 107 revolutions which happened at a national scale between 1642 and 2014 were selected and geocoded.
",
HTML(
'<a https://en.wikipedia.org/wiki/List_of_revolutions_and_rebellions">https://en.wikipedia.org/wiki/List_of_revolutions_and_rebellions</a>'
),
br(),
h2("WARS OF INDEPENDENCE"),
"Wars of independence are recorded from the Wikipedia list of national independence days and geocoded.
",
HTML(
'<a https://en.wikipedia.org/wiki/List_of_national_independence_days"> https://en.wikipedia.org/wiki/List_of_national_independence_days</a>'
),
br(),
br(),
h4("Data"),
h2("Subset Table by:"),
fluidRow(
column(4, selectizeInput("territory", "Territory", "", multiple = T)),
column(4, selectizeInput("scale", "City Definition", "", multiple =
T)),
column(4, selectizeInput("decade", "Decade", "", multiple =
T)),
column(3, downloadButton("downloadData", "Download")),
column(
9,
HTML(
'N.B. This table is a simplified version. You can find the full version here <a href="here">https://github.com/ClementineCttn/MetaZipf</a>'
)
)
),
dataTableOutput('review'),
tags$hr()
),
tabPanel(
"3. Results",
h6(
"We use a multiple regression to test our hypotheses about the relation between
estimated alphas and the characteristics of the estimation, of the study and of the urban system considered."
),
tags$hr(),
"Technically, we regress the value of alpha reported for the estimation k of a study s regarding the territory m at time t as follow:",
withMathJax(
h6(
"$$\\alpha_{k,s,m} = Intercept + b1 * A_k + b2 * B_s + b3 * C_m + e_s + e_c + e_k $$"
)
),
"where Ak represents a set of variables describing the estimation k,
Bs represents variables describing the study s,
Cm represents static variables relating to the territory m,
es and ec represent respectively a fixed-study and fixed-country effect if the model selected includes fixed-effects,
ek represents normally distributed errors.",
br(),
"For comparability reasons, most of the characteristics A, B and C
that we consider have been discretised into ordinal categories.
You can modify the bounds of each discretisation using
the sliders appearing when the variable is included in the model.",
tags$hr(),
h4("Select Features for the Meta Analysis"),
fluidRow(
column(
4,
checkboxGroupInput(
"technicalSpecs",
"Ak. Estimation Variables",
c(
"All" = "alltech",
"Population Cutoff" = "truncation4model",
"Number of Cities" = "N4model",
"City definition" = "scale4model",
"Regression form" = "regForm",
"Estimation method" = "olsOrnot"
),
selected = NULL,
inline = FALSE
)
),
column(
4,
checkboxGroupInput(
"otherSpecs",
"Bs. Study Variables",
c(
"All" = "allother",
"Year of Publication" = "yearOfPubli",
"Study Size" = "studySize",
"Length of Period Analyzed" = "studyPeriod",
"Coverage of territories" = "studyCoverage"
),
selected = NULL,
inline = FALSE
)
),
column(
4,
checkboxGroupInput(
"topicalSpecs",
"Cm. Territorial Variables",
c(
"All" = "alltop",
"Date of observation" = "time",
"Age of Urbanisation" = "urbanisation4model",
"Country Population" = "countrySize",
"Urbanization Level" = "countryUrb",
"Country GDP per capita" = "countryGDP"
),
selected = NULL,
inline = FALSE
)
),
column(
6,
selectInput(
"modelSpec",
"Type of meta analysis model",
c(
"OLS" = "ols",
"Fixed Study Effects" = "fixedStudyEffects",
"Fixed Country Effects" = "fixedCountryEffects",
"Fixed Effects Panel Model" = "fixedPanelEffects",
"Random Effects Panel Model" = "randomPanelEffects"
),
selected = "ols",
multiple = F
)
),
column(
6,
checkboxInput(
"subsetData",
"Use the data subset defined in tab [2.Data]"
)
),
# column(
# 5,
# checkboxInput("sameSample", "Compare models with the same observations", value = F)
# ),
#
# column(
# 6,
# checkboxInput("standardize", "Standardise variables: (x - mean(x)) / sd(x)", value = F)
# ),
#
column(
4,
conditionalPanel(
condition = 'input.technicalSpecs.indexOf("truncation4model") != -1 || input.technicalSpecs.indexOf("alltech") != -1',
sliderInput(
"truncVal",
"Population Cutoff (bounds of the medium reference class)",
min = 0,
max = 1000000,
value = c(10000, 100000)
)
)
),
column(
4,
conditionalPanel(
condition = 'input.technicalSpecs.indexOf("N4model") != -1 || input.technicalSpecs.indexOf("alltech") != -1',
sliderInput(
"NVal",
"Number of cities (bounds of the medium reference class)",
min = 1,
max = 1000,
value = c(30, 300)
)
)
),
column(
4,
conditionalPanel(
condition = 'input.otherSpecs.indexOf("yearOfPubli") != -1 || input.otherSpecs.indexOf("allother") != -1',
sliderInput(
"yearOfP",
"Year of Publication (bounds of the medium reference class)",
min = 1925,
max = 2015,
value = c(1975, 2000)
)
)
),
column(
4,
conditionalPanel(
condition = 'input.otherSpecs.indexOf("studyPeriod") != -1 || input.otherSpecs.indexOf("allother") != -1',
sliderInput(
"s_period",
"Length of the study period (boundary between short and long periods)",
min = 2,
max = 200,
value = 50
)
)
),
column(
4,
conditionalPanel(
condition = 'input.otherSpecs.indexOf("studyCoverage") != -1 || input.otherSpecs.indexOf("allother") != -1',
sliderInput(
"n_territories",
"Territories covered by the study (boundary between few and many)",
min = 2,
max = 200,
value = 5
)
)
),
column(
4,
conditionalPanel(
condition = 'input.otherSpecs.indexOf("studySize") != -1 || input.otherSpecs.indexOf("allother") != -1',
sliderInput(
"n_estim",
"Number of estimations in the study (boundary between small and large studies)",
min = 2,
max = 100,
value = 10
)
)
)
),
column(
4,
conditionalPanel(
condition = 'input.topicalSpecs.indexOf("countrySize") != -1 || input.topicalSpecs.indexOf("alltop") != -1',
sliderInput(
"PopVal",
"Country Population (x 1000, bounds of the medium reference class)",
min = 1,
max = 1000000,
value = c(10000, 100000)
)
)
),
column(
4,
conditionalPanel(
condition = 'input.topicalSpecs.indexOf("countryUrb") != -1 || input.topicalSpecs.indexOf("alltop") != -1',
sliderInput(
"UrbVal",
"Urbanization Level (%, bounds of the medium reference class)",
min = 0,
max = 100,
value = c(20, 60)
)
)
),
column(
4,
conditionalPanel(
condition = 'input.topicalSpecs.indexOf("countryGDP") != -1 || input.topicalSpecs.indexOf("alltop") != -1',
sliderInput(
"GDPVal",
"GDP per Capita (current US$, bounds of the medium reference class)",
min = 1,
max = 100000,
value = c(1000, 10000)
)
)
),
column(
4,
conditionalPanel(
condition = 'input.topicalSpecs.indexOf("time") != -1 || input.topicalSpecs.indexOf("alltop") != -1',
sliderInput(
"nTime",
"Date of observation (bounds of the medium reference class)",
min = 1700,
max = 2010,
value = c(1940, 2000)
)
)
),
fluidRow(
tags$hr(),
h4("Model Fit"),
"The accuracy of the model is given by the R2 value, but it also depends on the the number of observations (here, the estimations from the literature),
because of missing information in the reported specifications.",
br(),
br(),
tableOutput('modelparameters'),
column(
12,
conditionalPanel(
condition = 'input.modelSpec.indexOf("randomPanelEffects") != -1',
textOutput('pFtest')
)
),
# tags$b("Are fixed study effects needed? (based on pFtest)"),
# textOutput('pFtest'),
tags$hr(),
h4("Results"),
tags$b("Intercept Coefficient"),
tableOutput('model_temporal'),
tags$b("Significant Coefficients"),
tableOutput('model_significant'),
br(),"Adjust the level of significance according to your requirements:",
sliderInput(
"significance",
"Significance level (%)",
min = 0.1,
max = 10,
value = 5
),
tags$b("Non-significant Coefficients"),
tableOutput('model_non_significant'),
tags$hr(),
"To interpret the results, please note that:",
br(),
br(),
tags$ul(
tags$li(
"The ",
tags$b("Intercept"),
" gives the average value of alpha predicted for
an urban system characterized by the reference categories of the selected variables",
htmlOutput('REFS')
)
)
)
)
)
),
tabPanel(
"D. Dynamic Analysis",
tabsetPanel(
tabPanel(
"1. Meta Dynamic Analysis",
h6(
"We use a multiple regression to test our hypotheses about the relation between
the evolution of alpha values and the characteristics of the territory, of its evolution and of some events happening within the time frame considered."
),
tags$hr(),
"Technically, we regress the average annual growth rate of alpha between t1 and t2 (when two or more values of alpha were reported in a study with the same specification) as follow:",
withMathJax(
h6(
"$$G_{\\alpha, l, m, t1, t2} = Intercept + b1 * C_{m, t1} + b2 * D_{m, t1, t2} + b3 * E_{m, t1, t2} + e_p + e_l $$"
)
),
"where Cm represents a set of variables describing the territory m at time t1,
Dm represents the evolution of territorial variables between t1 and t2,
Em represents events which have happened in the territory m between t1 and t2,
ep represents a fixed effect in the panel models,
el represents normally distributed errors.",
br(),
"For comparability reasons, most of the characteristics C and D
that we consider have been discretised into ordinal categories.
You can modify the bounds of each discretisation using
the sliders appearing when the variable is included in the model.",
tags$hr(),
h4("Select Features for the Dynamic Meta Analysis"),
fluidRow(
column(
4,
checkboxGroupInput(
"var_static_meta_analysis",
"Cm. Territorial Variables",
c("Initial Alpha" = "alpha",
"Initial Population" = "pop",
"Initial GDP per capita" = "gdp",
"Initial Urbanization level" = "urb"
),
selected = NULL,
inline = FALSE
)
),
column(
4,
checkboxGroupInput(
"var_dyn_meta_analysis",
"Dm. Dynamic Variables",
c("Date" = "t",
"Population Growth" = "tcam_pop",
"GDP per capita Growth" = "tcam_gdp",
"Urbanization Growth" = "tcam_urb",
"Number of Cities" = "n"
),
selected = NULL,
inline = FALSE
)
),
column(
4,
checkboxGroupInput(
"meta_events_meta_analysis",
"Em. Event Variables",
c(
"Revolution" = "rv",
"War of Independence" = "wi",
"Civil War" = "cw",
"International War" = "iw"
),
selected = NULL,
inline = FALSE
)
),
column(
6,
checkboxInput("fixedEffects2", "Fixed Effect Panel Model", value = F)
),
column(
6,
checkboxInput(
"sameSample2",
"Compare models with the same observations",
value = F
)
),
column(
4,
conditionalPanel(
condition = 'input.var_static_meta_analysis.indexOf("alpha") != -1',
sliderInput(
"alphaVal",
"Alpha at the beginning of the period (bounds of the medium reference class)",
min = 0,
max = 5,
value = c(0.75, 1.25),
step = 0.05
)
)
),
column(
4,
conditionalPanel(
condition = 'input.var_static_meta_analysis.indexOf("pop") != -1',
sliderInput(
"PopVal2",
"Country Population (x 1000, bounds of the medium reference class)",
min = 1,
max = 1000000,
value = c(10000, 100000)
)
)
),
column(
4,
conditionalPanel(
condition = 'input.var_static_meta_analysis.indexOf("gdp") != -1',
sliderInput(
"GDPVal2",
"GDP per Capita (current US$, bounds of the medium reference class)",
min = 1,
max = 100000,
value = c(1000, 10000)
)
)
),
column(
4,
conditionalPanel(
condition = 'input.var_static_meta_analysis.indexOf("urb") != -1',
sliderInput(
"UrbVal2",