Apply Square-Root Equivalisation to a Variable
apply_sqrt_equivalisation.Rd
This function adjusts a household-level variable (e.g., "dhi", "hicapital")
for household size using a square-root scale equivalisation method.
It divides the variable by the number of household members raised to a power (eq_scale
),
which defaults to 0.5 (i.e., the square root equivalence scale).
Details
The function assumes that the dataset contains a column named nhhmem
representing
the number of household members. If this column is missing, the function stops with an error.
It also issues a warning if the target variable is detected as an individual-level variable, since equivalisation is typically applied to household-level measures.
Examples
if (FALSE) { # \dontrun{
# Import data, ideally at the level of the variable of interest.
data_hhd <- lissyrtools::lissyuse("it", vars = c("dhi"), from = 2010)
# No equivalisation case
data_hhd %>%
purrr::map(~ .x %>% filter(!is.na(dhi))) %>%
run_weighted_mean("dhi", "hpopwgt")
# Default case: square-root equivalisation
data_hhd %>%
purrr::map(~ .x %>% filter(!is.na(dhi))) %>%
apply_sqrt_equivalisation("dhi") %>%
run_weighted_mean("dhi", "hpopwgt")
} # }