Learn R Programming

convey (version 1.0.1)

svygpg: Linearization of the gender pay (wage) gap

Description

Estimate the difference between the average gross hourly earnings of men and women expressed as a percentage of the average gross hourly earnings of men.

Usage

svygpg(formula, design, ...)

# S3 method for survey.design svygpg(formula, design, sex, na.rm = FALSE, ...)

# S3 method for svyrep.design svygpg(formula, design, sex, na.rm = FALSE, ...)

# S3 method for DBIsvydesign svygpg(formula, design, sex, ...)

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.

Arguments

formula

a formula specifying the gross hourly earnings variable

design

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

...

future expansion

sex

formula with a factor with labels 'male' and 'female'

na.rm

Should cases with missing values be dropped?

Author

Djalma Pessoa and Anthony Damico

Details

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

References

Guillaume Osier (2009). Variance estimation for complex indicators of poverty and inequality. Journal of the European Survey Research Association, Vol.3, No.3, pp. 167-195, ISSN 1864-3361, URL https://ojs.ub.uni-konstanz.de/srm/article/view/369.

Jean-Claude Deville (1999). Variance estimation for complex statistics and estimators: linearization and residual techniques. Survey Methodology, 25, 193-203, URL https://www150.statcan.gc.ca/n1/en/catalogue/12-001-X19990024882.

See Also

svyarpt

Examples

Run this code
library(laeken)
library(survey)
data(ses)
names( ses ) <- gsub( "size" , "size_" , tolower( names( ses ) ) )
des_ses <- svydesign(id=~1, weights=~weights, data=ses)
des_ses <- convey_prep(des_ses)

# linearized design
svygpg(~earningshour, des_ses, ~sex)
# replicate-weighted design
des_ses_rep <-  as.svrepdesign( des_ses , type = "bootstrap" )
des_ses_rep <- convey_prep(des_ses_rep)

svygpg(~earningshour, des_ses_rep, ~sex)

if (FALSE) {

# database-backed design
library(RSQLite)
library(DBI)
dbfile <- tempfile()
conn <- dbConnect( RSQLite::SQLite() , dbfile )
dbWriteTable( conn , 'ses' , ses )

dbd_ses <- svydesign(id=~1, weights=~weights, data="ses", dbname=dbfile, dbtype="SQLite")
dbd_ses <- convey_prep( dbd_ses )

svygpg(formula=~earningshour, design=dbd_ses, sex= ~sex)

dbRemoveTable( conn , 'ses' )

}

Run the code above in your browser using DataLab