-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path007_midterm_exam2_format.Rmd
109 lines (71 loc) · 7.07 KB
/
007_midterm_exam2_format.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
---
title: "Midterm Exam 2"
author:
- XXXXXXXX (Only code no name)
- XXXXXXXX (Only code no name)
- XXXXXXXX (Only code no name)
- XXXXXXXX (Only code no name)
- XXXXXXXX (Only code no name)
- XXXXXXXX (Only code no name)
date: ''
output:
word_document:
toc: yes
toc_depth: '3'
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = FALSE,
warning = FALSE,
message = FALSE,
fig.align = "center")
```
```{r, libraries}
library(tidyverse)
library(tidyquant)
library(lubridate)
library(readxl)
library(timetk)
library(zoo)
```
# Financial markets II
## Nominal and real interest rate
+ Enter into the Bank of the Republic (Colombia) using the route:
**http://www.banrep.gov.co/** > Estadísticas > ¡NUEVO! Estadísticas Banrep > CATÁLOGO DE SERIES > Precios e inflación > Índices de precios al consumidor > Índice de precios al consumidor (IPC) > Base 2018 > Mensual > DESCARGAR > Descargar datos en Excel
```{r}
infla_monthly_na_values <- read_excel(path = "007_ipc_serie_variaciones-2.xlsx",
sheet = 1,
range = "A2:B801") %>%
set_names(nm = c("date", "ipc")) %>%
mutate(date = ymd(date) %>% floor_date(unit = "month"),
infla = (ipc - lag(ipc, n = 12)) / lag(ipc, n = 12))
infla_monthly <- infla_monthly_na_values %>%
drop_na()
```
1. Calculate the annual inflation using the monthly CPI that you can find in the column "IPC" from `r (infla_monthly$date[1] %>% as.character() %>% str_sub(start = 1, end = 7))` to `r (infla_monthly$date[length(infla_monthly$date)] %>% as.character() %>% str_sub(start = 1, end = 7))`. **(5 points)**
**Observation 1**: If the CPI is measured monthly then to calculate the annual inflation for a particular month you must use the formula, $\pi_t=\frac{CPI_t - CPI_{t-12}}{CPI_{t-12}}$. For example if you want to calculate the annual inflation of January 2000 you need to use the CPI of January 2000 and January 1999.
**Observation 2**: Taking into account **Observation 1** you need to begin to calculate the annual inflation from `r (infla_monthly$date[1] %>% as.character() %>% str_sub(start = 1, end = 7))` and not from a date between `r (infla_monthly_na_values$date[1] %>% as.character() %>% str_sub(start = 1, end = 7))` and `r (infla_monthly_na_values$date[12] %>% as.character() %>% str_sub(start = 1, end = 7))` because you don't have data before these dates to apply the formula $\pi_t=\frac{CPI_t - CPI_{t-12}}{CPI_{t-12}}$.
+ Enter into the Bank of the Republic (Colombia) using the route:
**http://www.banrep.gov.co/** > Estadísticas > ¡NUEVO! Estadísticas Banrep > CATÁLOGO DE SERIES > Tasas de interés y sector financiero > Tasas de interés > Tasa de política monetaria > Diaria > DESCARGAR > Descargar datos en Excel
2. Calculate the mode (in statistics the mode is the value that appears most frequently) of the interest rate fixed by the Bank of the Republic (Colombia) (in the data it refers to the column "Tasa de política monetaria") **for each month in each year**. In case of a tie choose any value within the most frequent values **(5 points)**.
3. Calculate the real interest rate **for each month in each year** using the information found in point 1 and point 2, the information available and the formula $r_t = i_t - \pi_{t+12}$. **(5 points)**
**Observation 1**: The interest rate fixed by the Bank of the Republic (Colombia) is measure daily but the inflation is measure monthly. Therefore we are using the mode of the interest rate fixed by the Bank of the Republic (Colombia) for each month in each year so $i_t$ and $\pi_{t+12}$ are measure using the same periods. In that way all the variables are expressed monthly and $i_t$ will be equal to the mode of the interest rate fixed by the Bank of the Republic (Colombia) **for each month in each year**.
**Observation 2**: To calculate the real interest rate, keep in mind that it is not necessary to estimate an expected inflation rate since there is information from subsequent periods. Therefore $\pi_{t+12}$ is a variable that you already calculate in point 1.
**Observation 3**: To calculate the real interest rate, keep in mind that the nominal interest rate is expressed as **annual effective overdue**. In that sense, $\pi_{t+12}$ must be the inflation but 12 months later and that is why $\pi$ has a subscript equal to $t+12$.
4. Calculate the real interest rate **for each month in each year** using the information found in point 1 and point 2, the information available, the formula $1+r_t = \frac{1+i_t}{1+\pi_{t+12}}$ and taking into account the observations pointed out in point 3. **(5 points)**
**Observation 1**: Take into account that the objective is to calculate $r_t$ and not $1+r_t$.
**Observation 2**: To apply the formula $1+r_t = \frac{1+i_t}{1+\pi_{t+12}}$ to calculate $r_t$ take into account that $i_t$ and $\pi_{t+12}$ must be expressed in it's decimal form.
5. Plot the values of the interest rate fixed by the Bank of the Republic (Colombia) and the real interest rate for each month in each year using both formulas, $r_t = i_t - \pi_{t+12}$ and $1+r_t = \frac{1+i_t}{1+\pi_{t+12}}$, where the x-axis corresponds to the date and y-axis corresponds to the value of these variables. **(5 points)**
**Observation 1**: In the development of items 1 to 4, you will lose information from some periods. Therefore, when there is no data, do not indicate in the plot that a variable is equal to zero. It is not the same that a variable is equal to zero and that there is no data of this variable.
## Exercise 8
This exercises is taken from:
**Oliver Blanchard (2017) Macroeconomics (7 Edition)** > Chapter 6 Financial Markets II: The extended IS-LM model > Questions and Problems > Exercise 8
In Chapter 6 the following formula is presented:
$$(1+i_t)=(1-p_t)(1+i_t+x_t)+p_t*0$$
Where $p_t$ is the probability the bond does not pay at all (the bond issuer is bankrupt) and has a zero return, $i_t$ is the nominal policy interest rate and $x_t$ is the risk premium.
6. If the probability of bankruptcy is zero, what is the rate of interest on the risk bond? **(5 points)**
7. Calculate the probability of bankruptcy when the nominal interest rate for a risk borrower is $0.08(8\%)$ and the nominal policy interest rate is $0.03(3\%)$. **(5 points)**
8. Calculate the nominal interest rate for a borrower when the probability of bankruptcy is $0.01$ and the nominal policy interest rate is $0.04(4\%)$. **(5 points)**
9. The formula assumes that payment upon default is zero. In fact, it is often positive. How would you change the formula in this case? **(5 points)**
## Financial crisis of 2007–2008 in USA and IS-LM model
10. Explain **based on the extended IS-LM model**, using words and **attaching a plot**, how fiscal and monetary policy was used to mitigate the fall in real GDP during the financial crisis of 2007–2008 in USA. **(5 points)**
**Observation 1**: Be clear and precise in the explanation and please don’t include “bullshit” (Sorry for the last word but I did not find a better expression where I am using it in the sense indicated in **https://en.wikipedia.org/wiki/Bullshit**).