Skip to contents

Takes output of [list_statistics_bulk()], restructures it and prepares the results to be passed to rendering functions list_render_sheets(), list_render_sheets_between() and list_render_sheets_within().

Usage

list_client_output_within(data)

list_client_output_between(data)

Arguments

data

A list. Results of list_statistics which is a nested list. The first level are bundles. Within each bundle there are statistics. The function requires that the second level of list elements contains prob_by_group and point_extimates$mean_probabilities elements.

Value

A list with three elements:

  • within/between comparison of demographic levels and Overall. The order of columns is determined by the order of columns and levels in demographic data frame passed to list_assert_data().

  • weighted_N a data frame with weighted counts of each demographic level and Overall.

  • reshaped_stats a data frame with probabilities, that will be used to find out which cells in Excel sheets should be colored.

Examples

library("dplyr") 
## Create a data frame with demographic variables
### We select 3 categorical variables as demographic breaks and one artificial
### numeric variable just for the purpose of demonstration.

demo_toy <- list_experiment_toy[1:300, ] %>%
  select("response_id", "d_party", "s_gender", "s_region") %>%
  mutate(num_var = rnorm(nrow(.), 3, 0.4))

## Create a data frame holding weights
  
demo_weights <- list_experiment_toy %>%
  select("response_id", "weights")

## Tidy the asserted data
### We can run read %>% assert %>% tidy in pipe to make code
### more compact. Tidied data set will be needed by both the list_model()
### and list_statistics_bulk() functions.

list_data_tidy <- list_read_data_bulk(
  list_experiment_toy[1:300, ], "response_id"
) %>%
list_assert_data_bulk(demo_toy, id = "response_id", n_items = 4L) %>%
list_tidy_data_bulk("response_id")
#> 

#> 
#> Building packages ■■■■■■■■■■■■■■■■■■■■■             67% | ETA:  4m

#> 

#> ── Asserting data for `bundle_1` ────────────────────────────────────────────────────────────────────────────────────────────
#> Building packages ■■■■■■■■■■■■■■■■■■■■■             67% | ETA:  4m

#> 

#> ℹ Asserting Identifiers
#> Building packages ■■■■■■■■■■■■■■■■■■■■■             67% | ETA:  4m

#> 

#> ℹ Asserting groups
#> Building packages ■■■■■■■■■■■■■■■■■■■■■             67% | ETA:  4m

#> 

#> ℹ Asserting direct question
#> Building packages ■■■■■■■■■■■■■■■■■■■■■             67% | ETA:  4m

#> 

#> ℹ Asserting response question
#> Building packages ■■■■■■■■■■■■■■■■■■■■■             67% | ETA:  4m

#> 

#> ℹ Asserting demo variables
#> Building packages ■■■■■■■■■■■■■■■■■■■■■             67% | ETA:  4m

#> 

#> ℹ Demo is data.frame with `response_id` column
#> Building packages ■■■■■■■■■■■■■■■■■■■■■             67% | ETA:  4m

#> 

#> ✖ 21 respondents have at least one missing value in break variables - dropping them.
#> 
#> Building packages ■■■■■■■■■■■■■■■■■■■■■             67% | ETA:  4m

#> 

#> 
#> Building packages ■■■■■■■■■■■■■■■■■■■■■             67% | ETA:  4m

#> 

#> ── Asserting data for `bundle_2` ────────────────────────────────────────────────────────────────────────────────────────────
#> Building packages ■■■■■■■■■■■■■■■■■■■■■             67% | ETA:  4m

#> 

#> ℹ Asserting Identifiers
#> Building packages ■■■■■■■■■■■■■■■■■■■■■             67% | ETA:  4m

#> 

#> ℹ Asserting groups
#> Building packages ■■■■■■■■■■■■■■■■■■■■■             67% | ETA:  4m

#> 

#> ℹ Asserting direct question
#> Building packages ■■■■■■■■■■■■■■■■■■■■■             67% | ETA:  4m

#> 

#> ℹ Asserting response question
#> Building packages ■■■■■■■■■■■■■■■■■■■■■             67% | ETA:  4m

#> 

#> ✖ 4 respondents from control group have response values that should not be available (other than integers from 0 to n_item) - dropping them.
#> Building packages ■■■■■■■■■■■■■■■■■■■■■             67% | ETA:  4m

#> 

#> ℹ Asserting demo variables
#> Building packages ■■■■■■■■■■■■■■■■■■■■■             67% | ETA:  4m

#> 

#> ℹ Demo is data.frame with `response_id` column
#> Building packages ■■■■■■■■■■■■■■■■■■■■■             67% | ETA:  4m

#> 

#> ✖ 21 respondents have at least one missing value in break variables - dropping them.
#> 
#> Building packages ■■■■■■■■■■■■■■■■■■■■■             67% | ETA:  4m

#> 

#> 
#> Building packages ■■■■■■■■■■■■■■■■■■■■■             67% | ETA:  4m

#> 

#> ── Asserting data for `bundle_3` ────────────────────────────────────────────────────────────────────────────────────────────
#> Building packages ■■■■■■■■■■■■■■■■■■■■■             67% | ETA:  4m

#> 

#> ℹ Asserting Identifiers
#> Building packages ■■■■■■■■■■■■■■■■■■■■■             67% | ETA:  4m

#> 

#> ℹ Asserting groups
#> Building packages ■■■■■■■■■■■■■■■■■■■■■             67% | ETA:  4m

#> 

#> ℹ Asserting direct question
#> Building packages ■■■■■■■■■■■■■■■■■■■■■             67% | ETA:  4m

#> 

#> ℹ Asserting response question
#> Building packages ■■■■■■■■■■■■■■■■■■■■■             67% | ETA:  4m

#> 

#> ℹ Asserting demo variables
#> Building packages ■■■■■■■■■■■■■■■■■■■■■             67% | ETA:  4m

#> 

#> ℹ Demo is data.frame with `response_id` column
#> Building packages ■■■■■■■■■■■■■■■■■■■■■             67% | ETA:  4m

#> 

#> ✖ 21 respondents have at least one missing value in break variables - dropping them.
#> 
#> Building packages ■■■■■■■■■■■■■■■■■■■■■             67% | ETA:  4m


## Run Models

### Pass the tidied data to list_model or list_model_bulk() functions.

if (FALSE) { # \dontrun{
list_model_toy_1 <- list_model(
  list_data_tidy[[1]], seed = 666, iter = 200, chains = 1
)
list_model_toy_2 <- list_model(
  list_data_tidy[[2]], seed = 666, iter = 200, chains = 1
)
 list_model_toy_3 <- list_model(
  list_data_tidy[[3]], seed = 666, iter = 200, chains = 1
)
} # }

### After running model you are able to extract the statistics

### The list_model_bulk() function stores the results in models directory.
### To simulate it lets create models directory and save there models mockups.
### The file names needs to end with "bundle_X.rds", where X is the number of
### the bundle.

out_dir <- file.path(tempdir(), "g6tr.list")
if (!dir.exists(out_dir)) dir.create(out_dir, recursive = TRUE)

data("list_model_toy_1")
data("list_model_toy_2")
data("list_model_toy_3")
saveRDS(list_model_toy_1, file.path(out_dir, "list_model_bundle_1.rds")) 
saveRDS(list_model_toy_2, file.path(out_dir, "list_model_bundle_2.rds"))
saveRDS(list_model_toy_3, file.path(out_dir, "list_model_bundle_3.rds"))

## The list statistic functions will calculate everything in one shot
### For all the bundles at once:

 statistics_output <- list_statistics_bulk(
   out_dir, "list_model_", list_data_tidy
 )
#> 

#> 
#> Building packages ■■■■■■■■■■■■■■■■■■■■■             67% | ETA:  4m

#> 

#> ── Tidying Model Results ────────────────────────────────────────────────────────────────────────────────────────────────────
#> Building packages ■■■■■■■■■■■■■■■■■■■■■             67% | ETA:  4m

#> 

#> ─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
#> Building packages ■■■■■■■■■■■■■■■■■■■■■             67% | ETA:  4m

#> 

#> 
#> Building packages ■■■■■■■■■■■■■■■■■■■■■             67% | ETA:  4m

#> 

#> ── Calculating Overall Model Statistics ─────────────────────────────────────────────────────────────────────────────────────
#> Building packages ■■■■■■■■■■■■■■■■■■■■■             67% | ETA:  4m

#> 
ℹ Calculating parameters quantiles

#> 
✔ Parameters quantiles ready! [11ms]

#> 
#> Building packages ■■■■■■■■■■■■■■■■■■■■■             67% | ETA:  4m

#> 
ℹ Calculating public simulated vs. actual answers

#> 
✔ Public simulated vs. actual answers ready! [20ms]

#> 
#> Building packages ■■■■■■■■■■■■■■■■■■■■■             67% | ETA:  4m

#> 
ℹ Calculating private simulated vs. actual answers

#> 
✔ Private simulated vs. actual answers ready! [24ms]

#> 
#> Building packages ■■■■■■■■■■■■■■■■■■■■■             67% | ETA:  4m

#> 
ℹ Calculating average public probabilities

#> 
✔ Average public probabilities ready! [8ms]

#> 
#> Building packages ■■■■■■■■■■■■■■■■■■■■■             67% | ETA:  4m

#> 
ℹ Calculating average private probabilities

#> 
✔ Average private probabilities ready! [8ms]

#> 
#> Building packages ■■■■■■■■■■■■■■■■■■■■■             67% | ETA:  4m

#> 
ℹ Calculating average delta probabilities

#> 
✔ Average delta probabilities ready! [9ms]

#> 
#> Building packages ■■■■■■■■■■■■■■■■■■■■■             67% | ETA:  4m

#> 
ℹ Calculating average survey responses

#> 
✔ Average survey responses ready! [9ms]

#> 
#> Building packages ■■■■■■■■■■■■■■■■■■■■■             67% | ETA:  4m

#> 

#> ─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
#> Building packages ■■■■■■■■■■■■■■■■■■■■■             67% | ETA:  4m

#> 

#> 
#> Building packages ■■■■■■■■■■■■■■■■■■■■■             67% | ETA:  4m

#> 

#> ── Calculating Statistical Tests ────────────────────────────────────────────────────────────────────────────────────────────
#> Building packages ■■■■■■■■■■■■■■■■■■■■■             67% | ETA:  4m

#> 

#> 
#> Building packages ■■■■■■■■■■■■■■■■■■■■■             67% | ETA:  4m

#> 

#> ── Calcualting Average group probabilities ──
#> Building packages ■■■■■■■■■■■■■■■■■■■■■             67% | ETA:  4m

#> 

#> 
#> Building packages ■■■■■■■■■■■■■■■■■■■■■             67% | ETA:  4m

#> 
ℹ Calculating public probabilities for: `d_party`

#> 
✔ Public probabilities for: `s_gender` ready! [5ms]

#> 
#> Building packages ■■■■■■■■■■■■■■■■■■■■■             67% | ETA:  4m

#> 
ℹ Calculating public probabilities for: `s_gender`

#> 
✔ Public probabilities for: `s_region` ready! [10ms]

#> 
#> Building packages ■■■■■■■■■■■■■■■■■■■■■             67% | ETA:  4m

#> 
ℹ Calculating public probabilities for: `s_region`

#> 
✔ Public probabilities for: `d_party` ready! [11ms]

#> 
#> Building packages ■■■■■■■■■■■■■■■■■■■■■             67% | ETA:  4m

#> 
ℹ Calculating private probabilities for: `d_party`

#> 
✔ Private probabilities for: `s_gender` ready! [12ms]

#> 
#> Building packages ■■■■■■■■■■■■■■■■■■■■■             67% | ETA:  4m

#> 
ℹ Calculating private probabilities for: `s_gender`

#> 
✔ Private probabilities for: `s_region` ready! [11ms]

#> 
#> Building packages ■■■■■■■■■■■■■■■■■■■■■             67% | ETA:  4m

#> 
ℹ Calculating private probabilities for: `s_region`

#> 
✔ Private probabilities for: `d_party` ready! [11ms]

#> 
#> Building packages ■■■■■■■■■■■■■■■■■■■■■             67% | ETA:  4m

#> 
ℹ Calculating delta probabilities for: `d_party`

#> 
✔ Delta probabilities for: `s_gender` ready! [11ms]

#> 
#> Building packages ■■■■■■■■■■■■■■■■■■■■■             67% | ETA:  4m

#> 
ℹ Calculating delta probabilities for: `s_gender`

#> 
✔ Delta probabilities for: `s_region` ready! [12ms]

#> 
#> Building packages ■■■■■■■■■■■■■■■■■■■■■             67% | ETA:  4m

#> 
ℹ Calculating delta probabilities for: `s_region`

#> 
✔ Delta probabilities for: `s_region` ready! [24ms]

#> 
#> Building packages ■■■■■■■■■■■■■■■■■■■■■             67% | ETA:  4m

#> 

#> ── Tidying Model Results ────────────────────────────────────────────────────────────────────────────────────────────────────
#> Building packages ■■■■■■■■■■■■■■■■■■■■■             67% | ETA:  4m

#> 

#> ─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
#> Building packages ■■■■■■■■■■■■■■■■■■■■■             67% | ETA:  4m

#> 

#> 
#> Building packages ■■■■■■■■■■■■■■■■■■■■■             67% | ETA:  4m

#> 

#> ── Calculating Overall Model Statistics ─────────────────────────────────────────────────────────────────────────────────────
#> Building packages ■■■■■■■■■■■■■■■■■■■■■             67% | ETA:  4m

#> 
ℹ Calculating parameters quantiles

#> 
✔ Parameters quantiles ready! [11ms]

#> 
#> Building packages ■■■■■■■■■■■■■■■■■■■■■             67% | ETA:  4m

#> 
ℹ Calculating public simulated vs. actual answers

#> 
✔ Public simulated vs. actual answers ready! [20ms]

#> 
#> Building packages ■■■■■■■■■■■■■■■■■■■■■             67% | ETA:  4m

#> 
ℹ Calculating private simulated vs. actual answers

#> 
✔ Private simulated vs. actual answers ready! [24ms]

#> 
#> Building packages ■■■■■■■■■■■■■■■■■■■■■             67% | ETA:  4m

#> 
ℹ Calculating average public probabilities

#> 
✔ Average public probabilities ready! [9ms]

#> 
#> Building packages ■■■■■■■■■■■■■■■■■■■■■             67% | ETA:  4m

#> 
ℹ Calculating average private probabilities

#> 
✔ Average private probabilities ready! [8ms]

#> 
#> Building packages ■■■■■■■■■■■■■■■■■■■■■             67% | ETA:  4m

#> 
ℹ Calculating average delta probabilities

#> 
✔ Average delta probabilities ready! [9ms]

#> 
#> Building packages ■■■■■■■■■■■■■■■■■■■■■             67% | ETA:  4m

#> 
ℹ Calculating average survey responses

#> 
✔ Average survey responses ready! [9ms]

#> 
#> Building packages ■■■■■■■■■■■■■■■■■■■■■             67% | ETA:  4m

#> 

#> ─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
#> Building packages ■■■■■■■■■■■■■■■■■■■■■             67% | ETA:  4m

#> 

#> 
#> Building packages ■■■■■■■■■■■■■■■■■■■■■             67% | ETA:  4m

#> 

#> ── Calculating Statistical Tests ────────────────────────────────────────────────────────────────────────────────────────────
#> Building packages ■■■■■■■■■■■■■■■■■■■■■             67% | ETA:  4m

#> 

#> 
#> Building packages ■■■■■■■■■■■■■■■■■■■■■             67% | ETA:  4m

#> 

#> ── Calcualting Average group probabilities ──
#> Building packages ■■■■■■■■■■■■■■■■■■■■■             67% | ETA:  4m

#> 

#> 
#> Building packages ■■■■■■■■■■■■■■■■■■■■■             67% | ETA:  4m

#> 
ℹ Calculating public probabilities for: `d_party`

#> 
✔ Public probabilities for: `s_gender` ready! [5ms]

#> 
#> Building packages ■■■■■■■■■■■■■■■■■■■■■             67% | ETA:  4m

#> 
ℹ Calculating public probabilities for: `s_gender`

#> 
✔ Public probabilities for: `s_region` ready! [10ms]

#> 
#> Building packages ■■■■■■■■■■■■■■■■■■■■■             67% | ETA:  4m

#> 
ℹ Calculating public probabilities for: `s_region`

#> 
✔ Public probabilities for: `d_party` ready! [11ms]

#> 
#> Building packages ■■■■■■■■■■■■■■■■■■■■■             67% | ETA:  4m

#> 
ℹ Calculating private probabilities for: `d_party`

#> 
✔ Private probabilities for: `s_gender` ready! [10ms]

#> 
#> Building packages ■■■■■■■■■■■■■■■■■■■■■             67% | ETA:  4m

#> 
ℹ Calculating private probabilities for: `s_gender`

#> 
✔ Private probabilities for: `s_region` ready! [10ms]

#> 
#> Building packages ■■■■■■■■■■■■■■■■■■■■■             67% | ETA:  4m

#> 
ℹ Calculating private probabilities for: `s_region`

#> 
✔ Private probabilities for: `d_party` ready! [10ms]

#> 
#> Building packages ■■■■■■■■■■■■■■■■■■■■■             67% | ETA:  4m

#> 
ℹ Calculating delta probabilities for: `d_party`

#> 
✔ Delta probabilities for: `s_gender` ready! [10ms]

#> 
#> Building packages ■■■■■■■■■■■■■■■■■■■■■             67% | ETA:  4m

#> 
ℹ Calculating delta probabilities for: `s_gender`

#> 
✔ Delta probabilities for: `s_region` ready! [10ms]

#> 
#> Building packages ■■■■■■■■■■■■■■■■■■■■■             67% | ETA:  4m

#> 
ℹ Calculating delta probabilities for: `s_region`

#> 
✔ Delta probabilities for: `s_region` ready! [60ms]

#> 
#> Building packages ■■■■■■■■■■■■■■■■■■■■■             67% | ETA:  4m

#> 

#> ── Tidying Model Results ────────────────────────────────────────────────────────────────────────────────────────────────────
#> Building packages ■■■■■■■■■■■■■■■■■■■■■             67% | ETA:  4m

#> 

#> ─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
#> Building packages ■■■■■■■■■■■■■■■■■■■■■             67% | ETA:  4m

#> 

#> 
#> Building packages ■■■■■■■■■■■■■■■■■■■■■             67% | ETA:  4m

#> 

#> ── Calculating Overall Model Statistics ─────────────────────────────────────────────────────────────────────────────────────
#> Building packages ■■■■■■■■■■■■■■■■■■■■■             67% | ETA:  4m

#> 
ℹ Calculating parameters quantiles

#> 
✔ Parameters quantiles ready! [11ms]

#> 
#> Building packages ■■■■■■■■■■■■■■■■■■■■■             67% | ETA:  4m

#> 
ℹ Calculating public simulated vs. actual answers

#> 
✔ Public simulated vs. actual answers ready! [20ms]

#> 
#> Building packages ■■■■■■■■■■■■■■■■■■■■■             67% | ETA:  4m

#> 
ℹ Calculating private simulated vs. actual answers

#> 
✔ Private simulated vs. actual answers ready! [25ms]

#> 
#> Building packages ■■■■■■■■■■■■■■■■■■■■■             67% | ETA:  4m

#> 
ℹ Calculating average public probabilities

#> 
✔ Average public probabilities ready! [8ms]

#> 
#> Building packages ■■■■■■■■■■■■■■■■■■■■■             67% | ETA:  4m

#> 
ℹ Calculating average private probabilities

#> 
✔ Average private probabilities ready! [8ms]

#> 
#> Building packages ■■■■■■■■■■■■■■■■■■■■■             67% | ETA:  4m

#> 
ℹ Calculating average delta probabilities

#> 
✔ Average delta probabilities ready! [9ms]

#> 
#> Building packages ■■■■■■■■■■■■■■■■■■■■■             67% | ETA:  4m

#> 
ℹ Calculating average survey responses

#> 
✔ Average survey responses ready! [9ms]

#> 
#> Building packages ■■■■■■■■■■■■■■■■■■■■■             67% | ETA:  4m

#> 

#> ─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
#> Building packages ■■■■■■■■■■■■■■■■■■■■■             67% | ETA:  4m

#> 

#> 
#> Building packages ■■■■■■■■■■■■■■■■■■■■■             67% | ETA:  4m

#> 

#> ── Calculating Statistical Tests ────────────────────────────────────────────────────────────────────────────────────────────
#> Building packages ■■■■■■■■■■■■■■■■■■■■■             67% | ETA:  4m

#> 

#> 
#> Building packages ■■■■■■■■■■■■■■■■■■■■■             67% | ETA:  4m

#> 

#> ── Calcualting Average group probabilities ──
#> Building packages ■■■■■■■■■■■■■■■■■■■■■             67% | ETA:  4m

#> 

#> 
#> Building packages ■■■■■■■■■■■■■■■■■■■■■             67% | ETA:  4m

#> 
ℹ Calculating public probabilities for: `d_party`

#> 
✔ Public probabilities for: `s_gender` ready! [5ms]

#> 
#> Building packages ■■■■■■■■■■■■■■■■■■■■■             67% | ETA:  4m

#> 
ℹ Calculating public probabilities for: `s_gender`

#> 
✔ Public probabilities for: `s_region` ready! [11ms]

#> 
#> Building packages ■■■■■■■■■■■■■■■■■■■■■             67% | ETA:  4m

#> 
ℹ Calculating public probabilities for: `s_region`

#> 
✔ Public probabilities for: `d_party` ready! [12ms]

#> 
#> Building packages ■■■■■■■■■■■■■■■■■■■■■             67% | ETA:  4m

#> 
ℹ Calculating private probabilities for: `d_party`

#> 
✔ Private probabilities for: `s_gender` ready! [12ms]

#> 
#> Building packages ■■■■■■■■■■■■■■■■■■■■■             67% | ETA:  4m

#> 
ℹ Calculating private probabilities for: `s_gender`

#> 
✔ Private probabilities for: `s_region` ready! [10ms]

#> 
#> Building packages ■■■■■■■■■■■■■■■■■■■■■             67% | ETA:  4m

#> 
ℹ Calculating private probabilities for: `s_region`

#> 
✔ Private probabilities for: `d_party` ready! [10ms]

#> 
#> Building packages ■■■■■■■■■■■■■■■■■■■■■             67% | ETA:  4m

#> 
ℹ Calculating delta probabilities for: `d_party`

#> 
✔ Delta probabilities for: `s_gender` ready! [10ms]

#> 
#> Building packages ■■■■■■■■■■■■■■■■■■■■■             67% | ETA:  4m

#> 
ℹ Calculating delta probabilities for: `s_gender`

#> 
✔ Delta probabilities for: `s_region` ready! [10ms]

#> 
#> Building packages ■■■■■■■■■■■■■■■■■■■■■             67% | ETA:  4m

#> 
ℹ Calculating delta probabilities for: `s_region`

#> 
✔ Delta probabilities for: `s_region` ready! [22ms]

#> 
#> Building packages ■■■■■■■■■■■■■■■■■■■■■             67% | ETA:  4m


## Since the output of list statistics is a list, you can easily runt the
## function for all of the bundles with lapply:

lapply(statistics_output, list_client_output_within)
#> $bundle_1
#> $bundle_1$within
#> # A tibble: 1 × 44
#>   Overall__Overall__private Overall__Overall__public Overall__Overall__delta
#>                       <dbl>                    <dbl>                   <dbl>
#> 1                     0.531                    0.211                   0.321
#> # ℹ 41 more variables: `Overall__Overall__abs delta` <dbl>,
#> #   d_party__Democrat__private <dbl>, d_party__Democrat__public <dbl>,
#> #   d_party__Democrat__delta <dbl>, `d_party__Democrat__abs delta` <dbl>,
#> #   d_party__Independent__private <dbl>, d_party__Independent__public <dbl>,
#> #   d_party__Independent__delta <dbl>, `d_party__Independent__abs delta` <dbl>,
#> #   d_party__Republican__private <dbl>, d_party__Republican__public <dbl>,
#> #   d_party__Republican__delta <dbl>, `d_party__Republican__abs delta` <dbl>, …
#> 
#> $bundle_1$weighted_N
#> # A tibble: 11 × 2
#>    demo_value      N
#>    <chr>       <dbl>
#>  1 Overall       279
#>  2 Democrat      113
#>  3 Independent    79
#>  4 Republican     78
#>  5 Other           9
#>  6 Female        176
#>  7 Male          103
#>  8 Northeast      53
#>  9 Midwest        58
#> 10 South         122
#> 11 West           46
#> 
#> $bundle_1$reshaped_stats
#> # A tibble: 11 × 7
#>    demo_variable demo_value  within_delta_higher within_delta_lower ordering_var
#>    <chr>         <chr>                     <dbl>              <dbl> <fct>       
#>  1 Overall       Overall                    0.99               0    Overall__Ov…
#>  2 d_party       Democrat                   0.94               0.05 d_party__De…
#>  3 d_party       Independent                0.99               0.01 d_party__In…
#>  4 d_party       Republican                 0.97               0.01 d_party__Re…
#>  5 d_party       Other                      0.76               0.11 d_party__Ot…
#>  6 s_gender      Female                     0.99               0    s_gender__F…
#>  7 s_gender      Male                       0.92               0.04 s_gender__M…
#>  8 s_region      Northeast                  0.76               0.07 s_region__N…
#>  9 s_region      Midwest                    0.95               0.03 s_region__M…
#> 10 s_region      South                      1                  0    s_region__S…
#> 11 s_region      West                       0.44               0.43 s_region__W…
#> # ℹ 2 more variables: threshold <chr>, diff_sign <chr>
#> 
#> 
#> $bundle_2
#> $bundle_2$within
#> # A tibble: 1 × 44
#>   Overall__Overall__private Overall__Overall__public Overall__Overall__delta
#>                       <dbl>                    <dbl>                   <dbl>
#> 1                     0.195                    0.184                  0.0109
#> # ℹ 41 more variables: `Overall__Overall__abs delta` <dbl>,
#> #   d_party__Democrat__private <dbl>, d_party__Democrat__public <dbl>,
#> #   d_party__Democrat__delta <dbl>, `d_party__Democrat__abs delta` <dbl>,
#> #   d_party__Independent__private <dbl>, d_party__Independent__public <dbl>,
#> #   d_party__Independent__delta <dbl>, `d_party__Independent__abs delta` <dbl>,
#> #   d_party__Republican__private <dbl>, d_party__Republican__public <dbl>,
#> #   d_party__Republican__delta <dbl>, `d_party__Republican__abs delta` <dbl>, …
#> 
#> $bundle_2$weighted_N
#> # A tibble: 11 × 2
#>    demo_value      N
#>    <chr>       <dbl>
#>  1 Overall       275
#>  2 Democrat      112
#>  3 Independent    78
#>  4 Republican     76
#>  5 Other           9
#>  6 Female        174
#>  7 Male          101
#>  8 Northeast      53
#>  9 Midwest        57
#> 10 South         120
#> 11 West           45
#> 
#> $bundle_2$reshaped_stats
#> # A tibble: 11 × 7
#>    demo_variable demo_value  within_delta_higher within_delta_lower ordering_var
#>    <chr>         <chr>                     <dbl>              <dbl> <fct>       
#>  1 Overall       Overall                    0.4                0.38 Overall__Ov…
#>  2 d_party       Democrat                   0.25               0.64 d_party__De…
#>  3 d_party       Independent                0.81               0.08 d_party__In…
#>  4 d_party       Republican                 0.26               0.58 d_party__Re…
#>  5 d_party       Other                      0.19               0.7  d_party__Ot…
#>  6 s_gender      Female                     0.28               0.6  s_gender__F…
#>  7 s_gender      Male                       0.7                0.11 s_gender__M…
#>  8 s_region      Northeast                  0.48               0.34 s_region__N…
#>  9 s_region      Midwest                    0.6                0.3  s_region__M…
#> 10 s_region      South                      0.14               0.7  s_region__S…
#> 11 s_region      West                       0.26               0.58 s_region__W…
#> # ℹ 2 more variables: threshold <chr>, diff_sign <chr>
#> 
#> 
#> $bundle_3
#> $bundle_3$within
#> # A tibble: 1 × 44
#>   Overall__Overall__private Overall__Overall__public Overall__Overall__delta
#>                       <dbl>                    <dbl>                   <dbl>
#> 1                     0.531                    0.211                   0.321
#> # ℹ 41 more variables: `Overall__Overall__abs delta` <dbl>,
#> #   d_party__Democrat__private <dbl>, d_party__Democrat__public <dbl>,
#> #   d_party__Democrat__delta <dbl>, `d_party__Democrat__abs delta` <dbl>,
#> #   d_party__Independent__private <dbl>, d_party__Independent__public <dbl>,
#> #   d_party__Independent__delta <dbl>, `d_party__Independent__abs delta` <dbl>,
#> #   d_party__Republican__private <dbl>, d_party__Republican__public <dbl>,
#> #   d_party__Republican__delta <dbl>, `d_party__Republican__abs delta` <dbl>, …
#> 
#> $bundle_3$weighted_N
#> # A tibble: 11 × 2
#>    demo_value      N
#>    <chr>       <dbl>
#>  1 Overall       279
#>  2 Democrat      113
#>  3 Independent    79
#>  4 Republican     78
#>  5 Other           9
#>  6 Female        176
#>  7 Male          103
#>  8 Northeast      53
#>  9 Midwest        58
#> 10 South         122
#> 11 West           46
#> 
#> $bundle_3$reshaped_stats
#> # A tibble: 11 × 7
#>    demo_variable demo_value  within_delta_higher within_delta_lower ordering_var
#>    <chr>         <chr>                     <dbl>              <dbl> <fct>       
#>  1 Overall       Overall                    0.99               0    Overall__Ov…
#>  2 d_party       Democrat                   0.94               0.05 d_party__De…
#>  3 d_party       Independent                0.99               0.01 d_party__In…
#>  4 d_party       Republican                 0.97               0.01 d_party__Re…
#>  5 d_party       Other                      0.76               0.11 d_party__Ot…
#>  6 s_gender      Female                     0.99               0    s_gender__F…
#>  7 s_gender      Male                       0.92               0.04 s_gender__M…
#>  8 s_region      Northeast                  0.76               0.07 s_region__N…
#>  9 s_region      Midwest                    0.95               0.03 s_region__M…
#> 10 s_region      South                      1                  0    s_region__S…
#> 11 s_region      West                       0.44               0.43 s_region__W…
#> # ℹ 2 more variables: threshold <chr>, diff_sign <chr>
#> 
#> 
lapply(statistics_output, list_client_output_between)
#> $bundle_1
#> $bundle_1$between
#> # A tibble: 1 × 52
#>   Overall__private__d_party Democrat__private__d_party Independent__private__d…¹
#>                       <dbl>                      <dbl>                     <dbl>
#> 1                     0.531                      0.475                     0.480
#> # ℹ abbreviated name: ¹​Independent__private__d_party
#> # ℹ 49 more variables: Republican__private__d_party <dbl>,
#> #   Other__private__d_party <dbl>, Overall__public__d_party <dbl>,
#> #   Democrat__public__d_party <dbl>, Independent__public__d_party <dbl>,
#> #   Republican__public__d_party <dbl>, Other__public__d_party <dbl>,
#> #   Overall__delta__d_party <dbl>, Democrat__delta__d_party <dbl>,
#> #   Independent__delta__d_party <dbl>, Republican__delta__d_party <dbl>, …
#> 
#> $bundle_1$weighted_N
#> # A tibble: 11 × 2
#>    demo_value      N
#>    <chr>       <dbl>
#>  1 Overall       279
#>  2 Democrat      113
#>  3 Independent    79
#>  4 Republican     78
#>  5 Other           9
#>  6 Female        176
#>  7 Male          103
#>  8 Northeast      53
#>  9 Midwest        58
#> 10 South         122
#> 11 West           46
#> 
#> $bundle_1$reshaped_stats
#> # A tibble: 30 × 7
#>    demo_variable demo_value  statistic between_delta_higher between_delta_lower
#>    <chr>         <chr>       <chr>                    <dbl>               <dbl>
#>  1 d_party       Democrat    private                   0.2                 0.61
#>  2 d_party       Democrat    public                    0.18                0.09
#>  3 d_party       Democrat    delta                     0.19                0.62
#>  4 d_party       Independent private                   0.25                0.63
#>  5 d_party       Independent public                    0                   0.9 
#>  6 d_party       Independent delta                     0.46                0.31
#>  7 d_party       Republican  private                   0.81                0.08
#>  8 d_party       Republican  public                    0.88                0   
#>  9 d_party       Republican  delta                     0.61                0.25
#> 10 d_party       Other       private                   0.42                0.57
#> # ℹ 20 more rows
#> # ℹ 2 more variables: threshold <chr>, diff_sign <chr>
#> 
#> 
#> $bundle_2
#> $bundle_2$between
#> # A tibble: 1 × 52
#>   Overall__private__d_party Democrat__private__d_party Independent__private__d…¹
#>                       <dbl>                      <dbl>                     <dbl>
#> 1                     0.195                      0.143                     0.315
#> # ℹ abbreviated name: ¹​Independent__private__d_party
#> # ℹ 49 more variables: Republican__private__d_party <dbl>,
#> #   Other__private__d_party <dbl>, Overall__public__d_party <dbl>,
#> #   Democrat__public__d_party <dbl>, Independent__public__d_party <dbl>,
#> #   Republican__public__d_party <dbl>, Other__public__d_party <dbl>,
#> #   Overall__delta__d_party <dbl>, Democrat__delta__d_party <dbl>,
#> #   Independent__delta__d_party <dbl>, Republican__delta__d_party <dbl>, …
#> 
#> $bundle_2$weighted_N
#> # A tibble: 11 × 2
#>    demo_value      N
#>    <chr>       <dbl>
#>  1 Overall       275
#>  2 Democrat      112
#>  3 Independent    78
#>  4 Republican     76
#>  5 Other           9
#>  6 Female        174
#>  7 Male          101
#>  8 Northeast      53
#>  9 Midwest        57
#> 10 South         120
#> 11 West           45
#> 
#> $bundle_2$reshaped_stats
#> # A tibble: 30 × 7
#>    demo_variable demo_value  statistic between_delta_higher between_delta_lower
#>    <chr>         <chr>       <chr>                    <dbl>               <dbl>
#>  1 d_party       Democrat    private                   0.12                0.67
#>  2 d_party       Democrat    public                    0.16                0.1 
#>  3 d_party       Democrat    delta                     0.13                0.65
#>  4 d_party       Independent private                   0.83                0.07
#>  5 d_party       Independent public                    0.09                0.51
#>  6 d_party       Independent delta                     0.87                0.05
#>  7 d_party       Republican  private                   0.2                 0.55
#>  8 d_party       Republican  public                    0.4                 0.07
#>  9 d_party       Republican  delta                     0.19                0.63
#> 10 d_party       Other       private                   0.13                0.76
#> # ℹ 20 more rows
#> # ℹ 2 more variables: threshold <chr>, diff_sign <chr>
#> 
#> 
#> $bundle_3
#> $bundle_3$between
#> # A tibble: 1 × 52
#>   Overall__private__d_party Democrat__private__d_party Independent__private__d…¹
#>                       <dbl>                      <dbl>                     <dbl>
#> 1                     0.531                      0.475                     0.480
#> # ℹ abbreviated name: ¹​Independent__private__d_party
#> # ℹ 49 more variables: Republican__private__d_party <dbl>,
#> #   Other__private__d_party <dbl>, Overall__public__d_party <dbl>,
#> #   Democrat__public__d_party <dbl>, Independent__public__d_party <dbl>,
#> #   Republican__public__d_party <dbl>, Other__public__d_party <dbl>,
#> #   Overall__delta__d_party <dbl>, Democrat__delta__d_party <dbl>,
#> #   Independent__delta__d_party <dbl>, Republican__delta__d_party <dbl>, …
#> 
#> $bundle_3$weighted_N
#> # A tibble: 11 × 2
#>    demo_value      N
#>    <chr>       <dbl>
#>  1 Overall       279
#>  2 Democrat      113
#>  3 Independent    79
#>  4 Republican     78
#>  5 Other           9
#>  6 Female        176
#>  7 Male          103
#>  8 Northeast      53
#>  9 Midwest        58
#> 10 South         122
#> 11 West           46
#> 
#> $bundle_3$reshaped_stats
#> # A tibble: 30 × 7
#>    demo_variable demo_value  statistic between_delta_higher between_delta_lower
#>    <chr>         <chr>       <chr>                    <dbl>               <dbl>
#>  1 d_party       Democrat    private                   0.2                 0.61
#>  2 d_party       Democrat    public                    0.18                0.09
#>  3 d_party       Democrat    delta                     0.19                0.62
#>  4 d_party       Independent private                   0.25                0.63
#>  5 d_party       Independent public                    0                   0.9 
#>  6 d_party       Independent delta                     0.46                0.31
#>  7 d_party       Republican  private                   0.81                0.08
#>  8 d_party       Republican  public                    0.88                0   
#>  9 d_party       Republican  delta                     0.61                0.25
#> 10 d_party       Other       private                   0.42                0.57
#> # ℹ 20 more rows
#> # ℹ 2 more variables: threshold <chr>, diff_sign <chr>
#> 
#>