Wrapper around summarized results of List Experiment and Direct (Sensitive) question. This includes quantiles of parameters, comparison of distribution of answers to direct question and experiment questions, mean probability of responding Yes to direct question and indirect question, mean difference probabilities between experiment and direct question, both in provided data and predicted.
Arguments
- model
Output of
list_model().- data
Data used for model estimation in
list_model().- weights_df
Data frame containing id and weight. If not provided, the weights will be set to 1.
- weights_var
Character name of column storing weights.
- id
Quoted name of column with respondent's id.
Value
The function returns a list of summaries. There are 5 elements in the list: * params_quantiles * private_pre_post_df * public_pre_post_df * mean_probabilities * mean_raw_diff
params_quantiles – This element is also a data frame with 17 rows, each showing quantiles of the model parameters:
beta_direct
beta_list_control
beta_list_sensitive
intercept_direct
intercept_list_sensitive
intercept_list_control
prob_direct
prob_list
prob_hid_pos (hiding ceiling)
prob_hid_neg (hiding floor)
direct_logit
direct_in_list_logit
sensitive_logit
direct_sim (simulated data)
list_sim (simulated data)
lp__
private_pre_post_df – This element shows a comparison of simulated list experiment and actual choices of the list experiment. Each row compares the percentage of numeric responses to the list experiment question.
public_pre_post_df – Contains comparisons between simulated direct question answers and actual answers.
mean_probabilities – The mean probability of answering yes to indirect sensitive question, direct question, and the difference between them.
mean_raw_diff – This elements shows the difference between the mean answer in treatment group, control group and direct questions.
prob_by_group – This element shows the mean probabilities of answering yes to indirect sensitive question, direct question, and the difference between them, divided by demographic groups.
raw_means_by_group – This elements shows difference between mean answer in treatment group, control group and in direct question, divided by demographic groups.
Examples
if (FALSE) { # \dontrun{
library("dplyr")
data("list_experiment_toy")
# We select 3 categorical variables as demographic breaks and one artificial
# numeric variable just for the purpose of demonstration.
demo_toy <- list_experiment_toy %>%
select("response_id", "d_party", "s_gender", "s_region") %>%
mutate(num_var = rnorm(nrow(.), 3, 0.4))
# We can run read %>% assert %>% tidy in pipe
le_tidy_data_toy <-
list_read_data(list_experiment_toy, "response_id") %>%
list_assert_data(demo_toy, id = "response_id", n_items = 4L) %>%
list_tidy_data(id = response_id)
# We can run read %>% assert %>% tidy in pipe with additional parameters
# passed to the tidy function
le_tidy_data_toy <-
list_read_data(list_experiment_toy, "response_id") %>%
list_assert_data(demo_toy, id = "response_id", n_items = 4L) %>%
list_tidy_data(
id = response_id, keep_treat_direct = FALSE, unsure = "remove"
)
# We use output of tidy data as list_model input, and additionally add some
# rstan::sampling arguments to save time on execution
set.seed(666)
model_output <- list_model(
le_tidy_data_toy, iter = 400, cores = 2, chains = 2
)
# We can check the results with
demo_weights <- list_experiment_toy %>%
select("response_id", "weights")
list_model_results(model_output, le_tidy_data_toy, demo_weights, "weights")
} # }