Energy
Data - Fred
Info
Data on energy
source | dataset | .html | .RData |
---|---|---|---|
ec | WOB | 2024-09-15 | 2024-08-25 |
eurostat | ei_isen_m | 2024-11-08 | 2024-10-09 |
eurostat | nrg_bal_c | 2023-12-31 | 2024-10-08 |
eurostat | nrg_pc_202 | 2024-11-05 | 2024-10-08 |
eurostat | nrg_pc_203 | 2023-06-11 | 2024-10-08 |
eurostat | nrg_pc_203_c | 2024-11-05 | 2024-10-08 |
eurostat | nrg_pc_203_h | 2024-11-05 | 2024-11-09 |
eurostat | nrg_pc_203_v | 2024-11-05 | 2024-10-08 |
eurostat | nrg_pc_204 | 2024-11-05 | 2024-11-21 |
eurostat | nrg_pc_205 | 2023-06-11 | 2024-10-08 |
fred | energy | 2024-11-17 | 2024-11-21 |
iea | world_energy_balances_highlights_2022 | 2024-06-20 | 2023-04-24 |
wb | CMO | 2024-06-20 | 2024-05-23 |
wdi | EG.GDP.PUSE.KO.PP.KD | 2024-09-18 | 2024-09-18 |
wdi | EG.USE.PCAP.KG.OE | 2024-09-18 | 2024-09-18 |
yahoo | energy | 2024-11-05 | 2024-11-05 |
Data on industry
source | dataset | .html | .RData |
---|---|---|---|
ec | INDUSTRY | 2024-09-15 | 2023-10-01 |
eurostat | ei_isin_m | 2024-11-08 | 2024-10-09 |
eurostat | htec_trd_group4 | 2024-11-08 | 2024-10-08 |
eurostat | nama_10_a64 | 2024-11-16 | 2024-11-16 |
eurostat | nama_10_a64_e | 2024-11-16 | 2024-11-16 |
eurostat | namq_10_a10_e | 2024-11-16 | 2024-11-16 |
eurostat | road_eqr_carmot | 2024-11-05 | 2024-10-08 |
eurostat | sts_inpp_m | 2024-06-24 | 2024-11-17 |
eurostat | sts_inppd_m | 2024-11-17 | 2024-11-17 |
eurostat | sts_inpr_m | 2024-11-05 | 2024-10-08 |
eurostat | sts_intvnd_m | 2024-11-18 | 2024-11-18 |
fred | industry | 2024-11-09 | 2024-11-21 |
oecd | ALFS_EMP | 2024-04-16 | 2024-05-12 |
oecd | BERD_MA_SOF | 2024-04-16 | 2023-09-09 |
oecd | GBARD_NABS2007 | 2024-04-16 | 2023-11-22 |
oecd | MEI_REAL | 2024-05-12 | 2024-05-03 |
oecd | MSTI_PUB | 2024-09-15 | 2023-10-04 |
oecd | SNA_TABLE4 | 2024-09-15 | 2024-11-18 |
wdi | NV.IND.EMPL.KD | 2024-01-06 | 2024-09-18 |
wdi | NV.IND.MANF.CD | 2024-09-18 | 2024-09-18 |
wdi | NV.IND.MANF.ZS | 2024-01-06 | 2024-09-18 |
wdi | NV.IND.TOTL.KD | 2024-01-06 | 2024-09-18 |
wdi | NV.IND.TOTL.ZS | 2024-01-06 | 2024-09-18 |
wdi | SL.IND.EMPL.ZS | 2024-01-06 | 2024-09-18 |
wdi | TX.VAL.MRCH.CD.WT | 2024-01-06 | 2024-09-18 |
LAST_COMPILE
LAST_COMPILE |
---|
2024-11-21 |
Last
date | Nobs |
---|---|
2024-11-18 | 3 |
variable
variable | Variable | Nobs |
---|---|---|
CP0451MI15EA20M086NEST | Harmonized Index of Consumer Prices: Electricity for Euro area (20 countries) | 299 |
CP0452MI15EA20M086NEST | Harmonized Index of Consumer Prices: Gas for Euro area (20 countries) | 299 |
CP0722MI15EA20M086NEST | Harmonized Index of Consumer Prices: Transport services for Euro area (20 countries) | 299 |
CPIAUCSL | Consumer Price Index for All Urban Consumers: All Items in U.S. City Average | 934 |
CUSR0000SEHF01 | Consumer Price Index for All Urban Consumers: Electricity in U.S. City Average | 874 |
CUSR0000SEHF02 | Consumer Price Index for All Urban Consumers: Utility (Piped) Gas Service in U.S. City Average | 874 |
CUSR0000SETB | Consumer Price Index for All Urban Consumers: Motor Fuel in U.S. City Average | 694 |
DCOILBRENTEU | Crude Oil Prices: Brent - Europe | 9784 |
DCOILWTICO | Crude Oil Prices: West Texas Intermediate (WTI) - Cushing, Oklahoma | 10143 |
DGHERG3A086NBEA | Personal consumption expenditures: Services: Household utilities: Natural gas (chain-type price index) | 95 |
GASREGW | US Regular All Formulations Gas Price | 1788 |
IR10110 | Import Price Index (End Use): Natural Gas | 518 |
MHHNGSP | Henry Hub Natural Gas Spot Price | 334 |
MICH | University of Michigan: Inflation Expectation | 561 |
NYGDPMKTPCDWLD | Gross Domestic Product for World | 64 |
OILPRODWLD | World production of Oil, Unit: Ktoe, Source: OECD | 51 |
PNGASEUUSDM | Global price of Natural gas, EU | 478 |
WPU0531 | Producer Price Index by Commodity: Fuels and Related Products and Power: Natural Gas | 694 |
WTISPLC | Spot Crude Oil Price: West Texas Intermediate (WTI) | 946 |
Electricity, Natural gas
Since 2020
Inflation (1st difference)
Code
%>%
energy filter(variable %in% c("CUSR0000SEHF01", "CUSR0000SEHF02", "CP0451MI15EA20M086NEST", "CP0452MI15EA20M086NEST")) %>%
select(date, variable, value) %>%
group_by(variable) %>%
arrange(date) %>%
mutate(value = value/lag(value, 12) - 1) %>%
filter(date >= as.Date("2020-01-01")) %>%
mutate(country = case_when(variable %in% c("CUSR0000SEHF01", "CUSR0000SEHF02") ~ "United States (CPI)",
%in% c("CP0451MI15EA20M086NEST", "CP0452MI15EA20M086NEST") ~ "Euro area (HICP)"),
variable type = case_when(variable %in% c("CUSR0000SEHF01", "CP0451MI15EA20M086NEST") ~ "Electricity",
%in% c("CUSR0000SEHF02", "CP0452MI15EA20M086NEST") ~ "Natural gas")) %>%
variable %>%
na.omit ggplot(.) + geom_line(aes(x = date, y = value, color = country, linetype = type)) + theme_minimal() +
scale_x_date(breaks = seq.Date(from = as.Date("2020-01-01"), to = Sys.Date(), by = "2 months"),
labels = scales::date_format("%b %Y")) +
scale_y_continuous(breaks = 0.01*seq(-60, 100, 5),
labels = scales::percent_format(accuracy = 1)) +
scale_color_manual(values = c("#003399", "#B22234")) +
xlab("") + ylab("Inflation (%)") +
theme(legend.position = c(0.3, 0.78),
legend.title = element_blank(),
axis.text.x = element_text(angle = 45, vjust = 1, hjust = 1)) +
geom_vline(xintercept = as.Date("2022-06-01"), linetype = "dotted") +
geom_vline(xintercept = as.Date("2022-10-01"), linetype = "dotted")
Inflation Facet
Code
%>%
energy filter(variable %in% c("CUSR0000SEHF01", "CUSR0000SEHF02", "CP0451MI15EA20M086NEST", "CP0452MI15EA20M086NEST")) %>%
select(date, variable, value) %>%
group_by(variable) %>%
arrange(date) %>%
mutate(value = value/lag(value, 12) - 1) %>%
filter(date >= as.Date("2021-01-01")) %>%
mutate(country = case_when(variable %in% c("CUSR0000SEHF01", "CUSR0000SEHF02") ~ "United States (CPI)",
%in% c("CP0451MI15EA20M086NEST", "CP0452MI15EA20M086NEST") ~ "Euro area (HICP)"),
variable type = case_when(variable %in% c("CUSR0000SEHF01", "CP0451MI15EA20M086NEST") ~ "Electricity",
%in% c("CUSR0000SEHF02", "CP0452MI15EA20M086NEST") ~ "Natural gas")) %>%
variable %>%
na.omit ggplot(.) + geom_line(aes(x = date, y = value, color = country)) + theme_minimal() +
scale_x_date(breaks = seq.Date(from = as.Date("2021-03-01"), to = Sys.Date(), by = "6 months"),
labels = scales::date_format("%b %Y")) +
scale_y_continuous(breaks = 0.01*seq(-60, 100, 5),
labels = scales::percent_format(accuracy = 1)) +
scale_color_manual(values = c("#003399", "#B22234")) +
xlab("") + ylab("Inflation (%)") +
theme(legend.position = "top",
legend.title = element_blank(),
axis.text.x = element_text(angle = 45, vjust = 1, hjust = 1)) +
geom_vline(xintercept = as.Date("2022-06-01"), linetype = "dotted") +
geom_vline(xintercept = as.Date("2022-10-01"), linetype = "dotted") +
facet_wrap(~ type)
Inflation Facet
English
Code
%>%
energy filter(variable %in% c("CUSR0000SEHF01", "CUSR0000SEHF02",
"CP0451MI15EA20M086NEST", "CP0452MI15EA20M086NEST",
"CP0722MI15EA20M086NEST", "CUSR0000SETB")) %>%
select(date, variable, value) %>%
group_by(variable) %>%
arrange(date) %>%
mutate(value = value/lag(value, 12) - 1) %>%
filter(date >= as.Date("2021-01-01")) %>%
mutate(country = case_when(variable %in% c("CUSR0000SEHF01", "CUSR0000SEHF02", "CUSR0000SETB") ~ "US (CPI)",
%in% c("CP0451MI15EA20M086NEST", "CP0452MI15EA20M086NEST", "CP0722MI15EA20M086NEST") ~ "Euro area (HICP)"),
variable type = case_when(variable %in% c("CUSR0000SEHF01", "CP0451MI15EA20M086NEST") ~ "Electricity",
%in% c("CUSR0000SEHF02", "CP0452MI15EA20M086NEST") ~ "Natural gas",
variable %in% c("CUSR0000SETB", "CP0722MI15EA20M086NEST") ~ "Fuel"),
variable type = factor(type, levels = c("Natural gas", "Electricity", "Fuel"))) %>%
%>%
na.omit ggplot(.) + geom_line(aes(x = date, y = value, color = country)) + theme_minimal() +
scale_x_date(breaks = seq.Date(from = as.Date("2021-03-01"), to = Sys.Date(), by = "6 months"),
labels = scales::date_format("%b %Y")) +
scale_y_continuous(breaks = 0.01*seq(-60, 100, 5),
labels = scales::percent_format(accuracy = 1)) +
scale_color_manual(values = c("#003399", "#B22234")) +
xlab("") + ylab("Inflation (%)") +
theme(legend.position = "top",
legend.title = element_blank(),
axis.text.x = element_text(angle = 45, vjust = 1, hjust = 1)) +
geom_vline(xintercept = as.Date("2022-06-01"), linetype = "dotted") +
geom_vline(xintercept = as.Date("2022-10-01"), linetype = "dotted") +
facet_wrap(~ type)
French
Code
Sys.setlocale("LC_TIME", "fr_CA.UTF-8")
# [1] "fr_CA.UTF-8"
Code
%>%
energy filter(variable %in% c("CUSR0000SEHF01", "CUSR0000SEHF02",
"CP0451MI15EA20M086NEST", "CP0452MI15EA20M086NEST",
"CP0722MI15EA20M086NEST", "CUSR0000SETB")) %>%
select(date, variable, value) %>%
group_by(variable) %>%
arrange(date) %>%
mutate(value = value/lag(value, 12) - 1) %>%
filter(date >= as.Date("2021-01-01")) %>%
mutate(country = case_when(variable %in% c("CUSR0000SEHF01", "CUSR0000SEHF02", "CUSR0000SETB") ~ "États-Unis (CPI)",
%in% c("CP0451MI15EA20M086NEST", "CP0452MI15EA20M086NEST", "CP0722MI15EA20M086NEST") ~ "Zone euro (IPCH)"),
variable type = case_when(variable %in% c("CUSR0000SEHF01", "CP0451MI15EA20M086NEST") ~ "Électricité",
%in% c("CUSR0000SEHF02", "CP0452MI15EA20M086NEST") ~ "Gaz naturel",
variable %in% c("CUSR0000SETB", "CP0722MI15EA20M086NEST") ~ "Carburants"),
variable type = factor(type, levels = c("Gaz naturel", "Électricité", "Carburants")),
country = factor(country, levels = c("Zone euro (IPCH)", "États-Unis (CPI)"))) %>%
%>%
na.omit ggplot(.) + geom_line(aes(x = date, y = value, color = country)) + theme_minimal() +
scale_x_date(breaks = seq.Date(from = as.Date("2021-01-01"), to = Sys.Date(), by = "3 months"),
labels = scales::date_format("%b %Y")) +
scale_y_continuous(breaks = 0.01*seq(-60, 100, 5),
labels = scales::percent_format(accuracy = 1)) +
scale_color_manual(values = c("#003399", "#B22234")) +
xlab("") + ylab("Inflation sur un an (%)") +
theme(legend.position = "top",
legend.title = element_blank(),
axis.text.x = element_text(angle = 45, vjust = 1, hjust = 1)) +
geom_vline(xintercept = as.Date("2022-06-01"), linetype = "dotted") +
geom_vline(xintercept = as.Date("2022-10-01"), linetype = "dotted") +
facet_wrap(~ type)
Code
Sys.setlocale("LC_TIME", "en_CA.UTF-8")
# [1] "en_CA.UTF-8"
Price Index
Code
%>%
energy filter(variable %in% c("CUSR0000SEHF01", "CUSR0000SEHF02", "CP0451MI15EA20M086NEST", "CP0452MI15EA20M086NEST")) %>%
select(date, variable, value) %>%
filter(date >= as.Date("2020-01-01")) %>%
group_by(variable) %>%
arrange(date) %>%
mutate(value = 100*value/value[1]) %>%
mutate(country = case_when(variable %in% c("CUSR0000SEHF01", "CUSR0000SEHF02") ~ "United States (CPI)",
%in% c("CP0451MI15EA20M086NEST", "CP0452MI15EA20M086NEST") ~ "Euro area (HICP)"),
variable type = case_when(variable %in% c("CUSR0000SEHF01", "CP0451MI15EA20M086NEST") ~ "Electricity",
%in% c("CUSR0000SEHF02", "CP0452MI15EA20M086NEST") ~ "Natural gas")) %>%
variable %>%
na.omit ggplot(.) + geom_line(aes(x = date, y = value, color = country, linetype = type)) + theme_minimal() +
scale_x_date(breaks = seq.Date(from = as.Date("2020-01-01"), to = Sys.Date(), by = "2 months"),
labels = scales::date_format("%b %Y")) +
scale_y_continuous(breaks = seq(100, 300, 10)) +
scale_color_manual(values = c("#003399", "#B22234")) +
xlab("") + ylab("Price Index (January 2020 = 100)") +
theme(legend.position = c(0.3, 0.78),
legend.title = element_blank(),
axis.text.x = element_text(angle = 45, vjust = 1, hjust = 1))
Price Index Facet
Code
%>%
energy filter(variable %in% c("CUSR0000SEHF01", "CUSR0000SEHF02", "CP0451MI15EA20M086NEST", "CP0452MI15EA20M086NEST")) %>%
select(date, variable, value) %>%
filter(date >= as.Date("2020-01-01")) %>%
group_by(variable) %>%
arrange(date) %>%
mutate(value = 100*value/value[1]) %>%
mutate(country = case_when(variable %in% c("CUSR0000SEHF01", "CUSR0000SEHF02") ~ "United States (CPI)",
%in% c("CP0451MI15EA20M086NEST", "CP0452MI15EA20M086NEST") ~ "Euro area (HICP)"),
variable type = case_when(variable %in% c("CUSR0000SEHF01", "CP0451MI15EA20M086NEST") ~ "Electricity",
%in% c("CUSR0000SEHF02", "CP0452MI15EA20M086NEST") ~ "Natural gas")) %>%
variable %>%
na.omit ggplot(.) + geom_line(aes(x = date, y = value, color = country)) + theme_minimal() +
scale_x_date(breaks = seq.Date(from = as.Date("2020-01-01"), to = Sys.Date(), by = "2 months"),
labels = scales::date_format("%b %Y")) +
scale_y_continuous(breaks = seq(100, 300, 10)) +
scale_color_manual(values = c("#003399", "#B22234")) +
xlab("") + ylab("Price Index (January 2020 = 100)") +
theme(legend.position = c(0.3, 0.78),
legend.title = element_blank(),
axis.text.x = element_text(angle = 45, vjust = 1, hjust = 1)) +
facet_wrap(~ type)
Natural Gas prices
Linear
All
Code
%>%
energy filter(variable %in% c("MHHNGSP", "PNGASEUUSDM")) %>%
left_join(variable, by = "variable") %>%
ggplot() + geom_line(aes(x = date, y = value, color = Variable)) + theme_minimal() +
theme(legend.title = element_blank(),
legend.position = c(0.5, 0.9)) +
scale_y_continuous(breaks = seq(0, 150, 5)) +
scale_x_date(breaks = as.Date(paste0(seq(1945, 2100, 5), "-01-01")),
labels = date_format("%Y")) +
xlab("") + ylab("U.S. Dollars per Million Metric British Thermal Unit")
1990-
Linear
Code
%>%
energy filter(variable %in% c("MHHNGSP", "PNGASEUUSDM")) %>%
left_join(variable, by = "variable") %>%
filter(date >= as.Date("1990-01-01")) %>%
ggplot() + geom_line(aes(x = date, y = value, color = Variable)) + theme_minimal() +
theme(legend.title = element_blank(),
legend.position = c(0.5, 0.9)) +
scale_y_continuous(breaks = seq(0, 150, 5)) +
scale_x_date(breaks = as.Date(paste0(seq(1945, 2100, 5), "-01-01")),
labels = date_format("%Y")) +
xlab("") + ylab("U.S. Dollars per Million Metric British Thermal Unit")
2004-
Code
%>%
energy filter(variable %in% c("MHHNGSP", "PNGASEUUSDM")) %>%
left_join(variable, by = "variable") %>%
filter(date >= as.Date("2004-01-01")) %>%
ggplot() + geom_line(aes(x = date, y = value, color = Variable)) + theme_minimal() +
theme(legend.title = element_blank(),
legend.position = c(0.5, 0.9)) +
scale_y_continuous(breaks = seq(0, 150, 5)) +
scale_x_date(breaks = as.Date(paste0(seq(1945, 2100, 2), "-01-01")),
labels = date_format("%Y")) +
xlab("") + ylab("U.S. Dollars per Million Metric British Thermal Unit")
Last 10 years
Code
%>%
energy filter(variable %in% c("MHHNGSP", "PNGASEUUSDM")) %>%
left_join(variable, by = "variable") %>%
filter(date >= Sys.Date() - years(10)) %>%
ggplot() + geom_line(aes(x = date, y = value, color = Variable)) + theme_minimal() +
theme(legend.title = element_blank(),
legend.position = c(0.5, 0.9)) +
scale_y_continuous(breaks = seq(0, 150, 5)) +
scale_x_date(breaks = as.Date(paste0(seq(1945, 2100, 1), "-01-01")),
labels = date_format("%Y")) +
xlab("") + ylab("U.S. Dollars per Million Metric British Thermal Unit")
Last 5 years
Code
%>%
energy filter(variable %in% c("MHHNGSP", "PNGASEUUSDM")) %>%
left_join(variable, by = "variable") %>%
filter(date >= Sys.Date() - years(5)) %>%
ggplot() + geom_line(aes(x = date, y = value, color = Variable)) + theme_minimal() +
theme(legend.title = element_blank(),
legend.position = c(0.5, 0.9)) +
scale_y_continuous(breaks = seq(0, 150, 5)) +
scale_x_date(breaks = as.Date(paste0(seq(1945, 2100, 1), "-01-01")),
labels = date_format("%Y")) +
xlab("") + ylab("U.S. Dollars per Million Metric British Thermal Unit")
GASREGW, MICH
Linear
All
Code
%>%
energy filter(variable %in% c("GASREGW", "MICH")) %>%
left_join(variable, by = "variable") %>%
ggplot() + geom_line(aes(x = date, y = value, color = Variable)) + theme_minimal() +
theme(legend.title = element_blank(),
legend.position = c(0.5, 0.9)) +
scale_y_continuous(breaks = seq(0, 150, .5)) +
scale_x_date(breaks = as.Date(paste0(seq(1945, 2100, 5), "-01-01")),
labels = date_format("%Y")) +
xlab("") + ylab("Inflation Expectations (%), Gallon of Oil ($)")
1990-
Code
%>%
energy filter(variable %in% c("GASREGW", "MICH")) %>%
left_join(variable, by = "variable") %>%
filter(date >= as.Date("1990-01-01")) %>%
ggplot() + geom_line(aes(x = date, y = value, color = Variable)) + theme_minimal() +
theme(legend.title = element_blank(),
legend.position = c(0.3, 0.9)) +
scale_y_continuous(breaks = seq(0, 150, .5)) +
scale_x_date(breaks = as.Date(paste0(seq(1945, 2100, 5), "-01-01")),
labels = date_format("%Y")) +
xlab("") + ylab("Inflation Expectations (%), Gallon of Oil ($)")
1995-
English
Code
%>%
energy filter(variable %in% c("GASREGW", "MICH")) %>%
left_join(variable, by = "variable") %>%
filter(date >= as.Date("1995-01-01")) %>%
ggplot() + geom_line(aes(x = date, y = value, color = Variable)) + theme_minimal() +
theme(legend.title = element_blank(),
legend.position = c(0.25, 0.9)) +
scale_y_continuous(breaks = seq(0, 150, .5)) +
scale_color_manual(values = viridis(2)[1:2]) +
scale_x_date(breaks = as.Date(paste0(seq(1945, 2100, 2), "-01-01")),
labels = date_format("%Y")) +
xlab("") + ylab("Inflation Expectations (%), Gallon of Oil ($)")
Français
Code
%>%
energy filter(variable %in% c("GASREGW", "MICH")) %>%
left_join(variable, by = "variable") %>%
mutate(Variable = case_when(variable == "GASREGW" ~ "Prix du pétrole à la pompe ($/gallon)",
== "MICH" ~ "Université du Michigan: Anticipations d'inflation (%)")) %>%
variable filter(date >= as.Date("1990-01-01")) %>%
ggplot() + geom_line(aes(x = date, y = value, color = Variable)) + theme_minimal() +
theme(legend.title = element_blank(),
legend.position = c(0.7, 0.1)) +
scale_y_continuous(breaks = seq(0, 150, .5)) +
scale_color_manual(values = viridis(2)[2:1]) +
scale_x_date(breaks = as.Date(paste0(seq(1945, 2100, 5), "-01-01")),
labels = date_format("%Y")) +
xlab("") + ylab("Université du Michigan: Anticipations d'inflation (%)\nPrix du pétrole à la pompe ($/gallon)")
2004-
Code
%>%
energy filter(variable %in% c("GASREGW", "MICH")) %>%
#add_row(variable = "MICH", date = as.Date("2023-05-01"), value = 4.2) %>%
#add_row(variable = "MICH", date = as.Date("2023-06-01"), value = 3.3) %>%
left_join(variable, by = "variable") %>%
filter(date >= as.Date("2004-01-01")) %>%
arrange(desc(date)) %>%
ggplot() + geom_line(aes(x = date, y = value, color = Variable)) + theme_minimal() +
theme(legend.title = element_blank(),
legend.position = c(0.5, 0.9)) +
scale_y_continuous(breaks = seq(0, 150, .5)) +
scale_x_date(breaks = as.Date(paste0(seq(1945, 2100, 2), "-01-01")),
labels = date_format("%Y")) +
xlab("") + ylab("Inflation Expectations (%), Gallon of Oil ($)")
Last 10 years
Code
%>%
energy filter(variable %in% c("GASREGW", "MICH")) %>%
left_join(variable, by = "variable") %>%
filter(date >= Sys.Date() - years(10)) %>%
ggplot() + geom_line(aes(x = date, y = value, color = Variable)) + theme_minimal() +
theme(legend.title = element_blank(),
legend.position = c(0.5, 0.9)) +
scale_y_continuous(breaks = seq(0, 150, .5)) +
scale_x_date(breaks = as.Date(paste0(seq(1945, 2100, 1), "-01-01")),
labels = date_format("%Y")) +
xlab("") + ylab("Inflation Expectations (%), Gallon of Oil ($)")
Last 5 years
Code
%>%
energy filter(variable %in% c("GASREGW", "MICH")) %>%
left_join(variable, by = "variable") %>%
filter(date >= Sys.Date() - years(5)) %>%
ggplot() + geom_line(aes(x = date, y = value, color = Variable)) + theme_minimal() +
theme(legend.title = element_blank(),
legend.position = c(0.3, 0.9)) +
scale_y_continuous(breaks = seq(0, 150, .5)) +
scale_x_date(breaks = as.Date(paste0(seq(1945, 2100, 1), "-01-01")),
labels = date_format("%Y")) +
xlab("") + ylab("Inflation Expectations (%), Gallon of Oil ($)")
Oil
All
Linear
Code
<- energy %>%
plot_linear filter(variable %in% c("WTISPLC")) %>%
ggplot() + labs(x = "Observation Date", y = "Rate") + theme_minimal() +
geom_line(aes(x = date, y = value)) +
geom_rect(data = nber_recessions %>%
filter(Peak > as.Date("1945-01-01")),
aes(xmin = Peak, xmax = Trough, ymin = 0, ymax = +Inf),
fill = 'grey', alpha = 0.5) +
theme(legend.title = element_blank(),
legend.position = c(0.8, 0.2)) +
scale_x_date(breaks = as.Date(paste0(seq(1945, 2100, 10), "-01-01")),
labels = date_format("%Y")) +
scale_y_continuous(breaks = seq(0, 150, 25),
labels = scales::dollar_format(accuracy = 1)) +
xlab("") + ylab("Barrel Price")
plot_linear
Log
Code
<- plot_linear +
plot_log scale_y_log10(breaks = c(1, 2, 3, 5, 8, 10, 20, 30, 50, 80, 100, 120, 150),
labels = scales::dollar_format(accuracy = 1))
plot_log
Both
Code
::ggarrange(plot_linear + ggtitle("Linear"), plot_log + ggtitle("Log") + ylab("")) ggpubr
1955
Linear
Code
<- energy %>%
plot_linear filter(variable %in% c("WTISPLC"),
>= as.Date("1955-01-01")) %>%
date ggplot() + labs(x = "Observation Date", y = "Rate") + theme_minimal() +
geom_line(aes(x = date, y = value)) +
geom_rect(data = nber_recessions %>%
filter(Peak > as.Date("1955-01-01")),
aes(xmin = Peak, xmax = Trough, ymin = 0, ymax = +Inf),
fill = 'grey', alpha = 0.5) +
theme(legend.title = element_blank(),
legend.position = c(0.8, 0.2)) +
scale_x_date(breaks = as.Date(paste0(seq(1945, 2100, 10), "-01-01")),
labels = date_format("%Y")) +
scale_y_continuous(breaks = seq(0, 150, 25),
labels = scales::dollar_format(accuracy = 1)) +
xlab("") + ylab("Barrel Price")
plot_linear
Log
Code
<- plot_linear +
plot_log scale_y_log10(breaks = c(1, 2, 3, 5, 8, 10, 20, 30, 50, 80, 100, 120, 150),
labels = scales::dollar_format(accuracy = 1))
plot_log
Both
Code
::ggarrange(plot_linear + ggtitle("Linear"), plot_log + ggtitle("Log") + ylab("")) ggpubr
1970-
Linear
Code
<- energy %>%
plot_linear filter(variable %in% c("WTISPLC"),
>= as.Date("1970-01-01")) %>%
date ggplot() + labs(x = "Observation Date", y = "Rate") + theme_minimal() +
geom_line(aes(x = date, y = value)) +
geom_rect(data = nber_recessions %>%
filter(Peak > as.Date("1970-01-01")),
aes(xmin = Peak, xmax = Trough, ymin = 0, ymax = +Inf),
fill = 'grey', alpha = 0.5) +
theme(legend.title = element_blank(),
legend.position = c(0.8, 0.2)) +
scale_x_date(breaks = as.Date(paste0(seq(1945, 2100, 10), "-01-01")),
labels = date_format("%Y")) +
scale_y_continuous(breaks = seq(0, 150, 25),
labels = scales::dollar_format(accuracy = 1)) +
xlab("") + ylab("Barrel Price")
plot_linear
Log
Code
<- plot_linear +
plot_log scale_y_log10(breaks = c(1, 2, 3, 5, 8, 10, 20, 30, 50, 80, 100, 120, 150),
labels = scales::dollar_format(accuracy = 1))
plot_log
Both
Code
::ggarrange(plot_linear + ggtitle("Linear"), plot_log + ggtitle("Log") + ylab("")) ggpubr
Oil, Real Oil
All
Linear
Code
<- energy %>%
plot_linear filter(variable %in% c("CPIAUCSL", "WTISPLC")) %>%
spread(variable, value) %>%
transmute(date, WTISPLC,
WTISPLC_real = CPIAUCSL[860]* WTISPLC / CPIAUCSL,) %>%
gather(variable, value, -date) %>%
mutate(Variable = case_when(variable == "WTISPLC" ~ "Oil Prices (WTI)",
== "WTISPLC_real" ~ "Real Oil Prices (WTI)")) %>%
variable select(variable, Variable, everything()) %>%
ggplot() + labs(x = "Observation Date", y = "Rate") + theme_minimal() +
geom_line(aes(x = date, y = value, color = Variable)) +
geom_rect(data = nber_recessions %>%
filter(Peak > as.Date("1928-01-01")),
aes(xmin = Peak, xmax = Trough, ymin = -Inf, ymax = +Inf),
fill = 'grey', alpha = 0.5) +
theme(legend.title = element_blank(),
legend.position = c(0.2, 0.9)) +
scale_y_continuous(breaks = seq(0, 150, 25),
labels = scales::dollar_format(accuracy = 1)) +
scale_x_date(breaks = as.Date(paste0(seq(1945, 2100, 10), "-01-01")),
labels = date_format("%Y"),
limits = c(as.Date("1945-01-01"), Sys.Date())) +
xlab("") + ylab("Barrel Price")
plot_linear
Log
Code
<- plot_linear +
plot_log geom_rect(data = nber_recessions %>%
filter(Peak > as.Date("1928-01-01")),
aes(xmin = Peak, xmax = Trough, ymin = 0, ymax = +Inf),
fill = 'grey', alpha = 0.5) +
scale_y_log10(breaks = c(1, 2, 3, 5, 8, 10, 20, 30, 50, 80, 100, 120, 150),
labels = scales::dollar_format(accuracy = 1))
plot_log
Both
Code
::ggarrange(plot_linear + ggtitle("Linear"),
ggpubr+ ggtitle("Log") + ylab(""),
plot_log common.legend = T)
1970-
Linear
Code
<- energy %>%
plot_linear filter(variable %in% c("CPIAUCSL", "WTISPLC")) %>%
spread(variable, value) %>%
transmute(date, WTISPLC,
WTISPLC_real = CPIAUCSL[860]* WTISPLC / CPIAUCSL,) %>%
gather(variable, value, -date) %>%
mutate(Variable = case_when(variable == "WTISPLC" ~ "Oil Prices (WTI)",
== "WTISPLC_real" ~ "Real Oil Prices (WTI)")) %>%
variable select(variable, Variable, everything()) %>%
filter(date >= as.Date("1970-01-01")) %>%
ggplot() + labs(x = "Observation Date", y = "Rate") + theme_minimal() +
geom_line(aes(x = date, y = value, color = Variable)) +
geom_rect(data = nber_recessions %>%
filter(Peak > as.Date("1928-01-01")),
aes(xmin = Peak, xmax = Trough, ymin = -Inf, ymax = +Inf),
fill = 'grey', alpha = 0.5) +
theme(legend.title = element_blank(),
legend.position = c(0.2, 0.9)) +
scale_y_continuous(breaks = seq(0, 150, 25),
labels = scales::dollar_format(accuracy = 1)) +
scale_x_date(breaks = as.Date(paste0(seq(1945, 2100, 10), "-01-01")),
labels = date_format("%Y"),
limits = c(as.Date("1970-01-01"), Sys.Date())) +
xlab("") + ylab("Barrel Price")
plot_linear
Log
Code
<- plot_linear +
plot_log scale_y_log10(breaks = c(1, 2, 3, 5, 8, 10, 20, 30, 50, 80, 100, 120, 150),
labels = scales::dollar_format(accuracy = 1))
plot_log
Both
Code
::ggarrange(plot_linear + ggtitle("Linear"),
ggpubr+ ggtitle("Log") + ylab(""),
plot_log common.legend = T)