Estimate the Zenga index, a measure of inequality
svyzenga(formula, design, ...)
# S3 method for survey.design
svyzenga(
formula,
design,
na.rm = FALSE,
deff = FALSE,
linearized = FALSE,
influence = FALSE,
...
)
# S3 method for svyrep.design
svyzenga(
formula,
design,
na.rm = FALSE,
deff = FALSE,
linearized = FALSE,
return.replicates = FALSE,
...
)
# S3 method for DBIsvydesign
svyzenga(formula, design, ...)
a formula specifying the income variable
a design object of class survey.design
or class svyrep.design
from the survey
library.
future expansion
Should cases with missing values be dropped?
Return the design effect (see survey::svymean
)
Should a matrix of linearized variables be returned
Should a matrix of (weighted) influence functions be returned? (for compatibility with svyby
)
Return the replicate estimates?
Object of class "cvystat
", which are vectors with a "var
" attribute giving the variance and a "statistic
" attribute giving the name of the statistic.
you must run the convey_prep
function on your survey design object immediately after creating it with the svydesign
or svrepdesign
function.
Lucio Barabesi, Giancarlo Diana and Pier Francesco Perri (2016). Linearization of inequality indices in the design-based framework. Statistics, 50(5), 1161-1172. URL https://www.tandfonline.com/doi/pdf/10.1080/02331888.2015.1135924.
Matti Langel and Yves Tille (2012). Inference by linearization for Zenga's new inequality index: a comparison with the Gini index. Metrika, 75, 1093-1110. URL https://doi.org/10.1007/s00184-011-0369-1.
Matti Langel (2012). Measuring inequality in finite population sampling. PhD thesis: Universite de Neuchatel, URL https://doc.rero.ch/record/29204/files/00002252.pdf.
library(survey)
library(laeken)
data(eusilc) ; names( eusilc ) <- tolower( names( eusilc ) )
# linearized design
des_eusilc <- svydesign( ids = ~rb030 , strata = ~db040 , weights = ~rb050 , data = eusilc )
des_eusilc <- convey_prep(des_eusilc)
svyzenga( ~eqincome , design = des_eusilc )
#> zenga SE
#> eqincome 0.59132 0.0028
# replicate-weighted design
des_eusilc_rep <- as.svrepdesign( des_eusilc , type = "bootstrap" )
des_eusilc_rep <- convey_prep(des_eusilc_rep)
svyzenga( ~eqincome , design = des_eusilc_rep )
#> zenga SE
#> eqincome 0.59132 0.003
if (FALSE) {
# linearized design using a variable with missings
svyzenga( ~ py010n , design = des_eusilc )
svyzenga( ~ py010n , design = des_eusilc , na.rm = TRUE )
# replicate-weighted design using a variable with missings
svyzenga( ~ py010n , design = des_eusilc_rep )
svyzenga( ~ py010n , design = des_eusilc_rep , na.rm = TRUE )
# database-backed design
library(RSQLite)
library(DBI)
dbfile <- tempfile()
conn <- dbConnect( RSQLite::SQLite() , dbfile )
dbWriteTable( conn , 'eusilc' , eusilc )
dbd_eusilc <-
svydesign(
ids = ~rb030 ,
strata = ~db040 ,
weights = ~rb050 ,
data="eusilc",
dbname=dbfile,
dbtype="SQLite"
)
dbd_eusilc <- convey_prep( dbd_eusilc )
svyzenga( ~ eqincome , design = dbd_eusilc )
dbRemoveTable( conn , 'eusilc' )
dbDisconnect( conn , shutdown = TRUE )
}