fill_gaps | R Documentation |
Calculate poverty statistics for a request year for which survey data is not available.
fill_gaps(
request_year,
data = list(df0, df1 = NULL),
predicted_request_mean,
survey_year,
default_ppp,
ppp = NULL,
distribution_type,
poverty_line = 1.9
)
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. |
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.
deflate_welfare_mean()
predict_request_year_mean()
# 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
# 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
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.