View source: R/weighted_atkinson.R
run_weighted_atkinson | R Documentation |
Compute Weighted Atkinson Across a List of Data Frames
run_weighted_atkinson(
data_list,
var_name,
wgt_name = NULL,
epsilon,
na.rm = TRUE
)
data_list |
A named list of data frames, (e.g., across countries or years). |
var_name |
A string specifying the variable name (e.g., "dhi", "pilabour") to compute the Atkinson index on. |
wgt_name |
An optional string specifying the weight variable to be used. If |
epsilon |
A positive inequality aversion parameter. Must be greater than 0. |
na.rm |
Logical. If |
A named list. Each list element is named by country and contains a named numeric vector, where the names are years and the values are the computed statistics.
## Not run:
library(lissyrtools)
library(purrr)
datasets <- lissyrtools::lissyuse(data = c("de", "es", "uk"), vars = c("dhi"), from = 2016)
datasets %>%
map(~ .x %>% mutate(new_wgt = hwgt * nhhmem)) %>%
apply_iqr_top_bottom_coding("dhi", "hwgt") %>%
apply_sqrt_equivalisation("dhi") %>%
run_weighted_atkinson("dhi", "new_wgt", epsilon = 0.5)
# Negative values are not allowed in the variable for which we are computing the Atkinson index.
# If we remove the top and bottom coding stage from the example above, we will get an error with a warning regarding the datasets containing negative values.
datasets[1:4] %>%
map(~ .x %>% mutate(new_wgt = hwgt * nhhmem)) %>%
apply_sqrt_equivalisation("dhi") %>%
run_weighted_atkinson("dhi", "new_wgt", epsilon = 0.5)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.