Skip to contents

Calculate poverty statistics for a request year for which survey data is not available.

Usage

fill_gaps(
  request_year,
  data = list(df0, df1 = NULL),
  predicted_request_mean,
  survey_year,
  default_ppp,
  ppp = NULL,
  distribution_type,
  poverty_line = 1.9
)

Arguments

request_year

integer: A value with the request year.

data

list: A list with one or two data frames containing survey data. See details.

predicted_request_mean

numeric: A vector with one or two survey means. See details.

survey_year

numeric: A vector with one or two survey years.

default_ppp

numeric: Default purchasing power parity.

ppp

numeric: PPP request by user.

distribution_type

character: A vector with the type of distribution, must be either micro, group, aggregate or imputed.

poverty_line

numeric: Daily poverty line in international dollars.

Details

The predicted request year mean(s) must be in comparable international dollars and adjusted for differences in purchasing-power, and changes in prices and currencies.

The survey data must contain a column named welfare and optionally a column named weight if welfare values are to be weighted.

Examples

# Load example data
data("md_ABC_2000_income")
data("md_ABC_2010_income")
md_ABC_2010_income <-
  wbpip:::md_clean_data(md_ABC_2010_income,
    welfare = "welfare",
    weight = "weight"
  )$data
#>  30 NA values in variable "welfare" were dropped
#>  Data has been sorted by variable "welfare"

# Extrapolation
res <- fill_gaps(
  request_year = 2005,
  survey_year = 2000,
  data = list(df0 = md_ABC_2000_income),
  predicted_request_mean = 13,
  default_ppp = 1,
  distribution_type = "micro",
  poverty_line = 1.9
)

# Interpolation (monotonic)
res <- fill_gaps(
  request_year = 2005,
  survey_year = c(2000, 2010),
  data = list(df0 = md_ABC_2000_income, df1 = md_ABC_2010_income),
  predicted_request_mean = c(13, 13),
  default_ppp = c(1, 1),
  distribution_type = "micro",
  poverty_line = 1.9
)

# Interpolation (non-monotonic)
res <- fill_gaps(
  request_year = 2005,
  survey_year = c(2000, 2010),
  data = list(df0 = md_ABC_2000_income, df1 = md_ABC_2010_income),
  predicted_request_mean = c(14, 17),
  default_ppp = c(1, 1),
  distribution_type = "micro",
  poverty_line = 1.9
)