-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path001_gdp.Rmd
528 lines (414 loc) · 20.8 KB
/
001_gdp.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
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
---
title: "Gross Domestic Product (GDP)"
author: Luis Francisco Gomez Lopez
date: 2021-01-27 19:45:02 GMT -05:00
output:
beamer_presentation:
colortheme: dolphin
fonttheme: structurebold
theme: AnnArbor
ioslides_presentation: default
slidy_presentation: default
bibliography: macro_faedis.bib
link-citations: yes
header-includes:
- \usepackage{booktabs}
- \usepackage{longtable}
- \usepackage{array}
- \usepackage{multirow}
- \usepackage{wrapfig}
- \usepackage{float}
- \usepackage{colortbl}
- \usepackage{pdflscape}
- \usepackage{tabu}
- \usepackage{threeparttable}
- \usepackage{threeparttablex}
- \usepackage[normalem]{ulem}
- \usepackage{makecell}
- \usepackage{xcolor}
---
```{r setup, include = FALSE}
knitr::opts_chunk$set(echo = FALSE,
warning = FALSE,
message = FALSE,
fig.align = "center")
```
```{r libraries}
library(tidyverse)
library(knitr)
library(kableExtra)
library(tidyquant)
library(wbstats)
```
# Contents
- Please Read Me
- Purpose
- Economic macroenvironment and the Company
- Metrics: Economic macroenvironment
- Gross Domestic Product (GDP)
- GDP: nominal and real
- Real GDP per-capita and its growth
- Acknowledgments
- References
# Please Read Me
- Check the message __Welcome greeting__ published in the News Bulletin Board.
- Dear student please edit your profile uploading a photo where your face is clearly visible.
- The purpose of the virtual meetings is to answer questions and not to make a summary of the study material.
- This presentation is based on [@blanchard_macroeconomics_2017, Chapters 1 & 2]
# Purpose
Introduce the students to the three (3) main variables in macroeconomics (production, inflation and unemployment) with an emphasis on how the two (2) first variables are measured (production and inflation).
# Economic macroenvironment and the company
- Set of external economic factors and forces that are not controlled by an organization but that influence its development.
```{r econ_env_macro, out.width = "75%"}
#Plot
ggplot(data = tibble(x = 0, y = 0)) +
## Company
annotate(geom = "text",
x = 0,
y = 0,
label = "Company",
size = 3,
fontface = "bold") +
geom_rect(aes(xmin = -0.4,
xmax = 0.4,
ymin = -0.4,
ymax = 0.4),
alpha = 0.3,
fill = "red",
color = "red") +
## Micro environment
geom_rect(aes(xmin = -2,
xmax = 2,
ymin = -2,
ymax = 2),
alpha = 0.25,
color = "blue") +
annotate(geom = "text",
x = 0,
y = 1,
label = str_glue("Micro environment"),
size = 6,
fontface = "bold") +
annotate(geom = "text",
x = 0,
y = -1.2,
label = str_glue("Clients - Suppliers - Intermediaries - Competitors - General Public"),
size = 3.5) +
## Macro environment
geom_rect(aes(xmin = -3,
xmax = 3,
ymin = -3,
ymax = 3),
alpha = 0.1,
color = "purple") +
annotate(geom = "text",
x = 0,
y = 2.5,
label = str_glue("Macro environment"),
size = 8,
fontface = "bold") +
annotate(geom = "text",
x = 0,
y = -2.5,
label = str_glue("Economic - Political - Social - Technological - Ecological - Legal"),
size = 5) +
theme_void() +
labs(caption = "Based on https://foda-dafo.com/ ")
```
# Metrics: Economic macroenvironment
- **Aggregate production**
+ Gross Domestic Product (GDP)
+ Nominal/Real, per-capita, purchase power parity
- **Prices**
+ Index
+ GDP deflator, Consumer price index, Producer Price Index
+ Inflation
+ Monthly, Annual, Accumulated (annual)
# Metrics: Economic macroenvironment
- **Exchange rate**
+ "Tasa Representativa del Mercado" (Colombia)
+ COP/USD, COP/EUR
- **Interest rate**
+ "Tasa de intervención del Banco de la República" (Colombia), Federal Funds Rate (USA), deposit rate (tasa de captación), placement rate (tasa de colocación)
# Metrics: Economic macroenvironment
Other metrics that we will not examine because the course is quite short but that are also relevant:
- **Consumer confidence**
+ Índice de Confianza del Consumidor (Fedesarrollo, Colombia)
+ Consumer Confidence Index (The Conference Board, USA)
- **Inequality**
+ Gini coefficient
- **Poverty**
+ Poverty line, Poverty Rate
+ Multidimensional Poverty Index
# Gross Domestic Product (GDP)
- **Product**: refers to what we are trying to measure as a result of a production process [@lequiller_understanding_2014].
- **Domestic**: indicates that the production to be taken into account is the one that is carried within a certain territory clearly delimited [@lequiller_understanding_2014].
- **Gross**: It means that depreciation is not deducted (in economy it is called consumption of fixed capital). In other words, the decrease in the value of the assets due to physical deterioration, foreseeable wear or accidental damage is not deducted [@lequiller_understanding_2014].
# Gross Domestic Product (GDP)
```{r tables_gdp}
#Tables
## Steel Company (Firm 1)
tibble(Categories = c("Steel sales",
"Expenses",
"Wages",
"Profit"),
Value = c(100, 80, 80, 20)) %>%
mutate(Value = Value %>% scales::dollar()) %>%
kable(format = "latex", booktabs = TRUE, caption = "Steel Company (Firm 1)") %>%
kable_styling(font_size = 7, latex_options = "striped") %>%
row_spec(row = 0, bold = TRUE) %>%
footnote(number = "Firm 1 sells $100 of steel to Firm 2")
## Car Company (Firm 2)
tibble(Categories = c("Revenue from sales",
"Expenses",
"Wages",
"Steel purchases",
"Profit"),
Value = c(200, 170, 70, 100, 30)) %>%
mutate(Value = Value %>% scales::dollar()) %>%
kable(format = "latex", booktabs = TRUE, caption = "Car Company (Firm 2)") %>%
kable_styling(font_size = 7, latex_options = "striped") %>%
row_spec(row = 0, bold = TRUE) %>%
footnote(number = "Firm 2 transfers the expenses of the purchases of steel to the final consumer")
```
# Gross Domestic Product (GDP)
- **Double counting problem**
+ If you add in monetary terms the production of both companies you get a total of $300.
+ However, at the end of the period with steel, workers and machines the economy produced only $200 in cars.
+ If the production of the Steel Company and the Car Company is added, the value of steel is being added two (2) times.
+ It is necessary to eliminate at some stage of the production process the value of steel in our example.
# Gross Domestic Product (GDP)
- GDP is the sum of value added in a territory during a given period.
In economics the **value added** is the value that is added at each stage of production. It is defined as the difference between the **Production in Monetary Terms (PMT)** and the **Consumption of Intermediate Goods (CIG)**.
The **CIG** is the monetary value of inputs that are *completely transformed and depleted* in the production process and that are used to produce other products.
# Gross Domestic Product (GDP)
- Example of inputs that are not part of the **CIG**:
+ **Wages paid by an organization to its workers**: labor can be used for several periods and although its value is affected in the periods close to the age of retirement of individuals, is not fully consumed in the production process.
+ **Assets that belong to an organization and depreciation (consumption of fixed capital)**: assets are durable goods that can be used for several periods of time and although their value is affected by physical deterioration, foreseeable wear and accidental damage, depreciation (consumption of fixed capital) is included in the GDP accounting.
# Gross Domestic Product (GDP)
* Steel Company (Firm 1)
+ **PMT**: $100
+ **CIG**: $0 ("Wages are not part of **CIG**")
+ **Value added**: \$100 - \$0 = \$100
* Car Company (Firm 2)
+ **PMT**: $200
+ **CIG**: $100 ("Wages are not part of **CIG**")
+ **Value added**: \$200 - \$100 = \$100
* GDP
+ **Total Value Added** = Value added Steel Company (Firm 1) + Value added Car Company (Firm 2) = \$100 + \$100 = **GDP**
# Gross Domestic Product (GDP)
- GDP is the sum of the different incomes in a territory during a given period.
It is the sum of all the different incomes that individuals perceive like salaries and benefits.
* Steel Company (Firm 1)
+ **Workers Income**: $80
+ **Owners/partners Income**: $20
* Car Company (Firm 2)
+ **Workers Income**: $70
+ **Owners/partners Income**: $30
* GDP
+ **Total Income** = \$80 + \$20 + \$70 + \$30 = \$200 = **GDP**
# Gross Domestic Product (GDP)
- GDP is the value of all the *final* goods and services produced in a territory during a given period.
To measure the final goods and services that are produced, the basic macroeconomic identity is used: **GDP = C + I + G + X**.
**C**: The final production can be consumed **within the territory** (consumption of households and non-profit institutions serving hosueholds).
**I**: The final production can be accumulated to consume in other periods **within the territory** (Investment or Gross capital formation).
**G**: The final production can be used to provide goods and services by the government **within the territory** (Goverment expenditure).
**X**: Production can be used to meet the needs of individuals or organizations **outside the territory** (Exports).
# Gross Domestic Product (GDP)
In our example, the final production are the sales of the Car Company (Firm 2): $200. The cars sold by this company can be exported or consumed by households within the territory.
We do not have a government or non-profit institutions nor do we assume that production accumulates, that is, there is no Investment or Gross capital formation.
- GDP
+ **Final production** = \$200 = **C + X + 0** = **C + I + G + X** = **GDP**
# GDP: nominal and real
A value in monetary or nominal terms is the result of multiplying prices by quantities. If a company produces 200 cars a year and sells at a price of \$50/car the production is 200 car * \$50/car = $10000.
In that sense, production in monetary terms can increase in three (3) ways:
- Only prices increase
- Only quantities increase
- Both prices and quantities increase
# GDP: nominal and real
```{r plot_gdp_nominal, out.width = "90%"}
# Plot
## Colombia GDP Nominal
wbstats::wb_data(country = c("COL"),
indicator = c("NY.GDP.MKTP.CN")) %>%
select(country, date, NY.GDP.MKTP.CN) %>%
ggplot(aes(x = date,
y = NY.GDP.MKTP.CN)) +
geom_point(shape = 21, fill = palette_light()[[2]], color = "black") +
geom_line() +
labs(x = "Year",
y = "Billions (Long scale)",
title = "Nominal GDP Colombia",
subtitle = str_glue("Variable code WDI: NY.GDP.MKTP.CN
Variable units: current LCU"),
caption = str_glue("Source: World Development Indicators (WDI) - World Bank
Last update date: 2020-12-16")) +
scale_y_continuous(labels = scales::number_format(scale = 1e-12,
suffix = "B")) +
theme(panel.border = element_rect(fill = NA, color = "black"),
plot.background = element_rect(fill = "#f3fcfc"),
panel.background = element_rect(fill = "#f3f7fc"),
legend.background = element_rect(fill = "#f3fcfc"),
plot.title = element_text(face = "bold"),
axis.title = element_text(face = "bold"),
legend.title = element_text(face = "bold"),
axis.text = element_text(face = "bold"))
```
# GDP: nominal and real
- Real GDP __tries__ to eliminate the effect that prices have on production to examine the increase in quantities.
- Real GDP measures the production within a territory for different periods usually using the same prices of a base period known as constant monetary units in the economic lingo.
- Example:
```{r example_gdp_nominal_real}
# Example
## GDP: nominal and real
tibble(Year = c(2008:2010),
Quantity_Cars = c(10, 12, 13),
Price_Cars = c(20000, 24000, 26000)) %>%
mutate(Nominal_GDP = Quantity_Cars * Price_Cars) %>%
mutate(Real_GDP_Base_2009 = Quantity_Cars * Price_Cars[2]) %>%
mutate_at(.vars = vars(Price_Cars:Real_GDP_Base_2009),
.funs = scales::dollar) %>%
set_names(nm = c("Year", "Quantity Cars",
"Price Cars", "Nominal GDP",
"Real GDP Base 2009")) %>%
kable(format = "latex", booktabs = TRUE) %>%
kable_styling(font_size = 9, latex_options = "striped") %>%
row_spec(row = 0, bold = TRUE)
```
# GDP: nominal and real
```{r plot_gdp_nominal_real, out.width = "90%"}
# Plot
## Colombia GDP Nominal and Real
wbstats::wb_data(country = c("COL"),
indicator = c("NY.GDP.MKTP.CN", "NY.GDP.MKTP.KN"),
return_wide = FALSE) %>%
select(country, date, value, indicator) %>%
ggplot(aes(x = date,
y = value)) +
geom_point(aes(fill = indicator), color = "black", shape = 21, show.legend = FALSE) +
geom_line(aes(color = indicator,
group = indicator)) +
geom_vline(xintercept = 2015,
color = palette_light()[[1]]) +
labs(x = "Year",
y = "Billions (Long scale)",
title = "Nominal and Real GDP Colombia",
subtitle = str_glue("Nominal GDP code WDI: NY.GDP.MKTP.CN
Nominal GDP units: current LCU
Real GDP code WDI: NY.GDP.MKTP.KN
Real GDP units: constant LCU Base Year 2015"),
caption = str_glue("Source: World Development Indicators (WDI) - World Bank
Last update date: 2020-12-16"),
color = "") +
scale_x_continuous(breaks = c(1960, 1980, 2000, 2015, 2020)) +
scale_y_continuous(labels = scales::number_format(scale = 1e-12,
suffix = "B")) +
scale_color_tq() +
scale_fill_tq() +
theme(panel.border = element_rect(fill = NA, color = "black"),
plot.background = element_rect(fill = "#f3fcfc"),
panel.background = element_rect(fill = "#f3f7fc"),
legend.background = element_rect(fill = "#f3fcfc"),
legend.position = "bottom",
plot.title = element_text(face = "bold"),
axis.title = element_text(face = "bold"),
legend.title = element_text(face = "bold"),
axis.text = element_text(face = "bold"))
```
# Real GDP per-capita and its growth
```{r plot_gdp_real_per_capita, out.width = "90%"}
# Plot
## Colombia Real GDP per-capita
wbstats::wb_data(country = c("COL"),
indicator = c("NY.GDP.PCAP.KN")) %>%
select(country, date, NY.GDP.PCAP.KN) %>%
ggplot(aes(x = date,
y = NY.GDP.PCAP.KN)) +
geom_point(color = "black", shape = 21, fill = palette_light()[[2]]) +
geom_line() +
geom_vline(xintercept = 2015,
color = palette_light()[[1]]) +
expand_limits(y = 0) +
annotate(geom = "label",
x = 1980,
y = 14e6,
label = str_glue("In the year 2015 Annual Real GDP per-capita
was $16,933,517.5
In the year 2015 the Annual Legal Minimum Wage
was $7,732,200 (not inlcuding other additional
benefits and working 12 months)"),
color = "white",
fill = palette_light()[[1]],
size = 4) +
labs(x = "Year",
y = "Millions",
title = "Real GDP per-capita Colombia",
subtitle = str_glue("Variable code WDI: NY.GDP.PCAP.KN
Variable units: constant LCU Base Year 2015"),
caption = str_glue("Source: World Development Indicators (WDI) - World Bank
Last update date: 2020-12-16")) +
scale_x_continuous(breaks = c(1960, 1980, 2000, 2015, 2020)) +
scale_y_continuous(labels = scales::number_format(scale = 1e-6,
suffix = "M",
accuracy = 1)) +
theme(panel.border = element_rect(fill = NA, color = "black"),
plot.background = element_rect(fill = "#f3fcfc"),
panel.background = element_rect(fill = "#f3f7fc"),
legend.background = element_rect(fill = "#f3fcfc"),
plot.title = element_text(face = "bold"),
axis.title = element_text(face = "bold"),
legend.title = element_text(face = "bold"),
axis.text = element_text(face = "bold"))
```
# Real GDP per-capita and its growth
```{r plot_growth_gdp_real_per_capita, out.width = "90%"}
# Plot
## Colombia Growth Real GDP per-capita
wbstats::wb_data(country = c("COL"),
indicator = c("NY.GDP.PCAP.KD.ZG")) %>%
select(country, date, NY.GDP.PCAP.KD.ZG) %>%
ggplot(aes(x = date,
y = NY.GDP.PCAP.KD.ZG)) +
geom_point(color = "black", fill = palette_light()[[2]], shape = 21) +
geom_line() +
geom_vline(xintercept = 1999,
color = palette_light()[[1]]) +
geom_hline(yintercept = 0,
color = palette_light()[[3]]) +
annotate(geom = "label",
x = 1980,
y = -4,
label = str_glue("In the year of 1999 there was a
negative annual real GDP growth
per capita at constant prices (Base
Year 2015).
Imagine the social implications
for a country when the average
real income decreases in that magnitude !!!"),
color = "white",
fill = palette_light()[[1]]) +
labs(x = "Year",
y = "Percent",
title = "Growth real GDP per-capita Colombia",
subtitle = str_glue("Variable code WDI: NY.GDP.PCAP.KD.ZG
Variable units: annual percent using constant LCU Base Year 2015"),
caption = str_glue("Source: World Development Indicators (WDI) - World Bank
Last update date: 2020-12-16")) +
scale_x_continuous(breaks = c(1960, 1980, 1999,2020)) +
scale_y_continuous(labels = scales::number_format(suffix = "%")) +
theme(panel.border = element_rect(fill = NA, color = "black"),
plot.background = element_rect(fill = "#f3fcfc"),
panel.background = element_rect(fill = "#f3f7fc"),
legend.background = element_rect(fill = "#f3fcfc"),
plot.title = element_text(face = "bold"),
axis.title = element_text(face = "bold"),
legend.title = element_text(face = "bold"),
axis.text = element_text(face = "bold"))
```
# Acknowledgments
- To my family that supports me
- To the taxpayers of Colombia and the __[UMNG students](https://www.umng.edu.co/estudiante)__ who pay my salary
- To the __[Business Science](https://www.business-science.io/)__ and __[R4DS Online Learning](https://www.rfordatasci.com/)__ communities where I learn __[R](https://www.r-project.org/about.html)__
- To the __[R Core Team](https://www.r-project.org/contributors.html)__, the creators of __[RStudio IDE](https://rstudio.com/products/rstudio/)__ and the authors and maintainers of the packages __[tidyverse](https://CRAN.R-project.org/package=tidyverse)__, __[knitr](https://CRAN.R-project.org/package=knitr)__, __[kableExtra](https://CRAN.R-project.org/package=kableExtra)__, __[tidyquant](https://CRAN.R-project.org/package=tidyquant)__, __[wbstats](https://CRAN.R-project.org/package=wbstats)__ and __[tinytex](https://CRAN.R-project.org/package=tinytex)__ for allowing me to access these tools without paying for a license
- To the __[Linux kernel community](https://www.kernel.org/category/about.html)__ for allowing me the possibility to use some __[Linux distributions](https://static.lwn.net/Distributions/)__ as my main __[OS](https://en.wikipedia.org/wiki/Operating_system)__ without paying for a license
# References