2  Demographic data from census 2019

3 Age pyramid

4 Population Density

4.1 Social Variable

5 Economic variable

The wealth asset index was constructed by principal components analysis (PCA) using information on the ownership of dwelling, water supply, air condition, computer, washer, refrigerator, tv, radio, electricity, hot water, phone that are related to the household’s wealth. Follow https://pmc.ncbi.nlm.nih.gov/articles/PMC5348557/ and https://rpubs.com/Sternonyos/526030

Code
library(psych)

df$ownership <- ifelse(df$OWNERSHIP == 1,1,0)
df$watsup <- ifelse(df$WATSUP == 10,1,0)
df$aircon <- ifelse(df$AIRCON == 10,0,1)
df$computer <- ifelse(df$COMPUTER == 2,1,0)
df$washer <- ifelse(df$WASHER == 2,1,0)
df$refrig <- ifelse(df$REFRIG == 2,1,0)
df$tv <- ifelse(df$TV == 20,1,0)
df$radio <- ifelse(df$RADIO == 2,1,0)
df$electric <- ifelse(df$ELECTRIC == 1,1,0)
df$hotwater <- ifelse(df$HOTWATER == 2,1,0)
df$phone <- ifelse(df$PHONE == 2,1,0)

wealth_index <- df[,c("qh","ownership","watsup","aircon","computer",
                      "washer","refrig","tv","radio","electric",
                      "hotwater","phone")] 

prn<- principal(wealth_index[,-1], rotate="varimax", 
                      nfactors=3,covar=T, scores=TRUE)
index=prn$scores[,1]
nlab<-c(1,2,3,4,5)
newdata<-mutate(wealth_index,
                quintile=as.factor(cut(index,breaks=5,labels=nlab)))

wealdf <- newdata %>% group_by(qh,quintile) %>% count()

wealdf$quintile <-  case_when(
  wealdf$quintile == 1 ~ "Poorest, 20%",
  wealdf$quintile == 2 ~ "Near poor, 20%",
  wealdf$quintile == 3 ~ "Middle, 20%",
  wealdf$quintile == 4 ~ "Richer, 20%",
  wealdf$quintile == 5 ~ "Richest, 20%") %>% 
  factor(levels = c("Poorest, 20%", 
                    "Near poor, 20%",
                    "Middle, 20%",
                    "Richer, 20%",
                    "Richest, 20%")
  )

wealdf %>% scale_per() %>% 
  ggplot() +
  geom_col(aes(x = per,
               y = quintile)) +
  facet_wrap(vars(qh),
             # scales = "free",
             ncol = 5)+
  labs(x = "Percentage of total population(%)",
       y = "Socioeconomic status (quintile)")+
  theme_light()+
  theme(axis.text.x = element_text(size = 6),
        axis.text.y = element_text(size = 6))