Create the inputs to evaluate the quality of the sum of continuous variables
create_total.Rdcreate_total generates a dataframe with the following elements: sum,
degrees of freedom, sample size, and coefficient of variation. The function allows
grouping in several domains.
Usage
create_total(
var,
domains = NULL,
subpop = NULL,
design,
ci = FALSE,
ess = FALSE,
ajuste_ene = FALSE,
standard_eval = FALSE,
rm.na = FALSE,
deff = FALSE,
rel_error = FALSE,
unweighted = FALSE,
eclac_input = FALSE
)Arguments
- var
numeric variable within the
dataframe.- domains
domains to be estimated separated by the + character.
- subpop
integer dummy variable to filter the dataframe.
- design
complex design created by
surveypackage.- ci
booleanindicating if the confidence intervals must be calculated.- ess
booleaneffective sample size.- ajuste_ene
booleanindicating if an adjustment for the sampling-frame transition period must be used.- standard_eval
booleanindicating if the function is wrapped inside another function, ifTRUEavoid lazy eval errors.- rm.na
booleanremove NA values if required.- deff
booleandesign effect.- rel_error
booleanrelative error.- unweighted
booleanadd non-weighted count if required.- eclac_input
booleanreturn eclac inputs
Examples
dc <- survey::svydesign(ids = ~varunit, strata = ~varstrat, data = epf_personas, weights = ~fe)
create_total("gastot_hd", "zona+sexo", subpop = "ocupado", design = dc)
#> zona sexo stat se df n cv
#> 1 1 1 2.274036e+12 171332354654 127 6651 0.07534286
#> 2 2 1 1.374437e+12 85073974508 121 5513 0.06189731
#> 3 1 2 1.966062e+12 164218100249 127 5638 0.08352643
#> 4 2 2 1.098399e+12 68031371091 121 4787 0.06193682