Post-stratification analysis
Arguments
- est_df
A
data.frame()of stratified indicator estimates to get overall estimates of.est_dfshould have a variable namedestfor the values of the indicator estimate, a variable namedstratafor information on the stratification or grouping of the estimates, and a variable namedsefor the standard errors for the values of the indicator estimate. This is usually produced via a call toboot_bw_estimate().- pop_df
A
data.frame()with at least two variables:stratafor the stratification/grouping information that matchesstratainest_dfandpopfor information on population for the givenstrata.- strata
A character value of the variable name in
est_dfthat corresponds to thestratavalues to match with values inpop_df
Value
A vector of values for the overall estimate, overall 95% lower
confidence limit, and overall 95% upper confidence limit for each of the
strata in est_df.
Examples
est_df <- boot_bw(
x = indicatorsHH, w = villageData, statistic = bootClassic,
params = "anc1", strata = "region", replicates = 9, parallel = TRUE
) |>
boot_bw_estimate()
#>
#> ── Resampling in parallel ──
#>
#> ℹ Setting up 3 parallel operations
#> ✔ Setting up 3 parallel operations [292ms]
#>
#> ℹ Resampling by region - 9 replicates in parallel
#> ✔ Resampling by region - 9 replicates in parallel [855ms]
#>
#> ℹ Tidying up resampling outputs
#> ✔ Tidying up resampling outputs [19ms]
#>
#> ℹ Closing 3 parallel operations
#> ✔ Closing 3 parallel operations [15ms]
#>
## Add population ----
pop_df <- somalia_population |>
subset(select = c(region, total))
names(pop_df) <- c("strata", "pop")
estimate_total(est_df, pop_df, strata = "region")
#> ✔ est_df has the appropriate/expected variables
#> ✔ pop_df has the appropriate/expected variables
#> strata indicator est lcl ucl se
#> 1 Overall anc1 0.4659361 0.3959141 0.5359582 0.001276314
