Skip to contents

Check validity of Lorenz Curve

Usage

pipgd_validate_lorenz(
  params = NULL,
  welfare = NULL,
  weight = NULL,
  mean = 1,
  times_mean = 1,
  popshare = NULL,
  povline = ifelse(is.null(popshare), mean * times_mean, NA_real_),
  complete = getOption("pipster.return_complete")
)

Arguments

params

list of parameters from pipgd_params()

welfare

numeric vector of cumulative share of welfare (income/consumption)

weight

numeric vector of cumulative share of the population

mean

numeric: welfare mean of distribution.

times_mean

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

popshare

numeric: range (0,1). Share of population. Provide share of population instead of poverty line

povline

numeric: value of poverty line. Default is the mean value

complete

logical: If TRUE, returns a list a cumulative returns from previously used get_gd functions. Default is FALSE

Value

Returns a nested list of distributional validity of each Lorenz model accessible at $gd_params$lq$validity$is_normal for the Lorenz beta and $gd_params$lq$validity$is_normal for the Lorenz quadratic.

Examples

# Example 1: Validate Lorenz Curves using pre-calculated parameters.
parameters <- pipgd_params(welfare = pip_gd$L, weight = pip_gd$P)
pipgd_validate_lorenz(params = parameters)
#> $gd_params
#> $gd_params$lq
#> $gd_params$lq$validity
#> $gd_params$lq$validity$is_normal
#> [1] TRUE
#> 
#> $gd_params$lq$validity$is_valid
#> [1] TRUE
#> 
#> $gd_params$lq$validity$headcount
#> [1] 0.6284604
#> 
#> 
#> 
#> $gd_params$lb
#> $gd_params$lb$validity
#> $gd_params$lb$validity$is_valid
#> [1] TRUE
#> 
#> $gd_params$lb$validity$is_normal
#> [1] TRUE
#> attr(,"label")
#> [1] "Normality with a mean of 1 and a poverty line of 1;1 times the mean."
#> 
#> $gd_params$lb$validity$headcount
#> [1] 0.6161877
#> 
#> 
#> 
#> 

# Example 2: Directly using welfare and weight vectors.
pipgd_validate_lorenz(welfare = pip_gd$L,
                      weight = pip_gd$P)
#> $gd_params
#> $gd_params$lq
#> $gd_params$lq$validity
#> $gd_params$lq$validity$is_normal
#> [1] TRUE
#> 
#> $gd_params$lq$validity$is_valid
#> [1] TRUE
#> 
#> $gd_params$lq$validity$headcount
#> [1] 0.6284604
#> 
#> 
#> 
#> $gd_params$lb
#> $gd_params$lb$validity
#> $gd_params$lb$validity$is_valid
#> [1] TRUE
#> 
#> $gd_params$lb$validity$is_normal
#> [1] TRUE
#> attr(,"label")
#> [1] "Normality with a mean of 1 and a poverty line of 1;1 times the mean."
#> 
#> $gd_params$lb$validity$headcount
#> [1] 0.6161877
#> 
#> 
#> 
#> 

# Example 3: Specifying mean and poverty line
pipgd_validate_lorenz(welfare = pip_gd$L,
                      weight = pip_gd$P,
                      mean = mean(pip_gd$X),
                      povline = 50)
#> $gd_params
#> $gd_params$lq
#> $gd_params$lq$validity
#> $gd_params$lq$validity$is_normal
#> [1] TRUE
#> 
#> $gd_params$lq$validity$is_valid
#> [1] TRUE
#> 
#> $gd_params$lq$validity$headcount
#> [1] 0.04732287
#> 
#> 
#> 
#> $gd_params$lb
#> $gd_params$lb$validity
#> $gd_params$lb$validity$is_valid
#> [1] TRUE
#> 
#> $gd_params$lb$validity$is_normal
#> [1] TRUE
#> attr(,"label")
#> [1] "Normality with a mean of 128.481538461538 and a poverty line of 50;0.389160968950942 times the mean."
#> 
#> $gd_params$lb$validity$headcount
#> [1] 0.04550107
#> 
#> 
#> 
#> 

# Example 4: Using a custom population share
pipgd_validate_lorenz(welfare = pip_gd$L,
                      weight = pip_gd$P,
                      popshare = 0.5)
#> $gd_params
#> $gd_params$lq
#> $gd_params$lq$validity
#> $gd_params$lq$validity$is_normal
#> [1] TRUE
#> 
#> $gd_params$lq$validity$is_valid
#> [1] TRUE
#> 
#> $gd_params$lq$validity$headcount
#> [1] 0.5
#> 
#> 
#> 
#> $gd_params$lb
#> $gd_params$lb$validity
#> $gd_params$lb$validity$is_valid
#> [1] TRUE
#> 
#> $gd_params$lb$validity$is_normal
#> [1] TRUE
#> attr(,"label")
#> [1] "Normality with a mean of 1 and a poverty line of 0.861761080993303;0.861761080993303 times the mean."
#> 
#> $gd_params$lb$validity$headcount
#> [1] 0.5
#> 
#> 
#> 
#>