svyzenga: Zenga index

View source: R/svyzenga.R

svyzengaR Documentation

Zenga index

Description

Estimate the Zenga index, a measure of inequality

Usage

svyzenga(formula, design, ...)

## S3 method for class 'survey.design'
svyzenga(
  formula,
  design,
  na.rm = FALSE,
  deff = FALSE,
  linearized = FALSE,
  influence = FALSE,
  ...
)

## S3 method for class 'svyrep.design'
svyzenga(
  formula,
  design,
  na.rm = FALSE,
  deff = FALSE,
  linearized = FALSE,
  return.replicates = FALSE,
  ...
)

## S3 method for class 'DBIsvydesign'
svyzenga(formula, design, ...)

Arguments

formula

a formula specifying the income variable

design

a design object of class survey.design or class svyrep.design from the survey library.

...

future expansion

na.rm

Should cases with missing values be dropped?

deff

Return the design effect (see survey::svymean)

linearized

Should a matrix of linearized variables be returned

influence

Should a matrix of (weighted) influence functions be returned? (for compatibility with svyby)

return.replicates

Return the replicate estimates?

Details

you must run the convey_prep function on your survey design object immediately after creating it with the svydesign or svrepdesign function.

Value

Object of class "cvystat", which are vectors with a "var" attribute giving the variance and a "statistic" attribute giving the name of the statistic.

Author(s)

Djalma Pessoa, Guilherme Jacob, and Anthony Damico

References

Lucio Barabesi, Giancarlo Diana and Pier Francesco Perri (2016). Linearization of inequality indices in the design-based framework. Statistics, 50(5), 1161-1172. DOI \Sexpr[results=rd]{tools:::Rd_expr_doi("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. DOI \Sexpr[results=rd]{tools:::Rd_expr_doi("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.

See Also

svygini

Examples

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 )

# 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 )

## Not run: 

# 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 )


## End(Not run)


convey documentation built on Oct. 16, 2024, 5:10 p.m.