Create the inputs to evaluate the quality of mean estimations
create_mean.Rd
create_mean
generates a dataframe
with the following elements: mean,
degrees of freedom, sample size, and coefficient of variation. The function allows
grouping in several domains.
Usage
create_mean(
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
survey
package.- ci
boolean
indicating if the confidence intervals must be calculated.- ess
boolean
effective sample size.- ajuste_ene
boolean
indicating if an adjustment for the sampling-frame transition period must be used.- standard_eval
boolean
indicating if the function is wrapped inside another function, ifTRUE
avoid lazy eval errors.- rm.na
boolean
remove NA values if required.- deff
boolean
design effect.- rel_error
boolean
relative error.- unweighted
boolean
add non-weighted count if required.- eclac_input
boolean
return eclac inputs.
Examples
dc <- survey::svydesign(ids = ~varunit, strata = ~varstrat, data = epf_personas, weights = ~fe)
create_mean("gastot_hd", "zona+sexo", design = dc)
#> zona sexo stat se df n cv
#> 1 1 1 1378016 69421.07 127 12300 0.05037756
#> 2 2 1 1082227 36324.22 121 10393 0.03356434
#> 3 1 2 1325015 68510.58 127 13729 0.05170551
#> 4 2 2 1088658 35343.76 121 11886 0.03246545