## ----setup, include = FALSE--------------------------------------------------- knitr::opts_chunk$set(collapse = TRUE, comment = "#>") library(dceasimR) ## ----ede---------------------------------------------------------------------- health <- c(52.1, 56.3, 59.8, 63.2, 66.8) weights <- rep(0.2, 5) # eta = 0: no inequality aversion (arithmetic mean) calc_ede(health, weights, eta = 0) # eta = 1: moderate aversion (geometric mean) calc_ede(health, weights, eta = 1) # eta = 5: strong aversion calc_ede(health, weights, eta = 5) ## ----profile, fig.width = 6, fig.height = 4----------------------------------- profile <- calc_ede_profile(health, weights, eta_range = seq(0, 10, 0.1)) library(ggplot2) ggplot(profile, aes(eta, ede)) + geom_line(colour = "steelblue", linewidth = 1) + labs(x = expression(eta), y = "EDE (years)", title = "EDE Profile") + theme_minimal() ## ----weights------------------------------------------------------------------ ew <- calc_equity_weights(health, weights, eta = 1) ew # Q1 (most deprived) gets highest weight ## ----swf---------------------------------------------------------------------- post_health <- health + c(0.5, 0.6, 0.5, 0.4, 0.3) calc_social_welfare(health, post_health, weights, eta = 1)