Skip to contents

Calculate Watts index from microdata

Usage

pipmd_watts(
  welfare,
  weight = rep(1, length = length(welfare)),
  povline = fmean(welfare, w = weight) * times_mean,
  times_mean = 1,
  format = c("dt", "list", "atomic")
)

Arguments

welfare

numeric: A vector of income or consumption values

weight

numeric: A vector of population weights. If NULL, a vector of 1s is used to give equal weight to each observation.

povline

numeric: Poverty line in international dollars, same units as welfare.

times_mean

numeric factor that multiplies the mean to create a relative poverty line. Default is 1

format

atomic character vector: specifies the format of output, either "dt", "list", or "atomic"

Value

A data.table and data.frame object of length equal to the povline vector with variables povline and pov_severity. See format to change the output format.

Examples

# Example 1: Basic poverty headcount calculation
pipmd_watts(welfare = pip_md_s$welfare,
            weight  = pip_md_s$weight,
            povline = 1.3,
            format  = "list")
#> $pl1.3
#> $pl1.3$watts
#> [1] 0.09129307
#> 
#> 

# Example 2: Returning data.table format
pipmd_watts(welfare = pip_md_s$welfare,
            weight  = pip_md_s$weight,
            povline = c(1.3, 1.2),
            format  = "dt")
#>    povline      watts
#>      <num>      <num>
#> 1:     1.3 0.09129307
#> 2:     1.2 0.07527149

# Example 3: Returning atomic format
pipmd_watts(welfare = pip_md_s$welfare,
            weight  = pip_md_s$weight,
            povline = 1.3,
            format  = "atomic")
#>      pl1.3 
#> 0.09129307