svygpg | R Documentation |
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.
svygpg(formula, design, ...)
## S3 method for class 'survey.design'
svygpg(formula, design, sex, na.rm = FALSE, ...)
## S3 method for class 'svyrep.design'
svygpg(formula, design, sex, na.rm = FALSE, ...)
## S3 method for class 'DBIsvydesign'
svygpg(formula, design, sex, ...)
formula |
a formula specifying the gross hourly earnings variable |
design |
a design object of class |
... |
future expansion |
sex |
formula with a factor with labels 'male' and 'female' |
na.rm |
Should cases with missing values be dropped? |
you must run the convey_prep
function on your survey design object immediately after creating it with the svydesign
or svrepdesign
function.
Object of class "cvystat
", which are vectors with a "var
" attribute giving the variance and a "statistic
" attribute giving the name of the statistic.
Djalma Pessoa and Anthony Damico
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.
svyarpt
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)
## Not run:
# 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' )
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.