mzmv_mean()
estimates the means, proportions and confidence
intervals of FSO mobility surveys.
Arguments
- data
A data frame or tibble.
- ...
Names of variables to be estimated. Can be passed unquoted (e.g.,
household_size
) or programmatically using!!!syms(c("annual_household_income", "household_size"))
. Variables have integer values, representing a quantity (number of cars per household) or presence/absence (possession of a car). Negative numbers representNA
.- weight
Unquoted or quoted name of the sampling weights column. For programmatic use with a string variable (e.g.,
wt <- "weights"
), use!!sym(wt)
in the function call.- cf
Numeric correction factor of the confidence interval, supplied by FSO. Default is 1.14.
- alpha
Numeric significance level for confidence intervals. Default is 0.1 (90% CI).
Value
Tibble (number of rows is length of variable
) with the following columns:
id
: estimated itemocc
: number of survey responseswmean
: weighted mean estimateci
: confidence interval estimate
See also
See mzmv_mean_map
for estimates on a set of conditions.
Examples
# Estimate two means
mzmv_mean(
data = nhanes,
annual_household_income, annual_family_income,
weight = weights
)
#> # A tibble: 2 × 4
#> variable occ wmean ci
#> <chr> <int> <dbl> <dbl>
#> 1 annual_household_income 9626 11.9 0.240
#> 2 annual_family_income 9642 11.5 0.245
# Programmatic use with strings
v <- c("annual_household_income", "annual_family_income")
mzmv_mean(nhanes, weight = "weights", !!!rlang::syms(v))
#> # A tibble: 2 × 4
#> variable occ wmean ci
#> <chr> <int> <dbl> <dbl>
#> 1 annual_household_income 9626 11.9 0.240
#> 2 annual_family_income 9642 11.5 0.245