Chapter 5 Trends in expenditure items
In this section, I present some trends using the cleaned data of expenditure items.
5.1 Total expenditure across COICOP groups
Here is a piece of code showing the trend of expenditure items in real term:
library(tidyverse)
rm(list = ls())
<- list.files(path = "./../exported", pattern = "^EXP.*\\Rds$")
list_EXP
## merging different rounds
<- NULL
EXP for (year in list_EXP) {
<- assign(year, readRDS(paste0("./../exported/",year))) %>%
EXP mutate(year = parse_number(year)) %>%
bind_rows(EXP)
}
<- EXP %>%
exp mutate(Table = as_factor(case_when(
== 1 ~ "food",
table == 3 ~ "clothing",
table == 4 ~ "housing",
table == 6 ~ "health",
table == 7 ~ "transport",
table == 8 ~ "communication",
table == 9 | table == 11 ~ "recreation & restaurant",
table %in% c(12, 2) ~ "miscellaneous & tobacco",
table %in% c(13 , 5) ~ "durables & furniture",
table == 14 ~ "investment",
table TRUE ~ NA_character_))) %>%
group_by(Table, year) %>%
summarise(value_r=sum(Value_r,na.rm = T), value=sum(Value,na.rm = T))
ggplot(exp, aes(x=year, y=log(value_r), color=Table, shape=Table)) +
geom_point() + geom_line() +
ggtitle("Total real expenditure (log)") + ylab("") +
theme_bw()
5.3 Percapita expenditure across COICOP groups and regions
In the next step, we graph the trend of percapita expenditure of each item for the rural and urban areas. For this, we need the population of each round and we use household-level summary data for that:
library(tidyverse)
<- list.files(path = "./../exported", pattern = "^HH.*\\Rds$")
list_HH
## number of households and individuals across years
<- NULL
Pop for (year in list_HH) {
<- assign(year, readRDS(paste0("./../exported/",year))) %>%
Pop group_by(urban) %>%
summarize(hh=sum(weight, na.rm=T), ind=sum(size*weight, na.rm=T)) %>%
mutate(year = parse_number(year)) %>%
bind_rows(Pop)
rm(year)
}
<- EXP %>%
exp mutate(Table = as_factor(case_when(
== 1 ~ "food",
table == 2 ~ "tobacco",
table == 3 ~ "clothing",
table == 4 ~ "housing",
table == 5 ~ "furniture",
table == 6 ~ "health",
table == 7 ~ "transport",
table == 8 ~ "communication",
table == 9 | table == 11 ~ "recreation \n restaurant",
table == 12 ~ "miscellaneous",
table == 13 ~ "durables",
table == 14 ~ "investment",
table TRUE ~ NA_character_))) %>%
group_by(Table, year,urban) %>%
summarise(value_r=sum(Value_r,na.rm = T), value=sum(Value,na.rm = T)) %>%
left_join(Pop) %>%
mutate(value_r_ph=value_r/ind)
ggplot(exp, aes(x=year, y=log(value_r_ph), color=urban, shape=urban)) +
geom_point() + geom_line() +
facet_wrap(~Table, scales = "free_y") +
ggtitle("Real per capita expenditure (log)") + ylab("") +
theme_bw()