-
Notifications
You must be signed in to change notification settings - Fork 0
/
goliaths.Rmd
441 lines (373 loc) · 16.1 KB
/
goliaths.Rmd
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
---
title: "Global Goliaths"
author: "Manuel Alcala Kovalski"
date: "`r Sys.Date()`"
output:
prettydoc::html_pretty:
theme: cayman
highlight: github
fig_width: 4
fig_height: 6
editor_options:
chunk_output_type: console
---
```{r setup, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
warning = FALSE,
message = FALSE,
results = 'asis',
tidy.opts=list(width.cutoff=60),
tidy=TRUE,
echo = FALSE,
fig.ext = "png",
#cache = TRUE,
fig.align = "center",
fig.show = "hold",
fig.width=8,
fig.asp=0.9,
out.width = "100%",
fig.path = "figures/",
fig.retina = 2,
fig.showtext = TRUE,
fig.pos = "t",
dpi = if (knitr::is_latex_output()) 72 else 300,
dev.args = list(png = list(type = "cairo-png")),
optipng = "-o1 -quiet"
)
library(knitr)
knitr::knit_hooks$set(optipng = hook_optipng)
knitr::knit_hooks$set(pngquant = hook_pngquant)
```
```{r packages, include = FALSE}
librarian::shelf('tidyverse', 'glue', 'tsibble', 'readxl', 'janitor', 'ggthemes', 'ggtext','ggrepel', 'RColorBrewer', 'nfa', 'sysfonts', 'showtext', 'readxl', 'scales', 'gghutchins', 'directlabels', 'gghighlight', 'gglaplot')
conflicted::conflict_prefer('lag', 'dplyr')
conflicted::conflict_prefer('filter', 'dplyr')
conflicted::conflict_prefer('geom_line', 'ggplot2')
conflicted::conflict_prefer('geom_col', 'ggplot2')
conflicted::conflict_prefer('geom_text', 'ggplot2')
conflicted::conflict_prefer('geom_point', 'ggplot2')
ggplot2::theme_set(gghutchins::theme_hutchins())
caption_text <- '<br>**Note:** The original figure appears in *Global Goliaths*, Brookings Institution Press, 2021. <br>
**Source**: Bureau of Economic Analysis.'
```
## Figure 1
```{r fig1}
mnc_share <-
readxl::read_xlsx("data/role-mnc.xlsx")
p1 <- mnc_share %>%
pivot_longer(where(is.numeric)) %>%
mutate(name = fct_relevel(name,
"U.S. Imports", "U.S. Exports", "Industrial R&D", "Capital Expenditures", "Manufacturing Employee Compensation", "Manufacturing Employment", "Employee Compensation", "Employment")) %>%
ggplot(aes(y = name,
x = value,
fill = mnc_type)) +
geom_col(width = 0.7) +
stat_summary(fun = sum, aes(x = value , label = scales::percent(after_stat(x), accuracy = 0.1), group = name), geom = "text", position = position_nudge(x = 0.06), family = 'Roboto Medium', fontface = 'bold')
p1 +
scale_x_continuous(
name = "",
labels = scales::percent_format(accuracy = 1),
limits = c(0, 1)
) +
scale_y_discrete(name = '') +
scale_fill_hutchins(
'qual',
rev = TRUE,
name = '',
labels = c("U.S. arms of foreign-headquartered firms", "U.S. parents")
) +
guides(fill = guide_legend(reverse = T, nrow = 1)) +
labs(
title = "**Multinationals are major players in the U.S. economy**",
subtitle = "Multinationals' share of economic activity in 2017, by category<br>",
caption = '<br>**Note:** The original figure appears in *Global Goliaths*, Brookings Institution Press, 2021. <br>
**Source**: Bureau of Economic Analysis, National Income and Product Accounts; National Science Foundation, Science and Engineering Indicators; Census Bureau Annual Capital Expenditure Survey.'
) +
theme(legend.title = element_blank(),
legend.position = c(-0.467,1.025),
legend.justification= 'left',
legend.box = "horizontal",
legend.margin = margin(0),
legend.key = element_blank(),
legend.direction = "horizontal",
plot.title.position = "plot",
plot.caption.position = "plot",
plot.caption = element_textbox_simple(hjust = 0)
)
```
## Figure 2
```{r fig2,fig.asp=.9}
df <- readxl::read_xlsx("data/employment_share.xlsx") %>%
janitor::clean_names() %>%
rename_with( ~snakecase::to_title_case(.),
ends_with('income')) %>%
fill(everything(), .direction = "up") %>%
mutate(
across(
.cols = !year & !all_countries,
.fns = ~ .x / all_countries,
.names = "{.col}"
)
) %>%
select(-all_countries) %>%
pivot_longer(-year)
ggplot(df) +
geom_line(aes(x = year, y = value, group = name), alpha = 0.5) +
coord_cartesian(clip = 'off') +
geom_dl(aes(x = year, y = value, label = stringr::str_remove(name, ' Income'), size = 0.1),method = list(dl.trans(x = x + .1),'last.bumpup'), cex = 0.2)+
geom_line(df %>% filter(name == 'High Income'),
mapping = aes(x = year, y = value),
color = '#003A79', size = 1.3) +
scale_x_continuous(
name = "",
breaks = seq(1982, 2021, 5),
limits = c(1982, 2020),
expand = expansion(mult = c(0, 0.1))
) +
scale_y_continuous(
name = "",
labels = scales::percent,
limits = c(0, 0.8),
breaks = seq(0, 0.8, 0.15),
expand = expansion(mult = c(0.05, .1))
) +
labs(
title = "The bulk of multinationals' employees are in high-wage economies",
subtitle = "Share of U.S. multinational foreign affiliate employment, by host country income",
caption = caption_text
)
```
## Figure 3
```{r fig3, fig.asp = 0.9}
df <-
readxl::read_xlsx("data/fig_3.xlsx") %>%
clean_names()
df <-
df %>%
mutate(
across(
-c('date', 'total'),
~ .x / total
)
) %>%
select(-total, -other) %>%
pivot_longer(-date) %>%
mutate(name = factor(name,
levels = c(
"asia",
"canada",
"europe",
"latin_am"
),
labels = c(
"Asia",
"Canada",
"Europe",
"Latin America"
)
))
df_minus <- df %>% mutate(name2 = name) %>% select(-name)
df %>% ggplot(aes(x = date, y = value, group = name)) +
geom_line(alpha = 2, size = 1.5, aes(group = name), color = hutchins_colors['green']) +
# geom_line(data = df_minus, aes(x = date, y = value, group = name2), color = 'grey', alpha = 0.4, size = 1.1) +
theme_hutchins() +
coord_cartesian(clip = 'off') +
labs(title = "Multinationals' markets have shifted toward Asia",
subtitle = 'Share of U.S. multinational foreign affiliate sales, by affiliate location',
caption = caption_text) +
scale_y_continuous(name = '', labels = scales::percent_format(accuracy = 1), limits = c(0,0.65),
breaks = seq(0, 0.65, 0.1),
expand = expansion(mult = c(0, 0))) +
scale_x_continuous(name = '',
limits = c(1982, 2017),
breaks = seq(1982, 2017, 5),
expand = expansion(mult = c(0.1, .2))) +
geom_dl(aes(label = name), method = list(dl.trans(x = x + .2),'last.bumpup'), cex = 0.8) +
gghighlight(name == 'Asia',
use_group_by = FALSE,
use_direct_label = FALSE,
unhighlighted_params = list(size = 0.2, alpha = 0.9, color = 'gray50'))
```
## Figure 4
```{r fig4, fig.asp = 0.9}
readxl::read_xlsx('data/data.xlsx', sheet = 'figure 4') %>%
summarize(date,
`Employment` = parent_employment / total_employment,
`Capital spending` = parent_capital_expenditures /total_capital_expenditures) %>%
pivot_longer(-date) %>%
mutate(label = if_else(date == max(date), as.character(name), NA_character_)) %>%
ggplot(aes(x = date, y = value, color = name)) +
geom_line(size = 1.4, alpha = 0.8) +
scale_x_continuous(name = '', limits = c(1981, 2020), breaks = seq(1982, 2017, 5),
expand = expansion(c(0.1, 0.15))) +
scale_color_hutchins() +
scale_y_continuous(name = '',labels = scales::percent_format(accuracy = 1),
limits = c(0,0.45), breaks = seq(0, 0.6, 0.05),
expand = expansion(0)) +
coord_cartesian(clip = 'off') +
labs(title = 'U.S. operations of U.S. multinationals have grown at the same pace as the economy',
subtitle = 'U.S. multinational parent share of U.S. private sector activity',
caption = caption_text) +
geom_dl(aes(label = name), method = list(dl.trans(x = x + .2),'last.bumpup'), cex = 0.8,
color = 'black') +
theme(legend.position = 'none')
```
## Figure 5
```{r fig5, fig.asp = .9}
read_xlsx('data/data.xlsx', sheet = 'figure 5') %>%
summarize(date,
share = parents / total) %>%
pivot_longer(share) %>%
ggplot(aes(x = date, y = value, label = value)) +
geom_line(size = 1.1, alpha = 0.8, color = hutchins_colors['brookings blue']) +
scale_y_continuous(name = '', labels = scales::percent_format(accuracy = 1), limits = c(0.55, 0.85), breaks = seq(0.55, 0.85, 0.05),
expand = expansion(mult = c(0.15, 0))
) +
labs(title ='U.S. multinationals still do the bulk of U.S. private sector R&D spending',
subtitle = 'U.S. parent share of U.S. business R&D',
caption = '**Note:** The original figure appears in *Global Goliaths*, Brookings Institution Press, 2021. This figure also previously appeared in "The Rise of Global Innovation by U.S. Multinationals Poses Risks and Opportunities", Peterson Institute for International Economics, 2019.<br>**Source:** Bureau of Economic Analysis.') +
scale_x_continuous(name = '', limits = c(1989, 2018), breaks = seq(1989, 2017, 5),
expand = c(0.01, 0))
```
## Figure 6
```{r fig6, fig.asp = .9}
get_label <- function(df){
df %>%
mutate(label = if_else(date == max(date), as.character(name), NA_character_))
}
add_label <- function(){
geom_label_repel(aes(label = label),
nudge_x = 1,
na.rm = TRUE)
}
read_xlsx('data/data.xlsx', sheet = 'figure 6') %>%
summarize(date,
Exports = exports / all_exports,
Imports = imports /all_imports) %>%
pivot_longer(-date) %>%
ggplot(aes(x = date, y = value, color = name)) +
geom_line(size = 1.3, alpha = 0.75) +
scale_color_manual(values = c(hutchins_colors['vivid blue'] ,"#FF9E1B" )) +
scale_y_continuous(labels = percent_format(accuracy = 1),
name = '',
limits = c(0.25, 0.45),
breaks = seq(0.25, 0.5, 0.05),
expand = expansion(mult = c(0.2, 0))) +
geom_dl(aes(label = name), method = 'last.points', color = 'black') +
labs(title = 'Intra-company trade has grown at the same pace as overall international trade',
subtitle = 'Related party share of U.S. imports and exports',
caption = caption_text) +
scale_x_continuous(name = '', limits = c(1981, 2020), breaks = seq(1982, 2017, 5),
expand = c(0, 0.5)) +
theme(
legend.text = element_blank(),
legend.position = 'none'
)
```
## Figure 7
```{r fig7, out.width='100%', fig.asp = .9}
read_xlsx('data/data.xlsx', sheet = 'figure 7') %>%
pivot_longer(investment) %>%
get_label() %>%
ggplot(aes(x = date, y = value, color = name)) +
geom_line(size = 1.2,alpha=0.7)+
scale_color_hutchins(pal = 'mixed') +
scale_y_continuous(labels = percent_format(accuracy = 1), limits = c(0, 0.35), breaks = seq(0, 0.35, 0.05),
expand = expansion(mult = 0)) +
scale_x_continuous(limits = c(1982, 2017), breaks = seq(1982, 2017, 5)) +
labs(title = "A growing share of multinationals' profits come from abroad",subtitle = "U.S. firms' income on equity investment abroad as share of worldwide profits",
caption = caption_text) +
theme(legend.position = 'none')
```
```{r fig8}
caption_text_fig8 <- '<br>**Note:** The original figure appears in *Global Goliaths*, Brookings Institution Press, 2021. <br>
**Source**: Bureau of Economic Analysis and Dhammika Dharmapala.'
read_xlsx('data/data.xlsx', sheet = 'figure 8') %>%
mutate(label = glue::glue('{100 * round(value, 3)}%')) %>%
ggplot(aes(x = reorder(name, value), y = value )) +
geom_col(fill = hutchins_colors['gray'], alpha = 1, width = 0.4) +
scale_fill_hutchins() +
scale_y_continuous(labels = percent_format(accuracy = 1),
limits = c(0,0.55),
breaks = seq(0,0.55, 0.1),
expand = expansion(0.02))+
coord_flip() +
guides(fill = guide_legend(reverse = T)) +
labs(
title = "Percentage of U.S. multinationals' foreign activity in tax havens",
caption = caption_text_fig8) +
geom_dl(aes(label = label), hjust = -0.25, method = list(dl.trans(x = x + .2),'last.bumpup'), cex = 0.8, font = 'Robot Medium', fontface = 'bold',
color = 'black')
```
```{r fig9}
read_xlsx('data/data.xlsx', 'figure 9') %>%
summarize(date,
share = tax_haven / total) %>%
mutate(date = as.character(date)) %>%
pivot_longer(share) %>%
ggplot(aes(x = date, y = value, group = 1)) +
geom_line(color = 'grey60', size = 1) + geom_point(color = hutchins_colors['brookings blue'], size = 4)+
#geom_col(fill=hutchins_colors['brookings blue'], width = 0.7) +
scale_y_continuous(label = percent_format(accuracy = 1),
limits = c(0,0.6),
breaks = seq(0,0.6, 0.1),
expand = expansion(mult = c(0,0))) +
labs(title = "Multinationals' use of tax havens has increased" ,
subtitle = 'Share of U.S. multinational parent firms with affiliates in tax havens',
caption = '<br>**Note:** The original figure appears in *Global Goliaths*, Brookings Institution Press, 2021. Tax Haven countries are those identified in James R. Hines Jr. "Treasure islands." Journal of Economic Perspectives 24.4 (2010): 103-26, with the exception of the Cook Islands, the UK Channel Islands, and Niue, which cannot be separately identified in the BEA data.
<br> **Source:** Bureau of Economic Analysis.
') +
theme(
plot.caption = element_textbox_simple(color = '#666666')
)
```
```{r fig10}
read_xlsx('data/data.xlsx', sheet = 'figure 10') %>%
summarize(date, traditional, non_traditional) %>%
pivot_longer(-date) %>%
ggplot(aes(x = date, y = value, fill = name, group = name)) +
geom_area(position = 'stack') +
scale_fill_manual(labels = c('Non-traditional Hubs', 'Traditional Hubs'),
values = c("#f26d00", "#003A70")) +
scale_y_continuous(labels = dollar_format(), limits = c(0, 60000), breaks = seq(0, 60000, 10000 / 2),
expand = expansion(0)) +
scale_x_continuous(expand = expansion(0)) +
labs(title = "U.S. multinationals' foreign R&D spending increasingly done in non-traditional hubs",
subtitle = "Total R&D spending by U.S. multinationals' foreign affiliates, not adjusted for inflation (millions of US $)",
caption = '<br>**Note:** Traditional hubs are the United Kingdom, Germany, France, Canada, and Japan. Non-traditional hubs are all other countries (mainly Israel, China, and India). The original figure appears in *Global Goliaths*, Brookings Institution Press, 2021. <br>
**Source:** Bureau of Economic Analaysis.') +
theme(legend.title = element_blank(),
legend.position = 'top',
legend.justification='left',
legend.box = "horizontal",
legend.margin = margin(0),
legend.key = element_blank(),
legend.direction = "horizontal",
plot.title.position = "plot",
plot.caption.position = "plot",
plot.caption = element_textbox_simple(hjust = 0)
) +
guides(fill = guide_legend(reverse = T, nrow = 1))
```
## Figure 8
```{r fig11}
df <- readxl::read_xlsx('data/data.xlsx', sheet = 'figure 1-7')
df %>% summarize(date,
share = foreign / total) %>%
pivot_longer(share) %>%
ggplot(aes(x = date, y = value, color = name)) +
geom_line(size = 1.2) +
scale_color_hutchins() +
scale_y_continuous(labels = scales::percent_format(accuracy = 1),
limits = c(0, 0.4),
breaks = seq(0, 0.4, 0.05),
expand = expansion(0)) +
scale_x_continuous(limits = c(1982, 2017),
breaks = seq(1982, 2017, by = 5)) +
labs(title = "A growing share of U.S. multinationals' workers are overseas",
subtitle = "Share of employees of U.S. multinationals who work abroad",
caption = caption_text) +
theme(legend.position = 'none')
```