Title: | Transformed and Relative Lorenz Curves for Survey Weighted Data |
Version: | 0.1.1 |
Description: | Functions for constructing Transformed and Relative Lorenz curves with survey sampling weights. Given a variable of interest measured in two groups with scaled survey weights so that their hypothetical populations are of equal size, tlorenz() computes the proportion of members of the group with smaller values (ordered from smallest to largest) needed for their sum to match the sum of the top qth percentile of the group with higher values. rlorenz() shows the fraction of the total value of the group with larger values held by the pth percentile of those in the group with smaller values. Fd() is a survey weighted cumulative distribution function and Eps() is a survey weighted inverse cdf used in rlorenz(). Ramos, Graubard, and Gastwirth (2025) <doi:10.1093/jrsssa/qnaf044>. |
License: | GPL-3 |
Encoding: | UTF-8 |
Author: | Mark Ramos [aut, cre, cph] |
Imports: | dplyr , magrittr , stats , LorenzRegression, rlang |
RoxygenNote: | 7.3.2 |
NeedsCompilation: | no |
Packaged: | 2025-06-27 14:47:59 UTC; markr |
Maintainer: | Mark Ramos <mlr6219@psu.edu> |
Repository: | CRAN |
Date/Publication: | 2025-06-27 15:10:05 UTC |
Inverse cumulative distribution function for a subset of the dataset
Description
Inverse cumulative distribution function for a subset of the dataset
Usage
Eps(p, data, group = "qtyvar")
Arguments
p |
cumulative distribution percentile |
data |
dataset with defined group and newwts columns |
group |
variable of interest |
Value
Cumulative distribution percentile for quantile y
Examples
df_samp <- data.frame(qtyvar = rnorm(1000, mean = 5, sd = 2),newwts = rep(1, 1000))
Eps(0.25,df_samp)
# Finds the quantile for 25th percentile in simulated data.
Cumulative distribution function for a subset of the dataset
Description
Cumulative distribution function for a subset of the dataset
Usage
Fd(y, data, group = "qtyvar", newwts = "newwts")
Arguments
y |
cumulative distribution quantile |
data |
dataset with defined group and newwts columns |
group |
variable of interest |
newwts |
sampling weights |
Value
Cumulative distribution percentile for quantile y
Examples
df_samp <- data.frame(qtyvar = rnorm(1000, mean = 5, sd = 2),newwts = rep(1, 1000))
Fd(3.5,df_samp)
# Finds the percentile for 3.5 in simulated data.
Compute relevant probabilities and estimates for selecting performance criteria
Description
Compute relevant probabilities and estimates for selecting performance criteria
Usage
rlorenz(p, data, group, edata, newwts = "newwts")
Arguments
p |
percentile based on data from group with lower mean value |
data |
dataset of group with higher mean value. |
group |
variable of interest. Entered in quotes.Must be present in data and edata. |
edata |
dataset of group with lower mean value.Must have defined newwts column. Sum of newwts for edata must be equal to sum of newwts for data. |
newwts |
sampling weights. "newwts" by default. Must be present in data and edata. |
Value
Relative Lorenz function value for p
Examples
df_samp <- data.frame(x1 = rnorm(500, mean = 5, sd = 2),newwts = rep(1, 500))
df_samp2 <- data.frame(x1 = rnorm(500, mean = 4.5, sd = 2),newwts = rep(1, 500))
p_vals <- seq(0, 1, length.out = 100)
lc_vals <- rlorenz(p_vals, data = df_samp, group = "x1", edata = df_samp2)
#Creates relative Lorenz curve values for two sets of simulated data
Compute relevant probabilities and estimates for selecting performance criteria
Description
Compute relevant probabilities and estimates for selecting performance criteria
Usage
tlorenz(q, d1, group, d2, newwts = "newwts")
Arguments
q |
1-percentile of data on variable of interest in group with higher mean value |
d1 |
dataset of group with higher mean value. |
group |
variable of interest. Entered in quotes.Must be present in d1 and d2 |
d2 |
dataset of group with lower mean value. |
newwts |
sampling weights. "newwts" by default. Must be present in data and edata. |
Value
Transformed Lorenz function value for q
Examples
df_samp <- data.frame(x1 = rnorm(500, mean = 5, sd = 2),newwts = rep(1, 500))
df_samp2 <- data.frame(x1 = rnorm(500, mean = 4.5, sd = 2),newwts = rep(1, 500))
p_vals <- seq(0, 1, length.out = 100)
lc_vals <- tlorenz(p_vals, d1 = df_samp, group = "x1", d2 = df_samp2)
#Creates transformed Lorenz curve values for two sets of simulated data