summ_sims: Get summary statistics from draws (of counts)

View source: R/summarize_draws.R

summ_simsR Documentation

Get summary statistics from draws (of counts)

Description

Get summary statistics from draws (of counts)

Usage

summ_sims(
  sims,
  area_var = "cd",
  est_var = "p_mrp",
  dtplyr = TRUE,
  allow_NA = FALSE
)

Arguments

sims

Output of poststrat_draws

area_var

A character string for the variable name(s) for area to group and aggregate by. That is, the area of interest in MRP. Defaults to "cd"

est_var

Input column name with estimates. Following the output of poststrat_draws, defaults to p_mrp.

dtplyr

Whether to use a data.table/dtplyr backend for processing for slightly faster dataframe wrangling. Currently does not apply to anything within the function.

allow_NA

A logical (TRUE or FALSE) indicating whether the summ_sims function should allow NAs in the cell-level estimate or break. The default is FALSE.

Value

A tibble with the following statistics by each variable specified in area_var: p_mrp_est: posterior mean, p_mrp_se: standard deviation of posterior, p_mrp_050: 5% quantile, p_mrp_100: 10% quantile, p_mrp_900: 90% quantile, and p_mrp_950: 95% quantile.

Examples

## Not run: 
drw_GA <- poststrat_draws(fit_GA, poststrat_tgt = acs_GA)
summ_sims(drw_GA, area_var = "cd") # also saved as data(`summ_GA`)

# To create summaries by both CD and education
drw_GA_educ <- poststrat_draws(fit_GA, poststrat_tgt = acs_GA, area_var = c("cd", "educ"))
summ_sims(drw_GA_educ, area_var = c("cd", "educ"))


## End(Not run)


kuriwaki/ccesMRPrun documentation built on Sept. 24, 2024, 2:15 a.m.