create_prop {calidad} | R Documentation |
Create the inputs to evaluate the quality of proportion estimations
Description
create_prop
generates a dataframe
with the following elements: sum,
degrees of freedom, sample size, standard error and coefficient of variation. The function allows
grouping in several domains.
Usage
create_prop(
var,
denominator = NULL,
domains = NULL,
subpop = NULL,
design,
ci = FALSE,
deff = FALSE,
ess = FALSE,
ajuste_ene = FALSE,
rel_error = FALSE,
log_cv = FALSE,
unweighted = FALSE,
standard_eval = FALSE,
eclac_input = FALSE
)
Arguments
var |
numeric variable within the |
denominator |
numeric variable within the |
domains |
domains to be estimated separated by the + character. |
subpop |
integer dummy variable to filter the dataframe |
design |
complex design created by |
ci |
|
deff |
|
ess |
|
ajuste_ene |
|
rel_error |
|
log_cv |
|
unweighted |
|
standard_eval |
|
eclac_input |
|
Value
dataframe
that contains the inputs and all domains to be evaluated
Examples
library(survey)
library(dplyr)
epf <- mutate(epf_personas, gasto_zona1 = if_else(zona == 1, gastot_hd, 0))
dc <- svydesign(ids = ~varunit, strata = ~varstrat, data = epf, weights = ~fe)
old_options <- options()
options(survey.lonely.psu = "certainty")
create_prop(var = "gasto_zona1", denominator = "gastot_hd", design = dc)
enusc <- filter(enusc, Kish == 1)
dc <- svydesign(ids = ~Conglomerado, strata = ~VarStrat, data = enusc, weights = ~Fact_Pers)
options(survey.lonely.psu = "certainty")
create_prop(var = "VP_DC", denominator = "hom_insg_taxi", design = dc)
options(old_options)