convey (version 0.2.2)

svyamato: Amato index (EXPERIMENTAL)

Description

Estimate the Amato index, a measure of inequality.

Usage

svyamato(formula, design, ...)

# S3 method for survey.design svyamato(formula, design, standardized = FALSE, na.rm = FALSE, ...)

# S3 method for svyrep.design svyamato(formula, design, standardized = FALSE, na.rm = FALSE, ...)

# S3 method for DBIsvydesign svyamato(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

standardized

If standardized = TRUE, returns the standardized Amato index, i.e., a linear tranformation of the amato index.

na.rm

Should cases with missing values be dropped?

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.

Details

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

The Amato index is the length of the Lorenz curve.

References

Lucio Barabesi, Giancarlo Diana and Pier Francesco Perri (2016). Linearization of inequality indexes in the design-based framework. Statistics. URL http://www.tandfonline.com/doi/pdf/10.1080/02331888.2015.1135924.

Barry C. Arnold (2012). On the Amato inequality index. Statistics & Probability Letters, v. 82, n. 8, August 2012, pp. 1504-1506, ISSN 0167-7152. URL http://dx.doi.org/10.1016/j.spl.2012.04.020.

See Also

svygini

Examples

Run this code
# NOT RUN {
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)

# replicate-weighted design
des_eusilc_rep <- as.svrepdesign( des_eusilc , type = "bootstrap" )
des_eusilc_rep <- convey_prep(des_eusilc_rep)


# variable without missing values
svyamato(~eqincome, des_eusilc)
svyamato(~eqincome, des_eusilc_rep)

# subsetting:
svyamato(~eqincome, subset( des_eusilc, db040 == "Styria"))
svyamato(~eqincome, subset( des_eusilc_rep, db040 == "Styria"))

# }
# NOT RUN {
# variable with with missings
svyamato(~py010n, des_eusilc )
svyamato(~py010n, des_eusilc_rep )

svyamato(~py010n, des_eusilc, na.rm = TRUE )
svyamato(~py010n, 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 )


# variable without missing values
svyamato(~eqincome, dbd_eusilc)

# subsetting:
svyamato(~eqincome, subset( dbd_eusilc, db040 == "Styria"))

# variable with with missings
svyamato(~py010n, dbd_eusilc )

svyamato(~py010n, dbd_eusilc, na.rm = TRUE )


dbRemoveTable( conn , 'eusilc' )

dbDisconnect( conn , shutdown = TRUE )

# }
# NOT RUN {
# }

Run the code above in your browser using DataLab