Created
May 17, 2022 14:05
-
-
Save graebnerc/346608931c440c1a27cd431476b43779 to your computer and use it in GitHub Desktop.
Replikation der Abbildung zum Rebound Effekt im Wohnsektor
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Code zur Replikation der Abbildung im Blogbeitrag "Zur ökonomischen Bedeutung des Genugs: Warum Suffizienz ein größere Rolle in den Wirtschaftswissenschaften spielen sollte" | |
Die Rohdaten (`Datensatz Daten_Wohnflaeche_Rebound.xlsx`) sind aus den im Blog verlinkten Quellen entnommen und können von Frauke Wiese angefordert werden. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Jahr | Wohnfläche pro Kopf | kWh/m2*a Wohnfläche | kWh/Person*a | |
---|---|---|---|---|
1990 | 34.8 | 243.963888888889 | 8489.94333333333 | |
1991 | 34.9 | 230.455555555556 | 8042.89888888889 | |
1992 | 35.1 | 233.088888888889 | 8181.42 | |
1993 | 35.4 | 235.875 | 8349.975 | |
1994 | 36.2 | 243.344444444444 | 8809.06888888889 | |
1995 | 36.7 | 235.977777777778 | 8660.38444444444 | |
1996 | 37.2 | 229.633333333333 | 8542.36 | |
1997 | 37.9 | 241.461111111111 | 9151.37611111111 | |
1998 | 38.4 | 242.05 | 9294.72 | |
1999 | 39 | 239.55 | 9342.45 | |
2000 | 39.5 | 239.913888888889 | 9476.59861111111 | |
2001 | 39.8 | 229.169444444444 | 9120.94388888889 | |
2002 | 40.1 | 232.602777777778 | 9327.37138888889 | |
2003 | 40.5 | 229.847222222222 | 9308.8125 | |
2004 | 40.8 | 217.602777777778 | 8878.19333333333 | |
2005 | 41.2 | 215.436111111111 | 8875.96777777778 | |
2006 | 41.6 | 214.863888888889 | 8938.33777777778 | |
2007 | 41.9 | 204.280555555556 | 8559.35527777778 | |
2008 | 42.2 | 204.525 | 8630.955 | |
2009 | 42.5 | 202.283333333333 | 8597.04166666667 | |
2010 | 45 | 184.755555555556 | 8314 | |
2011 | 46.1 | 183.019444444444 | 8437.19638888889 | |
2012 | 46.2 | 178.005555555556 | 8223.85666666667 | |
2013 | 46.3 | 183.897222222222 | 8514.44138888889 | |
2014 | 46.5 | 171.511111111111 | 7975.26666666667 | |
2015 | 46.2 | 175.05 | 8087.31 | |
2016 | 46.5 | 177.313888888889 | 8245.09583333333 | |
2017 | 46.5 | 173.677777777778 | 8076.01666666667 | |
2018 | 46.7 | 178.672222222222 | 8343.99277777778 | |
2019 | 47 | 177.255555555556 | 8331.01111111111 | |
2020 | 47.4 | 176.408333333333 | 8361.755 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
here::i_am("rebound_data.R") | |
library(readxl) | |
library(dplyr) | |
library(here) | |
library(data.table) | |
# Datensatz Daten_Wohnflaeche_Rebound.xlsx kann bei Frauke Wiese | |
# angefordert werden. | |
cols_keep <- c( | |
"...2", | |
"gesamt", | |
"kWh/m2*a Wohnfläche", | |
"kWh/Person*a" | |
) | |
rebound_data_raw <- read_xlsx( | |
here("Daten_Wohnflaeche_Rebound.xlsx"), sheet = 1) | |
rebound_data <- rebound_data_raw %>% | |
dplyr::select(all_of(cols_keep)) %>% | |
dplyr::rename(Jahr=`...2`) %>% | |
dplyr::filter(str_detect(Jahr, "^[:digit:]+$")) %>% | |
dplyr::mutate(Jahr=as.double(Jahr)) %>% | |
dplyr::filter(Jahr>=1990) %>% | |
dplyr::rename( | |
`Wohnfläche pro Kopf`=gesamt | |
) | |
fwrite(rebound_data, file = here("rebound_data.csv")) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
here::i_am("rebound_plot.R") | |
library(data.table) | |
library(dplyr) | |
library(tidyr) | |
library(stringr) | |
library(scales) | |
library(ggplot2) | |
library(icaeDesign) | |
library(latex2exp) | |
library(here) | |
rebound_data <- fread(here("rebound_data.csv")) | |
rebound_data_normed = rebound_data %>% | |
dplyr::mutate( | |
`kWh/Person_normed` = `kWh/Person*a` / | |
dplyr::first(`kWh/Person*a`), | |
`Wohnfläche pro Kopf_normed` = `Wohnfläche pro Kopf` / | |
dplyr::first(`Wohnfläche pro Kopf`), | |
`kWh/m2*a Wohnfläche_normed` = `kWh/m2*a Wohnfläche` / | |
dplyr::first(`kWh/m2*a Wohnfläche`) | |
) %>% | |
dplyr::select(ends_with("normed"), all_of("Jahr")) %>% | |
tidyr::pivot_longer(cols = ends_with("normed")) %>% | |
dplyr::mutate(name=gsub("_normed", "", name)) | |
cols_used <- c( | |
`kWh/Person`=unname(get_euf_colors("blue")), | |
`Wohnfläche pro Kopf`=unname(get_euf_colors("red")), | |
`kWh/m2*a Wohnfläche`=unname(get_euf_colors("green")) | |
) | |
rebound_plot <- ggplot( | |
data = rebound_data_normed, | |
mapping = aes(x=Jahr, y=value, color=name, fill=name, group=name)) + | |
geom_line(key_glyph = draw_key_rect) + | |
scale_color_manual( | |
values = cols_used, | |
labels = c(TeX("kWh/Person"), TeX("Wohnfläche/Person"), | |
TeX("kWh/$m^2$ Wohnfläche"))) + | |
scale_y_continuous(labels = percent_format()) + | |
theme_icae() + | |
labs( | |
title = "Der Rebound-Effekt im Wohnbereich", | |
y = "1990=100%") + | |
theme( | |
axis.title.x = element_blank(), | |
legend.position = "bottom", | |
axis.text = element_text(size=8), | |
axis.title.y = element_text(size=10) | |
) | |
rebound_plot | |
ggsave( | |
plot = rebound_plot, | |
width = 5, height = 3, | |
filename = here("ReboundWohnen.pdf")) | |
ggsave( | |
plot = rebound_plot, | |
width = 5, height = 3, | |
filename = here("ReboundWohnen.png")) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment