A deprivation cutoff must be set for each indicator defined in the MPI specifications. This step establishes the first cutoff in the methodology where every person/household (defined as the unit of analysis) can be identified as deprived or non-deprived with respect to each indicator.
For each indicator, 0
will be used to indicate "not deprived", 1
if deprived, and NA
if missing or non-response. Additional column containing the product of the value of the indicator obtained and its corresponding weight will also be computed for convenience.
Usage
define_deprivation(
.data,
.indicator,
.cutoff,
.mpi_specs = getOption("mpi_specs"),
.collapse = FALSE,
.set_na_equal_to = 0,
.collapse_condition = NULL
)
Arguments
- .data
A data frame or tibble
- .indicator
Name of indicator defined in MPI specs (must exactly match the specs).
- .cutoff
A conditional logic that defines the poverty line to determine whether deprived or not.
- .mpi_specs
MPI specifications defined in
define_mpi_specs
.- .collapse
A boolean indicating whether to collapse the data frame or not. This is useful, for instance, if the original data where the
.cutoff
argument above applies to an individual person but your unit of analysis in household.- .set_na_equal_to
Coerce value from NA to either
0
(not deprived) or1
(deprived). Default is0
.- .collapse_condition
NOT YET FULLY IMPLEMENTED. ONLY WORKS WITH DEFAULT. A condition when
.collapse
is set toTRUE
. IfNULL
,max()
will be used as default.
Value
A data frame of deprivation value for the indicator (.*_unweighted
): 0
for "not deprived", 1
for deprived, and NA
for missing and non-response; and product of .*_unweighted
and its corresponding weight (.*_weighted
).
Examples
# Use sample specs file included in the package
specs_file <- system.file(
"extdata",
"global-mpi-specs.csv",
package = "mpindex"
)
specs <- define_mpi_specs(specs_file, .uid = 'uuid')
# Using built-in dataset
df_household |>
define_deprivation(
.indicator = drinking_water,
.cutoff = drinking_water == 2
)
#> # A tibble: 198 × 3
#> uuid d03_i03_drinking_wat…¹ d03_i03_drinking_wat…²
#> <chr> <int> <dbl>
#> 1 5dbec60a-ebda-47bd-ae18-3b017a… 0 0
#> 2 8b70c208-8642-408c-8a51-30bcaa… 0 0
#> 3 aa7cb64d-ba16-4842-8994-877206… 0 0
#> 4 df3e5c9b-7218-451d-9917-cd552c… 0 0
#> 5 57babe6a-c163-4d8e-aa80-3a9bc9… 0 0
#> 6 ba3f75cd-102d-482d-a979-b9098e… 0 0
#> 7 291c03d9-7947-459a-9c02-e68b38… 0 0
#> 8 b8d1b52e-2b5d-4942-9939-7c0613… 0 0
#> 9 2e80bf1a-03e9-4894-8792-0ce936… 0 0
#> 10 208992f0-9c6d-4c5c-a72a-4ffab6… 0 0
#> # ℹ 188 more rows
#> # ℹ abbreviated names: ¹d03_i03_drinking_water_unweighted,
#> # ²d03_i03_drinking_water_weighted
df_household_roster |>
define_deprivation(
.indicator = school_attendance,
.cutoff = attending_school == 2,
.collapse = TRUE
)
#> # A tibble: 198 × 3
#> uuid d02_i02_school_atten…¹ d02_i02_school_atten…²
#> <chr> <int> <dbl>
#> 1 018a93c5-d65f-446f-9ee1-88a789… 0 0
#> 2 01c2d953-0bd3-4827-a7f0-fee99b… 0 0
#> 3 06e87d18-be21-4c62-aa35-547116… 1 0.167
#> 4 07d03bdd-6abc-4ef7-8c2a-b76a24… 0 0
#> 5 087868f3-ef7a-4ed6-a803-75ecc9… 1 0.167
#> 6 0a59ad2a-20c7-4b17-a6ae-0f0250… 0 0
#> 7 0aa10fbf-3347-442f-86c9-83d7a2… 0 0
#> 8 0ba3b628-4082-4bc6-ae19-df01ac… 0 0
#> 9 0c967915-2e93-4e6e-9ddc-f3f9be… 0 0
#> 10 0cbd0210-3639-4fef-bdb1-e7e090… 0 0
#> # ℹ 188 more rows
#> # ℹ abbreviated names: ¹d02_i02_school_attendance_unweighted,
#> # ²d02_i02_school_attendance_weighted