svyatdens: Density functions using Anastasiade-Tillé Decomposition

Description Usage Arguments Details Value Author(s) References See Also Examples

View source: R/svyatdens.R

Description

Plots the original and the counterfactual density functions

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
svyatdens(formula, design, ...)

## S3 method for class 'survey.design'
svyatdens(formula, design, sex, ngrid = 401,
  bandwidth = NULL, grake.args = list(calfun = survey::cal.raking,
  bounds = list(lower = -Inf, upper = Inf), epsilon = 1e-07, verbose =
  FALSE, maxit = 1000, variance = NULL))

## S3 method for class 'svyrep.design'
svyatdens(formula, design, sex,
  grake.args = list(calfun = survey::cal.raking, bounds = list(lower =
  0.5, upper = 2), epsilon = 1e-07, eta = NULL, maxit = 1000, verbose =
  FALSE, variance = NULL), ...)

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

Arguments

formula

a formula specifying the income variable and the variables to calibrate upon.

design

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

...

future expansion

sex

a formula indicating the sex variable, a factor of two levels (male and female).

grake.args

arguments to be passed to the grake function of the survey library.

Details

This function

Value

Object of class "svystat", which are vectors with a "var" attribute giving the variance-covariance matrix and a "statistic" attribute giving the name of the decomposed variable.

Author(s)

Guilherme Jacob

References

Anastasiade, M.-C., and Tillé, Y. (2017). Decomposition of gender wage inequalities through calibration: Application to the Swiss structure of earnings survey. Survey Methodology, Statistics Canada, Catalogue No. 12-001-X, Vol. 43, No. 2. URL http://www.statcan.gc.ca/pub/12-001-x/2017002/article/54887-eng.htm.

DiNardo, J., Fortin, N., and Lemieux, T. (1996). Labor Market Institutions and the Distribution of Wages, 1973-1992: A Semiparametric Approach. Econometrica, vol. 64, no. 5, pp. 1001–1044, URL http://www.jstor.org/stable/2171954.

Oaxaca, R. (1973). Male-Female Wage Differentials in Urban Labor Markets. International Economic Review, vol. 14, no. 3, pp. 693–709. URL www.jstor.org/stable/2525981.

Blinder, A. (1973). Wage Discrimination: Reduced Form and Structural Estimates. The Journal of Human Resources, vol. 8, no. 4, 1973, pp. 436–455. JSTOR, www.jstor.org/stable/144855

See Also

svyatdens

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
library(survey)
library(vardpoor)
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)

svyatd( ~eqincome , design = des_eusilc )

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

svyatd( ~eqincome , design = des_eusilc_rep )

## Not run: 

# linearized design using a variable with missings
svyatd( ~ py010n , design = des_eusilc )
svyatd( ~ py010n , design = des_eusilc , na.rm = TRUE )
# replicate-weighted design using a variable with missings
svyatd( ~ py010n , design = des_eusilc_rep )
svyatd( ~ py010n , design = des_eusilc_rep , na.rm = TRUE )

# database-backed design
library(MonetDBLite)
library(DBI)
dbfolder <- tempdir()
conn <- dbConnect( MonetDBLite::MonetDBLite() , dbfolder )
dbWriteTable( conn , 'eusilc' , eusilc )

dbd_eusilc <-
	svydesign(
		ids = ~rb030 ,
		strata = ~db040 ,
		weights = ~rb050 ,
		data="eusilc",
		dbname=dbfolder,
		dbtype="MonetDBLite"
	)

dbd_eusilc <- convey_prep( dbd_eusilc )

svyatd( ~ eqincome , design = dbd_eusilc )

dbRemoveTable( conn , 'eusilc' )

dbDisconnect( conn , shutdown = TRUE )


## End(Not run)

guilhermejacob/svycdec documentation built on Nov. 4, 2019, 1:24 p.m.