ineq.weighted.boot {wINEQ} | R Documentation |
Weighted inequality measures with bootstrap
Description
For weighted mean and weighted total of X (or median of X) as well as for each relevant inequality measure, returns outputs from ineq.weighted and bootstrap outcomes: expected value, bias (in %), standard deviation, coefficient of variation, lower and upper bound of confidence interval.
Usage
ineq.weighted.boot(
X,
W = rep(1, length(X)),
B = 100,
AF.norm = TRUE,
Atkinson.e = 1,
Jenkins.alfa = 0.8,
Entropy.e = 0.5,
Kolm.p = 1,
Kolm.scale = "Standardization",
Leti.norm = T,
AN_Y.a = 1,
AN_Y.b = 1,
Apouey.a = 2/(1 - length(W[!is.na(W) & !is.na(X)])),
Apouey.b = length(W[!is.na(W) & !is.na(X)])/(length(W[!is.na(W) & !is.na(X)]) - 1),
BL.withsqrt = FALSE,
keepSamples = FALSE,
keepMeasures = FALSE,
conf.alpha = 0.05,
calib.boot = FALSE,
Xs = rep(1, length(X)),
total = sum(W),
calib.method = "truncated",
bounds = c(low = 0, upp = 10)
)
Arguments
X |
is a data vector |
W |
is a vector of weights |
B |
is a number of bootstrap samples. |
AF.norm |
(logical). If TRUE (default) then index is divided by its maximum possible value |
Atkinson.e |
is a parameter for Atkinson coefficient |
Jenkins.alfa |
is a parameter for Jenkins coefficient |
Entropy.e |
is a generalized entropy index parameter |
Kolm.p |
is a parameter for Kolm index |
Kolm.scale |
method of data standardization before computing |
Leti.norm |
(logical). If TRUE (default) then Leti index is divided by a maximum possible value |
AN_Y.a |
is a positive parameter for Abul Naga and Yalcin inequality measure |
AN_Y.b |
is a parameter for Abul Naga and Yalcin inequality measure |
Apouey.a |
is a parameter for Apouey inequality measure |
Apouey.b |
is a parameter for Apouey inequality measure |
BL.withsqrt |
if TRUE function returns index given by BL2, elsewhere by BL (default). See more in details of BL function. |
keepSamples |
if TRUE, it returns bootstrap samples of data (Xb) and weights (Wb) |
keepMeasures |
if TRUE, it returns values of all inequality measures for each bootstrap sample |
conf.alpha |
significance level for confidence interval |
calib.boot |
if FALSE, then naive bootstrap is performed, calibrated bootstrap elsewhere |
Xs |
matrix of calibration variables. By default it is a vector of 1's, applied if calib.boot is TRUE |
total |
vector of population totals. By default it is a sum of weights, applied if calib.boot is TRUE |
calib.method |
weights' calibration method for function calib (sampling) |
bounds |
vector of bounds for the g-weights used in the truncated and logit methods; 'low' is the smallest value and 'upp' is the largest value |
Details
By default, naive bootstrap is performed, that is no weights calibration is conducted.
You can choose calibrated bootstrap to calibrate weights with respect to provided variables (Xs) and totals (total).
Confidence interval is simply derived with quantile of order \alpha
and 1-\alpha
where \alpha
is a significance level for confidence interval.
Value
This functions returns a data frame from ineq.weighted extended with bootstrap results: expected value, bias (in %), standard deviation, coefficient of variation, lower and upper bound of confidence interval. If keepSamples=TRUE or keepMeasures==TRUE then the output becomes a list. If keepSamples=TRUE, the functions returns Xb and Wb, which are the samples of vector data and the samples of weights, respectively. If keepMeasures==TRUE, the functions returns Mb, which is a set of inequality measures from bootstrapping.
Examples
# Inequality measures with additional statistics for numeric variable
X=1:10
W=1:10
ineq.weighted.boot(X,W,B=10)
# Inequality measures with additional statistics for ordered factor variable
X=factor(c('H','H','M','M','L','L'),levels = c('L','M','H'),ordered = TRUE)
W=c(2,2,3,3,8,8)
ineq.weighted.boot(X,W,B=10)