Create the inputs to evaluate the quality of total estimations
create_size.Rd
create_size
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_size(
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,
df_type = c("chile", "eclac"),
eclac_input = FALSE
)
Arguments
- var
numeric variable within the
dataframe
. When the domain parameter is not used, it is possible to include more than one variable using the + separator. When a value is introduced in the domain parameter, the estimation variable must be a dummy variable.- 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.- df_type
character
use degrees of freedom calculation approach from INE Chile or CEPAL. Options are "chile" or "eclac".- eclac_input
boolean
return eclac inputs
Examples
dc <- survey::svydesign(ids = ~varunit, strata = ~varstrat, data = epf_personas, weights = ~fe)
create_size("ocupado", "zona+sexo", design = dc)
#> zona sexo stat se df n cv
#> 1 1 1 1652700.9 124118.08 127 6651 0.07510015
#> 2 2 1 1239916.7 83403.85 121 5513 0.06726568
#> 3 1 2 1388475.0 104249.82 127 5638 0.07508225
#> 4 2 2 987159.5 63514.46 121 4787 0.06434063