-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinflation.Rmd
62 lines (52 loc) · 1.68 KB
/
inflation.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
---
title: "Inflation Data"
author: "Aaron Peikert"
date: "`r Sys.Date()`"
output: pdf_document
repro:
packages:
- here
- tidyverse
- lubridate
- aaronpeikert/repro@fc7e884
scripts:
- R/prepare_inflation.R
data:
- data/raw/inflation.rds
---
```{r setup, include=FALSE}
repro::automate_load_packages()
repro::automate_load_scripts()
knitr::opts_chunk$set(echo = FALSE)
```
The dataset we use stems from the [Bank of England Research datasets](https://www.bankofengland.co.uk/statistics/research-datasets).
I quote:
> This dataset contains the individual responses to our Inflation Attitudes Survey, a quarterly survey of people’s feelings about inflation and other economic variables like the interest rate.
```{r load-inflation}
# code chunks can come from other scripts, this one is loaded from:
# `R/prepare_inflation.R`
```
```{r transform-inflation}
# this chunk is also loaded from the same script
# note that they must be empty and the names must correspond
```
For this dataset the **Bank of England** asked `r prettyNum(nrow(inflation), big.mark = ".", decimal.mark = ",")` people for their *opinion* on the perceived and expected inflation.
The survey has run quarterly since `r min(inflation$year)`.
```{r}
inflation %>%
group_by(date) %>%
summarise(across(c(perception, expectation),
~ mean(., na.rm = TRUE)),
.groups = "drop") %>%
pivot_longer(c(expectation, perception)) %>%
ungroup() %>%
ggplot() +
geom_line(aes(date, value, color = name)) + theme_minimal() +
ylab("subjective inflation in %-points") +
labs(color = "") +
theme(legend.position = c(.1, .9)) +
NULL
```
```{r}
with(mtcars, plot(hp, mpg))
```