The purpose of this document is provide a description and summary statistics for each variable. Variables are categorized as continuous or categorical variables. The dataset used in the clean version already excluded respondents who are not in Phase 1 or Phase 2 and those who actually repeated the chatbot.

The raw data for was downloaded from Chatfuel and undergone an anonymization process before being stored in Sherlock. The anynomized data was then downloaded from Sherlock and stored in the data folder. The cleaning process involved dropping observations who are not in Phase 1 or Phase 2 and dropping actual repeaters. We identified actual repeaters by looking at whether they have a timestamp in more than one treatment arms and dropped them. Attempted repeaters are not actual repeaters, and these respondents were turned away from the chatbot when they tried to enter the chatbot for the second time after completing the first time. Since they did not repeat the chatbot, we don’t drop them from our dataset. We also checked to make sure all observations are unique by comparing the number of unique id with the number of observations in the dataset.

  • The anonymized dataset is stored in Github directory ~fb_misinfo_interventions/data/

Loading R library

packages = c(
  "tidyverse", "data.table", "dtplyr", "rlang", "kableExtra"
)

# Load the packages, install if necessary
new_packages = packages[!(packages %in% installed.packages()[,"Package"])]
if(length(new_packages)) install.packages(new_packages, dependencies = TRUE)
lapply(packages, require, character.only = TRUE) |> invisible()

Data Loading:

The data is stored in the data folder in the Github directory. The data is loaded into R using the fread function from the data.table package. The data is loaded into two different formats: wide and long.

We select users who consented only.

df_wide <- readRDS("./data/chatfuel/misinfo_clean_wide.rds") |>
  filter(consent_coded_num == 1)

df_long <- readRDS("./data/chatfuel/misinfo_clean_long.rds")

Summary statistics for continous variables

Funtions

summary_stats_continous <- function(dt, variable, group = NULL){
  # Get descriptive statistics for a single continuous variable
  variable_name = variable 
  variable = sym(variable)

  if(!is.null(group)){
    group_name = group
    group = sym(group)
    dt <- dt |> group_by({{group}})
  }

  tab = dt |> lazy_dt() |>
    mutate(
      `Number_Missing` = sum(is.na({{variable}})),
    ) |>
    filter(!is.na({{variable}})) |>
    summarise(
        Total_Observations = n(),
        Number_Missing = first(`Number_Missing`),
        Mean = as.numeric(mean({{variable}})),
        SD = as.numeric(sd({{variable}})),
        Min = as.numeric(min({{variable}})),
        Max =  as.numeric(max({{variable}})),
        Decile_10 = as.numeric(quantile({{variable}}, probs = 0.1)),
        Decile_20 = as.numeric(quantile({{variable}}, probs = 0.2)),
        Decile_30 = as.numeric(quantile({{variable}}, probs = 0.3)),
        Decile_40 = as.numeric(quantile({{variable}}, probs = 0.4)),
        Decile_50 = as.numeric(quantile({{variable}}, probs = 0.5)),
        Decile_60 = as.numeric(quantile({{variable}}, probs = 0.6)),
        Decile_70 = as.numeric(quantile({{variable}}, probs = 0.7)),
        Decile_80 = as.numeric(quantile({{variable}}, probs = 0.8)),
        Decile_90 = as.numeric(quantile({{variable}}, probs = 0.9))
      ) |>
      mutate(
        Proportion_Missing = Number_Missing / Total_Observations,
        Variable = variable_name
      ) |>
      collect()

  if (is.null(group)){
    tab <- tab |> select(Variable, everything())
  } else {
    tab <- tab |> mutate(Group = paste(group_name, ": ", {{group}})) |> select(Variable, Group, everything()) |> select(-{{group}})
  }

  return(tab)
}

summary_stats_table_continous <- function(dt, variables, group = NULL,
  filename = NULL, print_html = TRUE, caption = NULL
  ){
  # Get descriptive statistics for a list of continuous variables and return a combined table
  results <- lapply(variables, function(x) summary_stats_continous(dt, x, group))
  results <- bind_rows(results)

  if(!is.null(filename)){
    write.csv(results, paste0("./data/chatfuel_summary_statistics/", filename))
  }

  if (print_html){
    results = results |> 
      kable(digits = 3,caption = caption) |>
      kable_styling(bootstrap_options = c("striped", "hover")) |>
      scroll_box( height = "500px")
  }
  
  return(results)
}

User level variables

continous_var <- c("intervention_duration", "total_duration", "misinfo_quiz_duration",
                    "mean_share_misinfo", "mean_reliable_misinfo", "mean_manipulative_misinfo", "mean_share_nonmisinfo",
                    "mean_reliable_nonmisinfo", "mean_manipulative_nonmisinfo", "sharing_discernment", "reliability_discernment", "manipulation_discernment")


summary_stats_table_continous(df_wide,
  variables = continous_var,
  filename = "continous_stat_results_consent.csv",
  caption = "Summary Statistics for Continous Variables",
  print_html = TRUE
  )
Summary Statistics for Continous Variables
Variable Total_Observations Number_Missing Mean SD Min Max Decile_10 Decile_20 Decile_30 Decile_40 Decile_50 Decile_60 Decile_70 Decile_80 Decile_90 Proportion_Missing
intervention_duration 52226 18327 235.026 2495.571 3.967 100300.6 9.233 11.700 13.017 14.283 15.717 17.683 20.750 26.867 60.317 0.351
total_duration 44122 26431 489.004 4093.127 -14553.200 112736.4 16.802 19.317 21.433 23.650 26.333 30.067 36.033 51.080 228.928 0.599
misinfo_quiz_duration 44117 26436 215.668 3033.284 1.200 112690.2 3.817 4.517 5.117 5.717 6.383 7.233 8.383 10.383 17.200 0.599
mean_share_misinfo 43996 26557 0.532 0.383 0.000 1.0 0.000 0.000 0.333 0.333 0.667 0.667 1.000 1.000 1.000 0.604
mean_reliable_misinfo 43990 26563 2.594 1.246 1.000 5.0 1.000 1.333 1.667 2.000 2.333 2.667 3.333 3.667 4.667 0.604
mean_manipulative_misinfo 43994 26559 3.030 1.293 1.000 5.0 1.333 1.667 2.333 2.667 3.000 3.667 3.667 4.333 5.000 0.604
mean_share_nonmisinfo 43995 26558 0.721 0.354 0.000 1.0 0.000 0.500 0.500 0.500 1.000 1.000 1.000 1.000 1.000 0.604
mean_reliable_nonmisinfo 43976 26577 3.100 1.336 1.000 5.0 1.000 1.500 2.000 3.000 3.000 3.500 4.000 4.500 5.000 0.604
mean_manipulative_nonmisinfo 43984 26569 2.545 1.334 1.000 5.0 1.000 1.000 1.500 2.000 2.500 3.000 3.000 4.000 5.000 0.604
sharing_discernment 43992 26561 0.189 0.405 -1.000 1.0 -0.333 0.000 0.000 0.000 0.167 0.333 0.333 0.500 0.667 0.604
reliability_discernment 43971 26582 0.506 1.332 -4.000 4.0 -1.000 -0.500 0.000 0.000 0.333 0.667 1.000 1.667 2.333 0.605
manipulation_discernment 43982 26571 -0.485 1.389 -4.000 4.0 -2.333 -1.667 -1.000 -0.667 -0.333 0.000 0.000 0.500 1.167 0.604

User level variables, by arm

summary_stats_table_continous(df_wide,
  variables = continous_var,
  group = "arm_coded",
  filename = "continous_stat_results_consent_by_arm.csv",
  caption = "Summary Statistics for Continous Variables, by arm",
  print_html = TRUE
  )
Summary Statistics for Continous Variables, by arm
Variable Group Total_Observations Number_Missing Mean SD Min Max Decile_10 Decile_20 Decile_30 Decile_40 Decile_50 Decile_60 Decile_70 Decile_80 Decile_90 Proportion_Missing
intervention_duration arm_coded : Game 4659 2792 280.196 2809.724 5.767 89895.95 7.067 8.183 10.250 13.167 17.383 22.617 29.817 43.373 128.157 0.599
intervention_duration arm_coded : Long Baseline 10734 3409 194.291 1906.844 3.967 73053.42 12.867 13.933 15.000 16.150 17.533 19.417 22.300 27.667 52.357 0.318
intervention_duration arm_coded : Original Baseline 11261 2406 162.578 1982.613 4.217 84982.72 7.083 7.967 8.750 9.650 10.667 11.900 13.617 16.450 26.450 0.214
intervention_duration arm_coded : SMS 20617 7157 248.611 2586.230 5.683 96762.73 12.300 13.333 14.367 15.433 16.867 18.733 21.700 27.433 60.710 0.347
intervention_duration arm_coded : Video 4955 2563 388.918 3680.091 9.000 100300.63 10.950 11.917 12.833 13.967 15.500 18.107 23.030 39.890 246.773 0.517
total_duration arm_coded : Game 3503 3948 659.389 5263.111 -1352.917 99946.87 14.320 17.573 20.960 24.800 29.967 36.660 48.057 75.083 393.857 1.127
total_duration arm_coded : Long Baseline 9175 4968 425.366 3313.181 12.033 79282.47 18.983 21.000 22.983 25.100 27.617 31.283 36.867 49.687 193.353 0.541
total_duration arm_coded : Original Baseline 9196 4471 478.424 4515.171 -14553.200 104457.32 13.317 15.300 17.050 18.900 21.117 23.900 28.217 37.133 132.875 0.486
total_duration arm_coded : SMS 18075 9699 451.055 3628.131 -8456.667 112736.35 18.733 20.817 22.767 24.950 27.600 31.217 37.163 51.600 218.903 0.537
total_duration arm_coded : Video 4173 3345 673.587 5268.434 -3050.967 109648.25 17.550 19.757 21.683 23.747 26.600 30.820 39.503 81.187 523.657 0.802
misinfo_quiz_duration arm_coded : Game 3503 3948 334.461 4257.760 1.517 99930.75 3.550 4.223 4.793 5.350 5.983 6.750 7.833 9.733 16.050 1.127
misinfo_quiz_duration arm_coded : Long Baseline 9174 4969 167.088 2227.462 1.400 79269.75 3.600 4.250 4.800 5.350 5.967 6.717 7.817 9.633 15.962 0.542
misinfo_quiz_duration arm_coded : Original Baseline 9195 4472 265.110 3575.145 1.333 95281.23 3.867 4.583 5.200 5.833 6.517 7.400 8.600 10.750 18.193 0.486
misinfo_quiz_duration arm_coded : SMS 18072 9702 166.766 2472.520 1.200 112690.18 3.967 4.650 5.255 5.867 6.567 7.450 8.550 10.583 17.067 0.537
misinfo_quiz_duration arm_coded : Video 4173 3345 325.586 4058.775 1.617 109636.23 3.983 4.700 5.350 6.017 6.750 7.583 8.683 10.767 20.433 0.802
mean_share_misinfo arm_coded : Game 3480 3971 0.732 0.315 0.000 1.00 0.333 0.333 0.667 0.667 0.667 1.000 1.000 1.000 1.000 1.141
mean_share_misinfo arm_coded : Long Baseline 9175 4968 0.627 0.371 0.000 1.00 0.000 0.333 0.333 0.667 0.667 1.000 1.000 1.000 1.000 0.541
mean_share_misinfo arm_coded : Original Baseline 9162 4505 0.623 0.367 0.000 1.00 0.000 0.333 0.333 0.667 0.667 0.667 1.000 1.000 1.000 0.492
mean_share_misinfo arm_coded : SMS 18040 9734 0.370 0.351 0.000 1.00 0.000 0.000 0.000 0.333 0.333 0.333 0.667 0.667 1.000 0.540
mean_share_misinfo arm_coded : Video 4139 3379 0.656 0.364 0.000 1.00 0.000 0.333 0.333 0.667 0.667 1.000 1.000 1.000 1.000 0.816
mean_reliable_misinfo arm_coded : Game 3476 3975 2.876 1.257 1.000 5.00 1.333 1.667 2.000 2.333 2.667 3.333 3.667 4.000 5.000 1.144
mean_reliable_misinfo arm_coded : Long Baseline 9175 4968 2.865 1.265 1.000 5.00 1.000 1.667 2.000 2.333 2.667 3.333 3.667 4.000 5.000 0.541
mean_reliable_misinfo arm_coded : Original Baseline 9161 4506 2.815 1.277 1.000 5.00 1.000 1.667 2.000 2.333 2.667 3.000 3.667 4.000 5.000 0.492
mean_reliable_misinfo arm_coded : SMS 18040 9734 2.243 1.119 1.000 5.00 1.000 1.000 1.333 1.667 2.000 2.333 2.667 3.333 3.667 0.540
mean_reliable_misinfo arm_coded : Video 4138 3380 2.795 1.282 1.000 5.00 1.000 1.667 2.000 2.333 2.667 3.000 3.667 4.000 5.000 0.817
mean_manipulative_misinfo arm_coded : Game 3478 3973 2.764 1.258 1.000 5.00 1.000 1.500 2.000 2.333 2.667 3.000 3.667 4.000 4.667 1.142
mean_manipulative_misinfo arm_coded : Long Baseline 9175 4968 3.021 1.282 1.000 5.00 1.000 1.667 2.333 2.667 3.000 3.667 3.667 4.333 5.000 0.541
mean_manipulative_misinfo arm_coded : Original Baseline 9159 4508 2.950 1.294 1.000 5.00 1.000 1.667 2.000 2.333 3.000 3.333 3.667 4.333 5.000 0.492
mean_manipulative_misinfo arm_coded : SMS 18043 9731 3.166 1.287 1.000 5.00 1.333 2.000 2.333 2.667 3.333 3.667 4.000 4.667 5.000 0.539
mean_manipulative_misinfo arm_coded : Video 4139 3379 2.854 1.296 1.000 5.00 1.000 1.500 2.000 2.333 2.667 3.333 3.667 4.000 5.000 0.816
mean_share_nonmisinfo arm_coded : Game 3480 3971 0.797 0.310 0.000 1.00 0.500 0.500 0.500 1.000 1.000 1.000 1.000 1.000 1.000 1.141
mean_share_nonmisinfo arm_coded : Long Baseline 9175 4968 0.769 0.333 0.000 1.00 0.500 0.500 0.500 1.000 1.000 1.000 1.000 1.000 1.000 0.541
mean_share_nonmisinfo arm_coded : Original Baseline 9161 4506 0.759 0.340 0.000 1.00 0.000 0.500 0.500 1.000 1.000 1.000 1.000 1.000 1.000 0.492
mean_share_nonmisinfo arm_coded : SMS 18043 9731 0.642 0.372 0.000 1.00 0.000 0.500 0.500 0.500 0.500 1.000 1.000 1.000 1.000 0.539
mean_share_nonmisinfo arm_coded : Video 4136 3382 0.805 0.314 0.000 1.00 0.500 0.500 0.500 1.000 1.000 1.000 1.000 1.000 1.000 0.818
mean_reliable_nonmisinfo arm_coded : Game 3471 3980 3.075 1.333 1.000 5.00 1.500 1.500 2.000 2.500 3.000 3.500 4.000 4.500 5.000 1.147
mean_reliable_nonmisinfo arm_coded : Long Baseline 9174 4969 3.283 1.320 1.000 5.00 1.500 2.000 2.500 3.000 3.000 3.500 4.500 5.000 5.000 0.542
mean_reliable_nonmisinfo arm_coded : Original Baseline 9156 4511 3.212 1.357 1.000 5.00 1.500 2.000 2.500 3.000 3.000 3.500 4.000 5.000 5.000 0.493
mean_reliable_nonmisinfo arm_coded : SMS 18037 9737 2.930 1.305 1.000 5.00 1.000 1.500 2.000 2.500 3.000 3.000 3.500 4.500 5.000 0.540
mean_reliable_nonmisinfo arm_coded : Video 4138 3380 3.216 1.366 1.000 5.00 1.500 2.000 2.000 3.000 3.000 3.500 4.500 5.000 5.000 0.817
mean_manipulative_nonmisinfo arm_coded : Game 3475 3976 2.487 1.319 1.000 5.00 1.000 1.000 1.500 2.000 2.000 3.000 3.000 3.500 4.500 1.144
mean_manipulative_nonmisinfo arm_coded : Long Baseline 9174 4969 2.619 1.358 1.000 5.00 1.000 1.000 1.500 2.000 2.500 3.000 3.000 4.000 5.000 0.542
mean_manipulative_nonmisinfo arm_coded : Original Baseline 9158 4509 2.570 1.362 1.000 5.00 1.000 1.000 1.500 2.000 2.500 3.000 3.000 4.000 5.000 0.492
mean_manipulative_nonmisinfo arm_coded : SMS 18040 9734 2.529 1.306 1.000 5.00 1.000 1.000 1.500 2.000 2.500 3.000 3.000 3.500 5.000 0.540
mean_manipulative_nonmisinfo arm_coded : Video 4137 3381 2.445 1.339 1.000 5.00 1.000 1.000 1.500 1.500 2.000 3.000 3.000 3.500 5.000 0.817
sharing_discernment arm_coded : Game 3480 3971 0.065 0.367 -1.000 1.00 -0.500 -0.167 0.000 0.000 0.000 0.000 0.333 0.333 0.667 1.141
sharing_discernment arm_coded : Long Baseline 9175 4968 0.143 0.382 -1.000 1.00 -0.333 0.000 0.000 0.000 0.000 0.167 0.333 0.500 0.667 0.541
sharing_discernment arm_coded : Original Baseline 9161 4506 0.137 0.386 -1.000 1.00 -0.333 0.000 0.000 0.000 0.000 0.167 0.333 0.500 0.667 0.492
sharing_discernment arm_coded : SMS 18040 9734 0.272 0.423 -1.000 1.00 -0.167 0.000 0.000 0.167 0.333 0.333 0.500 0.667 1.000 0.540
sharing_discernment arm_coded : Video 4136 3382 0.149 0.372 -1.000 1.00 -0.167 0.000 0.000 0.000 0.000 0.167 0.333 0.500 0.667 0.818
reliability_discernment arm_coded : Game 3470 3981 0.196 1.179 -4.000 4.00 -1.167 -0.667 -0.333 0.000 0.000 0.333 0.667 1.000 1.667 1.147
reliability_discernment arm_coded : Long Baseline 9174 4969 0.418 1.325 -4.000 4.00 -1.167 -0.500 -0.167 0.000 0.167 0.667 1.000 1.500 2.167 0.542
reliability_discernment arm_coded : Original Baseline 9155 4512 0.396 1.302 -4.000 4.00 -1.167 -0.500 -0.167 0.000 0.167 0.500 1.000 1.333 2.167 0.493
reliability_discernment arm_coded : SMS 18035 9739 0.686 1.370 -4.000 4.00 -0.833 -0.333 0.000 0.167 0.500 0.833 1.333 2.000 2.667 0.540
reliability_discernment arm_coded : Video 4137 3381 0.421 1.264 -4.000 4.00 -1.000 -0.500 0.000 0.000 0.167 0.500 1.000 1.333 2.167 0.817
manipulation_discernment arm_coded : Game 3475 3976 -0.278 1.238 -4.000 4.00 -1.833 -1.167 -0.667 -0.500 -0.167 0.000 0.167 0.500 1.167 1.144
manipulation_discernment arm_coded : Long Baseline 9174 4969 -0.402 1.352 -4.000 4.00 -2.167 -1.500 -1.000 -0.667 -0.167 0.000 0.167 0.667 1.333 0.542
manipulation_discernment arm_coded : Original Baseline 9156 4511 -0.381 1.355 -4.000 4.00 -2.167 -1.333 -1.000 -0.500 -0.167 0.000 0.167 0.667 1.333 0.493
manipulation_discernment arm_coded : SMS 18040 9734 -0.637 1.453 -4.000 4.00 -2.667 -2.000 -1.333 -0.833 -0.500 -0.167 0.000 0.500 1.167 0.540
manipulation_discernment arm_coded : Video 4137 3381 -0.409 1.315 -4.000 4.00 -2.167 -1.333 -1.000 -0.500 -0.167 0.000 0.000 0.500 1.167 0.817

User level variables, by phase

summary_stats_table_continous(df_wide,
  variables = continous_var,
  group = "phase_coded",
  filename = "continous_stat_results_consent_by_phase.csv",
  caption = "Summary Statistics for Continous Variables, by phase",
  print_html = TRUE
  )
Summary Statistics for Continous Variables, by phase
Variable Group Total_Observations Number_Missing Mean SD Min Max Decile_10 Decile_20 Decile_30 Decile_40 Decile_50 Decile_60 Decile_70 Decile_80 Decile_90 Proportion_Missing
intervention_duration phase_coded : Phase 1 20852 9064 282.203 2980.788 4.617 100300.63 8.033 10.067 11.650 13.117 14.817 17.167 21.117 29.980 90.075 0.435
intervention_duration phase_coded : Phase 2 31374 9263 203.671 2111.771 3.967 73053.42 11.050 12.617 13.717 14.833 16.167 17.917 20.567 25.483 47.450 0.295
total_duration phase_coded : Phase 1 16959 12957 573.531 5025.775 -14553.200 112736.35 15.567 18.333 20.817 23.317 26.317 30.667 38.260 59.107 317.520 0.764
total_duration phase_coded : Phase 2 27163 13474 436.231 3381.910 6.850 79282.47 17.583 19.800 21.733 23.833 26.333 29.733 34.967 47.617 180.433 0.496
misinfo_quiz_duration phase_coded : Phase 1 16958 12958 295.460 3977.741 1.517 112690.18 3.983 4.750 5.417 6.083 6.817 7.717 8.917 11.183 19.855 0.764
misinfo_quiz_duration phase_coded : Phase 2 27159 13478 165.846 2249.505 1.200 79269.75 3.733 4.400 4.950 5.500 6.150 6.950 8.067 9.883 15.917 0.496
mean_share_misinfo phase_coded : Phase 1 16835 13081 0.585 0.378 0.000 1.00 0.000 0.333 0.333 0.500 0.667 0.667 1.000 1.000 1.000 0.777
mean_share_misinfo phase_coded : Phase 2 27161 13476 0.498 0.382 0.000 1.00 0.000 0.000 0.333 0.333 0.333 0.667 0.667 1.000 1.000 0.496
mean_reliable_misinfo phase_coded : Phase 1 16827 13089 2.668 1.271 1.000 5.00 1.000 1.333 1.667 2.000 2.333 3.000 3.500 4.000 4.667 0.778
mean_reliable_misinfo phase_coded : Phase 2 27163 13474 2.548 1.228 1.000 5.00 1.000 1.333 1.667 2.000 2.333 2.667 3.333 3.667 4.333 0.496
mean_manipulative_misinfo phase_coded : Phase 1 16831 13085 2.929 1.300 1.000 5.00 1.000 1.667 2.000 2.333 3.000 3.333 3.667 4.333 5.000 0.777
mean_manipulative_misinfo phase_coded : Phase 2 27163 13474 3.092 1.284 1.000 5.00 1.333 1.667 2.333 2.667 3.000 3.667 4.000 4.333 5.000 0.496
mean_share_nonmisinfo phase_coded : Phase 1 16832 13084 0.747 0.343 0.000 1.00 0.000 0.500 0.500 1.000 1.000 1.000 1.000 1.000 1.000 0.777
mean_share_nonmisinfo phase_coded : Phase 2 27163 13474 0.704 0.359 0.000 1.00 0.000 0.500 0.500 0.500 1.000 1.000 1.000 1.000 1.000 0.496
mean_reliable_nonmisinfo phase_coded : Phase 1 16814 13102 3.111 1.353 1.000 5.00 1.000 1.500 2.000 3.000 3.000 3.500 4.000 5.000 5.000 0.779
mean_reliable_nonmisinfo phase_coded : Phase 2 27162 13475 3.094 1.325 1.000 5.00 1.000 1.500 2.000 3.000 3.000 3.500 4.000 4.500 5.000 0.496
mean_manipulative_nonmisinfo phase_coded : Phase 1 16822 13094 2.506 1.345 1.000 5.00 1.000 1.000 1.500 2.000 2.000 3.000 3.000 4.000 5.000 0.778
mean_manipulative_nonmisinfo phase_coded : Phase 2 27162 13475 2.569 1.326 1.000 5.00 1.000 1.000 1.500 2.000 2.500 3.000 3.000 4.000 5.000 0.496
sharing_discernment phase_coded : Phase 1 16831 13085 0.162 0.397 -1.000 1.00 -0.333 0.000 0.000 0.000 0.000 0.167 0.333 0.500 0.667 0.777
sharing_discernment phase_coded : Phase 2 27161 13476 0.206 0.408 -1.000 1.00 -0.333 0.000 0.000 0.000 0.167 0.333 0.333 0.500 0.667 0.496
reliability_discernment phase_coded : Phase 1 16809 13107 0.442 1.305 -4.000 4.00 -1.000 -0.500 0.000 0.000 0.333 0.667 1.000 1.500 2.167 0.780
reliability_discernment phase_coded : Phase 2 27162 13475 0.546 1.347 -4.000 4.00 -1.000 -0.500 0.000 0.000 0.333 0.667 1.167 1.667 2.333 0.496
manipulation_discernment phase_coded : Phase 1 16820 13096 -0.423 1.365 -4.000 4.00 -2.333 -1.500 -1.000 -0.500 -0.167 0.000 0.167 0.500 1.167 0.779
manipulation_discernment phase_coded : Phase 2 27162 13475 -0.523 1.403 -4.000 4.00 -2.500 -1.667 -1.167 -0.667 -0.333 0.000 0.000 0.500 1.167 0.496

User level vriables by country

summary_stats_table_continous(df_wide,
  variables = continous_var,
  group = "country_coded",
  filename = "continous_stat_results_consent_by_country.csv",
  caption = "Summary Statistics for Continous Variables, by country",
  print_html = TRUE
  )
Summary Statistics for Continous Variables, by country
Variable Group Total_Observations Number_Missing Mean SD Min Max Decile_10 Decile_20 Decile_30 Decile_40 Decile_50 Decile_60 Decile_70 Decile_80 Decile_90 Proportion_Missing
intervention_duration country_coded : Ghana 6023 2135 146.622 1627.223 4.283 67965.32 9.767 12.107 13.643 15.183 16.817 18.883 22.217 27.943 50.380 0.354
intervention_duration country_coded : Kenya 6884 2445 277.806 3225.780 4.617 93585.18 8.822 11.467 12.717 13.867 15.133 16.867 19.385 24.183 46.602 0.355
intervention_duration country_coded : Nigeria 23433 8018 228.647 2355.850 3.967 96762.73 9.550 11.933 13.333 14.667 16.200 18.233 21.467 27.983 65.363 0.342
intervention_duration country_coded : South Africa 15886 5729 259.414 2602.205 4.517 100300.63 8.792 11.400 12.633 13.700 14.983 16.750 19.683 25.717 68.192 0.361
total_duration country_coded : Ghana 5097 3061 258.360 2181.800 -1969.683 84883.20 18.050 20.800 23.097 25.640 28.450 32.333 38.337 50.460 149.017 0.601
total_duration country_coded : Kenya 5901 3428 639.597 5377.089 -1856.517 109648.25 16.517 19.033 21.133 23.200 25.483 28.817 33.900 45.717 179.000 0.581
total_duration country_coded : Nigeria 19294 12157 511.293 4206.618 -14553.200 112736.35 17.300 19.967 22.200 24.633 27.450 31.400 37.835 55.300 282.882 0.630
total_duration country_coded : South Africa 13830 7785 478.659 3826.882 -3050.967 104457.32 16.067 18.333 20.133 22.033 24.300 27.617 33.338 48.423 218.037 0.563
misinfo_quiz_duration country_coded : Ghana 5097 3061 84.862 1507.974 1.617 84875.15 4.317 5.067 5.717 6.340 7.133 8.010 9.120 11.147 16.890 0.601
misinfo_quiz_duration country_coded : Kenya 5900 3429 368.148 4623.450 1.200 109636.23 3.817 4.583 5.200 5.767 6.417 7.200 8.300 10.067 15.552 0.581
misinfo_quiz_duration country_coded : Nigeria 19292 12159 230.696 3061.376 1.400 112690.18 3.967 4.717 5.367 6.050 6.800 7.750 8.967 11.217 19.480 0.630
misinfo_quiz_duration country_coded : South Africa 13828 7787 177.859 2510.871 1.533 90881.82 3.567 4.150 4.633 5.133 5.667 6.333 7.267 8.850 15.083 0.563
mean_share_misinfo country_coded : Ghana 5089 3069 0.486 0.388 0.000 1.00 0.000 0.000 0.333 0.333 0.333 0.667 0.667 1.000 1.000 0.603
mean_share_misinfo country_coded : Kenya 5877 3452 0.509 0.385 0.000 1.00 0.000 0.000 0.333 0.333 0.667 0.667 0.667 1.000 1.000 0.587
mean_share_misinfo country_coded : Nigeria 19241 12210 0.556 0.386 0.000 1.00 0.000 0.000 0.333 0.333 0.667 0.667 1.000 1.000 1.000 0.635
mean_share_misinfo country_coded : South Africa 13789 7826 0.524 0.373 0.000 1.00 0.000 0.000 0.333 0.333 0.667 0.667 0.667 1.000 1.000 0.568
mean_reliable_misinfo country_coded : Ghana 5088 3070 2.567 1.262 1.000 5.00 1.000 1.333 1.667 2.000 2.333 2.667 3.333 3.667 4.667 0.603
mean_reliable_misinfo country_coded : Kenya 5875 3454 2.429 1.216 1.000 5.00 1.000 1.333 1.667 2.000 2.333 2.333 3.000 3.667 4.333 0.588
mean_reliable_misinfo country_coded : Nigeria 19239 12212 2.621 1.276 1.000 5.00 1.000 1.333 1.667 2.000 2.333 2.667 3.333 3.667 4.667 0.635
mean_reliable_misinfo country_coded : South Africa 13788 7827 2.635 1.203 1.000 5.00 1.000 1.333 1.667 2.333 2.333 3.000 3.333 3.667 4.333 0.568
mean_manipulative_misinfo country_coded : Ghana 5088 3070 3.227 1.269 1.000 5.00 1.333 2.000 2.333 3.000 3.333 3.667 4.000 4.667 5.000 0.603
mean_manipulative_misinfo country_coded : Kenya 5878 3451 3.056 1.320 1.000 5.00 1.333 1.667 2.000 2.333 3.000 3.667 4.000 4.333 5.000 0.587
mean_manipulative_misinfo country_coded : Nigeria 19239 12212 2.890 1.302 1.000 5.00 1.000 1.667 2.000 2.333 2.667 3.333 3.667 4.333 5.000 0.635
mean_manipulative_misinfo country_coded : South Africa 13789 7826 3.140 1.255 1.000 5.00 1.333 2.000 2.333 2.667 3.333 3.667 4.000 4.333 5.000 0.568
mean_share_nonmisinfo country_coded : Ghana 5088 3070 0.714 0.357 0.000 1.00 0.000 0.500 0.500 0.500 1.000 1.000 1.000 1.000 1.000 0.603
mean_share_nonmisinfo country_coded : Kenya 5877 3452 0.710 0.353 0.000 1.00 0.000 0.500 0.500 0.500 1.000 1.000 1.000 1.000 1.000 0.587
mean_share_nonmisinfo country_coded : Nigeria 19241 12210 0.742 0.349 0.000 1.00 0.000 0.500 0.500 1.000 1.000 1.000 1.000 1.000 1.000 0.635
mean_share_nonmisinfo country_coded : South Africa 13789 7826 0.698 0.358 0.000 1.00 0.000 0.500 0.500 0.500 1.000 1.000 1.000 1.000 1.000 0.568
mean_reliable_nonmisinfo country_coded : Ghana 5084 3074 3.243 1.327 1.000 5.00 1.500 2.000 2.500 3.000 3.000 3.500 4.000 5.000 5.000 0.605
mean_reliable_nonmisinfo country_coded : Kenya 5874 3455 2.956 1.353 1.000 5.00 1.000 1.500 2.000 2.500 3.000 3.000 3.500 4.500 5.000 0.588
mean_reliable_nonmisinfo country_coded : Nigeria 19231 12220 3.130 1.363 1.000 5.00 1.000 1.500 2.000 3.000 3.000 3.500 4.000 5.000 5.000 0.635
mean_reliable_nonmisinfo country_coded : South Africa 13787 7828 3.068 1.285 1.000 5.00 1.500 2.000 2.000 3.000 3.000 3.500 4.000 4.500 5.000 0.568
mean_manipulative_nonmisinfo country_coded : Ghana 5084 3074 2.831 1.377 1.000 5.00 1.000 1.500 2.000 2.500 3.000 3.000 3.500 4.500 5.000 0.605
mean_manipulative_nonmisinfo country_coded : Kenya 5877 3452 2.647 1.345 1.000 5.00 1.000 1.000 1.500 2.000 2.500 3.000 3.000 4.000 5.000 0.587
mean_manipulative_nonmisinfo country_coded : Nigeria 19235 12216 2.454 1.338 1.000 5.00 1.000 1.000 1.500 1.500 2.000 3.000 3.000 3.500 5.000 0.635
mean_manipulative_nonmisinfo country_coded : South Africa 13788 7827 2.522 1.290 1.000 5.00 1.000 1.000 1.500 2.000 2.500 3.000 3.000 3.500 4.500 0.568
sharing_discernment country_coded : Ghana 5088 3070 0.228 0.409 -1.000 1.00 -0.167 0.000 0.000 0.000 0.167 0.333 0.500 0.667 0.667 0.603
sharing_discernment country_coded : Kenya 5875 3454 0.201 0.405 -1.000 1.00 -0.167 0.000 0.000 0.000 0.167 0.333 0.333 0.500 0.667 0.588
sharing_discernment country_coded : Nigeria 19240 12211 0.186 0.393 -1.000 1.00 -0.167 0.000 0.000 0.000 0.000 0.333 0.333 0.500 0.667 0.635
sharing_discernment country_coded : South Africa 13789 7826 0.174 0.418 -1.000 1.00 -0.333 -0.167 0.000 0.000 0.167 0.333 0.333 0.500 0.667 0.568
reliability_discernment country_coded : Ghana 5084 3074 0.675 1.350 -4.000 4.00 -0.833 -0.333 0.000 0.167 0.500 0.967 1.333 1.833 2.500 0.605
reliability_discernment country_coded : Kenya 5873 3456 0.527 1.328 -4.000 4.00 -0.967 -0.333 0.000 0.000 0.333 0.667 1.000 1.667 2.333 0.588
reliability_discernment country_coded : Nigeria 19228 12223 0.509 1.310 -4.000 4.00 -1.000 -0.333 0.000 0.000 0.333 0.667 1.000 1.500 2.333 0.636
reliability_discernment country_coded : South Africa 13786 7829 0.432 1.352 -4.000 4.00 -1.333 -0.667 -0.167 0.000 0.333 0.667 1.000 1.500 2.167 0.568
manipulation_discernment country_coded : Ghana 5084 3074 -0.397 1.448 -4.000 4.00 -2.333 -1.500 -1.000 -0.667 -0.167 0.000 0.167 0.667 1.333 0.605
manipulation_discernment country_coded : Kenya 5877 3452 -0.409 1.359 -4.000 4.00 -2.167 -1.500 -1.000 -0.500 -0.167 0.000 0.167 0.500 1.167 0.587
manipulation_discernment country_coded : Nigeria 19233 12218 -0.436 1.369 -4.000 4.00 -2.333 -1.500 -1.000 -0.667 -0.167 0.000 0.000 0.500 1.167 0.635
manipulation_discernment country_coded : South Africa 13788 7827 -0.618 1.398 -4.000 4.00 -2.667 -1.833 -1.333 -0.833 -0.500 -0.167 0.000 0.500 1.000 0.568

User level variables by arm and phase

df_wide = df_wide |> mutate(phase_arm = paste(phase_coded, arm_coded, sep = " - "))

summary_stats_table_continous(df_wide,
  variables = continous_var,
  group = "phase_arm",
  filename = "continous_stat_results_consent_by_phase_arm.csv",
  caption = "Summary Statistics for Continous Variables, by phase and arm",
  print_html = TRUE
  )
Summary Statistics for Continous Variables, by phase and arm
Variable Group Total_Observations Number_Missing Mean SD Min Max Decile_10 Decile_20 Decile_30 Decile_40 Decile_50 Decile_60 Decile_70 Decile_80 Decile_90 Proportion_Missing
intervention_duration phase_arm : Phase 1 - Game 4659 2792 280.196 2809.724 5.767 89895.95 7.067 8.183 10.250 13.167 17.383 22.617 29.817 43.373 128.157 0.599
intervention_duration phase_arm : Phase 1 - Original Baseline 6119 1309 189.356 2307.303 4.617 84982.72 7.150 8.067 8.850 9.733 10.783 12.067 13.893 16.900 27.827 0.214
intervention_duration phase_arm : Phase 1 - SMS 5119 2400 291.718 3085.290 8.150 96762.73 12.300 13.583 14.733 15.917 17.467 19.780 22.950 29.870 81.337 0.469
intervention_duration phase_arm : Phase 1 - Video 4955 2563 388.918 3680.091 9.000 100300.63 10.950 11.917 12.833 13.967 15.500 18.107 23.030 39.890 246.773 0.517
intervention_duration phase_arm : Phase 2 - Long Baseline 10734 3409 194.291 1906.844 3.967 73053.42 12.867 13.933 15.000 16.150 17.533 19.417 22.300 27.667 52.357 0.318
intervention_duration phase_arm : Phase 2 - Original Baseline 5142 1097 130.713 1507.334 4.217 44062.18 7.000 7.867 8.633 9.533 10.550 11.660 13.367 15.983 24.530 0.213
intervention_duration phase_arm : Phase 2 - SMS 15498 4757 234.373 2398.631 5.683 66363.75 12.300 13.283 14.250 15.300 16.667 18.450 21.250 26.550 55.935 0.307
total_duration phase_arm : Phase 1 - Game 3503 3948 659.389 5263.111 -1352.917 99946.87 14.320 17.573 20.960 24.800 29.967 36.660 48.057 75.083 393.857 1.127
total_duration phase_arm : Phase 1 - Original Baseline 4925 2503 538.631 5307.871 -14553.200 104457.32 13.550 15.633 17.383 19.433 21.750 24.883 29.263 40.070 169.457 0.508
total_duration phase_arm : Phase 1 - SMS 4358 3161 448.149 4194.532 -8456.667 112736.35 19.100 21.717 23.850 26.233 29.342 33.453 40.613 58.393 278.470 0.725
total_duration phase_arm : Phase 1 - Video 4173 3345 673.587 5268.434 -3050.967 109648.25 17.550 19.757 21.683 23.747 26.600 30.820 39.503 81.187 523.657 0.802
total_duration phase_arm : Phase 2 - Long Baseline 9175 4968 425.366 3313.181 12.033 79282.47 18.983 21.000 22.983 25.100 27.617 31.283 36.867 49.687 193.353 0.541
total_duration phase_arm : Phase 2 - Original Baseline 4271 1968 408.996 3376.863 6.850 62175.70 13.100 14.967 16.683 18.417 20.433 23.017 26.767 34.283 99.650 0.461
total_duration phase_arm : Phase 2 - SMS 13717 6538 451.978 3428.822 12.217 78325.07 18.643 20.600 22.450 24.573 27.133 30.567 36.050 49.770 202.440 0.477
misinfo_quiz_duration phase_arm : Phase 1 - Game 3503 3948 334.461 4257.760 1.517 99930.75 3.550 4.223 4.793 5.350 5.983 6.750 7.833 9.733 16.050 1.127
misinfo_quiz_duration phase_arm : Phase 1 - Original Baseline 4925 2503 306.279 4114.846 1.550 95281.23 4.123 4.917 5.583 6.233 7.000 7.917 9.233 11.603 20.620 0.508
misinfo_quiz_duration phase_arm : Phase 1 - SMS 4357 3162 223.022 3477.631 1.867 112690.18 4.367 5.200 5.900 6.567 7.350 8.283 9.767 12.130 20.887 0.726
misinfo_quiz_duration phase_arm : Phase 1 - Video 4173 3345 325.586 4058.775 1.617 109636.23 3.983 4.700 5.350 6.017 6.750 7.583 8.683 10.767 20.433 0.802
misinfo_quiz_duration phase_arm : Phase 2 - Long Baseline 9174 4969 167.088 2227.462 1.400 79269.75 3.600 4.250 4.800 5.350 5.967 6.717 7.817 9.633 15.962 0.542
misinfo_quiz_duration phase_arm : Phase 2 - Original Baseline 4270 1969 217.624 2827.254 1.333 62138.13 3.633 4.300 4.850 5.383 6.033 6.733 7.817 9.700 15.453 0.461
misinfo_quiz_duration phase_arm : Phase 2 - SMS 13715 6540 148.895 2052.526 1.200 78308.88 3.873 4.533 5.100 5.667 6.333 7.150 8.250 10.117 16.043 0.477
mean_share_misinfo phase_arm : Phase 1 - Game 3480 3971 0.732 0.315 0.000 1.00 0.333 0.333 0.667 0.667 0.667 1.000 1.000 1.000 1.000 1.141
mean_share_misinfo phase_arm : Phase 1 - Original Baseline 4891 2537 0.622 0.366 0.000 1.00 0.000 0.333 0.333 0.667 0.667 0.667 1.000 1.000 1.000 0.519
mean_share_misinfo phase_arm : Phase 1 - SMS 4325 3194 0.358 0.348 0.000 1.00 0.000 0.000 0.000 0.333 0.333 0.333 0.667 0.667 1.000 0.738
mean_share_misinfo phase_arm : Phase 1 - Video 4139 3379 0.656 0.364 0.000 1.00 0.000 0.333 0.333 0.667 0.667 1.000 1.000 1.000 1.000 0.816
mean_share_misinfo phase_arm : Phase 2 - Long Baseline 9175 4968 0.627 0.371 0.000 1.00 0.000 0.333 0.333 0.667 0.667 1.000 1.000 1.000 1.000 0.541
mean_share_misinfo phase_arm : Phase 2 - Original Baseline 4271 1968 0.624 0.367 0.000 1.00 0.000 0.333 0.333 0.667 0.667 0.667 1.000 1.000 1.000 0.461
mean_share_misinfo phase_arm : Phase 2 - SMS 13715 6540 0.374 0.352 0.000 1.00 0.000 0.000 0.000 0.333 0.333 0.333 0.667 0.667 1.000 0.477
mean_reliable_misinfo phase_arm : Phase 1 - Game 3476 3975 2.876 1.257 1.000 5.00 1.333 1.667 2.000 2.333 2.667 3.333 3.667 4.000 5.000 1.144
mean_reliable_misinfo phase_arm : Phase 1 - Original Baseline 4890 2538 2.829 1.290 1.000 5.00 1.000 1.667 2.000 2.333 2.667 3.000 3.667 4.000 5.000 0.519
mean_reliable_misinfo phase_arm : Phase 1 - SMS 4323 3196 2.197 1.122 1.000 5.00 1.000 1.000 1.333 1.667 2.000 2.333 2.667 3.333 3.667 0.739
mean_reliable_misinfo phase_arm : Phase 1 - Video 4138 3380 2.795 1.282 1.000 5.00 1.000 1.667 2.000 2.333 2.667 3.000 3.667 4.000 5.000 0.817
mean_reliable_misinfo phase_arm : Phase 2 - Long Baseline 9175 4968 2.865 1.265 1.000 5.00 1.000 1.667 2.000 2.333 2.667 3.333 3.667 4.000 5.000 0.541
mean_reliable_misinfo phase_arm : Phase 2 - Original Baseline 4271 1968 2.798 1.261 1.000 5.00 1.000 1.667 2.000 2.333 2.667 3.000 3.667 4.000 5.000 0.461
mean_reliable_misinfo phase_arm : Phase 2 - SMS 13717 6538 2.258 1.117 1.000 5.00 1.000 1.000 1.333 1.667 2.000 2.333 2.667 3.333 3.667 0.477
mean_manipulative_misinfo phase_arm : Phase 1 - Game 3478 3973 2.764 1.258 1.000 5.00 1.000 1.500 2.000 2.333 2.667 3.000 3.667 4.000 4.667 1.142
mean_manipulative_misinfo phase_arm : Phase 1 - Original Baseline 4888 2540 2.930 1.294 1.000 5.00 1.000 1.667 2.000 2.333 3.000 3.333 3.667 4.333 5.000 0.520
mean_manipulative_misinfo phase_arm : Phase 1 - SMS 4326 3193 3.132 1.317 1.000 5.00 1.333 1.667 2.333 2.667 3.333 3.667 4.000 4.667 5.000 0.738
mean_manipulative_misinfo phase_arm : Phase 1 - Video 4139 3379 2.854 1.296 1.000 5.00 1.000 1.500 2.000 2.333 2.667 3.333 3.667 4.000 5.000 0.816
mean_manipulative_misinfo phase_arm : Phase 2 - Long Baseline 9175 4968 3.021 1.282 1.000 5.00 1.000 1.667 2.333 2.667 3.000 3.667 3.667 4.333 5.000 0.541
mean_manipulative_misinfo phase_arm : Phase 2 - Original Baseline 4271 1968 2.974 1.293 1.000 5.00 1.000 1.667 2.000 2.333 3.000 3.667 3.667 4.333 5.000 0.461
mean_manipulative_misinfo phase_arm : Phase 2 - SMS 13717 6538 3.176 1.277 1.000 5.00 1.333 2.000 2.333 2.667 3.333 3.667 4.000 4.667 5.000 0.477
mean_share_nonmisinfo phase_arm : Phase 1 - Game 3480 3971 0.797 0.310 0.000 1.00 0.500 0.500 0.500 1.000 1.000 1.000 1.000 1.000 1.000 1.141
mean_share_nonmisinfo phase_arm : Phase 1 - Original Baseline 4890 2538 0.762 0.338 0.000 1.00 0.000 0.500 0.500 1.000 1.000 1.000 1.000 1.000 1.000 0.519
mean_share_nonmisinfo phase_arm : Phase 1 - SMS 4326 3193 0.636 0.375 0.000 1.00 0.000 0.500 0.500 0.500 0.500 1.000 1.000 1.000 1.000 0.738
mean_share_nonmisinfo phase_arm : Phase 1 - Video 4136 3382 0.805 0.314 0.000 1.00 0.500 0.500 0.500 1.000 1.000 1.000 1.000 1.000 1.000 0.818
mean_share_nonmisinfo phase_arm : Phase 2 - Long Baseline 9175 4968 0.769 0.333 0.000 1.00 0.500 0.500 0.500 1.000 1.000 1.000 1.000 1.000 1.000 0.541
mean_share_nonmisinfo phase_arm : Phase 2 - Original Baseline 4271 1968 0.756 0.341 0.000 1.00 0.000 0.500 0.500 1.000 1.000 1.000 1.000 1.000 1.000 0.461
mean_share_nonmisinfo phase_arm : Phase 2 - SMS 13717 6538 0.644 0.371 0.000 1.00 0.000 0.500 0.500 0.500 0.500 1.000 1.000 1.000 1.000 0.477
mean_reliable_nonmisinfo phase_arm : Phase 1 - Game 3471 3980 3.075 1.333 1.000 5.00 1.500 1.500 2.000 2.500 3.000 3.500 4.000 4.500 5.000 1.147
mean_reliable_nonmisinfo phase_arm : Phase 1 - Original Baseline 4885 2543 3.231 1.355 1.000 5.00 1.500 2.000 2.500 3.000 3.000 3.500 4.000 5.000 5.000 0.521
mean_reliable_nonmisinfo phase_arm : Phase 1 - SMS 4320 3199 2.903 1.329 1.000 5.00 1.000 1.500 2.000 2.500 3.000 3.000 3.500 4.500 5.000 0.741
mean_reliable_nonmisinfo phase_arm : Phase 1 - Video 4138 3380 3.216 1.366 1.000 5.00 1.500 2.000 2.000 3.000 3.000 3.500 4.500 5.000 5.000 0.817
mean_reliable_nonmisinfo phase_arm : Phase 2 - Long Baseline 9174 4969 3.283 1.320 1.000 5.00 1.500 2.000 2.500 3.000 3.000 3.500 4.500 5.000 5.000 0.542
mean_reliable_nonmisinfo phase_arm : Phase 2 - Original Baseline 4271 1968 3.190 1.359 1.000 5.00 1.000 2.000 2.000 3.000 3.000 3.500 4.000 5.000 5.000 0.461
mean_reliable_nonmisinfo phase_arm : Phase 2 - SMS 13717 6538 2.938 1.298 1.000 5.00 1.000 1.500 2.000 2.500 3.000 3.000 3.500 4.500 5.000 0.477
mean_manipulative_nonmisinfo phase_arm : Phase 1 - Game 3475 3976 2.487 1.319 1.000 5.00 1.000 1.000 1.500 2.000 2.000 3.000 3.000 3.500 4.500 1.144
mean_manipulative_nonmisinfo phase_arm : Phase 1 - Original Baseline 4887 2541 2.582 1.380 1.000 5.00 1.000 1.000 1.500 2.000 2.500 3.000 3.000 4.000 5.000 0.520
mean_manipulative_nonmisinfo phase_arm : Phase 1 - SMS 4323 3196 2.497 1.328 1.000 5.00 1.000 1.000 1.500 2.000 2.000 3.000 3.000 3.500 5.000 0.739
mean_manipulative_nonmisinfo phase_arm : Phase 1 - Video 4137 3381 2.445 1.339 1.000 5.00 1.000 1.000 1.500 1.500 2.000 3.000 3.000 3.500 5.000 0.817
mean_manipulative_nonmisinfo phase_arm : Phase 2 - Long Baseline 9174 4969 2.619 1.358 1.000 5.00 1.000 1.000 1.500 2.000 2.500 3.000 3.000 4.000 5.000 0.542
mean_manipulative_nonmisinfo phase_arm : Phase 2 - Original Baseline 4271 1968 2.557 1.342 1.000 5.00 1.000 1.000 1.500 2.000 2.500 3.000 3.000 4.000 5.000 0.461
mean_manipulative_nonmisinfo phase_arm : Phase 2 - SMS 13717 6538 2.539 1.299 1.000 5.00 1.000 1.000 1.500 2.000 2.500 3.000 3.000 3.500 4.500 0.477
sharing_discernment phase_arm : Phase 1 - Game 3480 3971 0.065 0.367 -1.000 1.00 -0.500 -0.167 0.000 0.000 0.000 0.000 0.333 0.333 0.667 1.141
sharing_discernment phase_arm : Phase 1 - Original Baseline 4890 2538 0.140 0.392 -1.000 1.00 -0.333 0.000 0.000 0.000 0.000 0.167 0.333 0.500 0.667 0.519
sharing_discernment phase_arm : Phase 1 - SMS 4325 3194 0.278 0.423 -1.000 1.00 -0.167 0.000 0.000 0.167 0.333 0.333 0.500 0.667 1.000 0.738
sharing_discernment phase_arm : Phase 1 - Video 4136 3382 0.149 0.372 -1.000 1.00 -0.167 0.000 0.000 0.000 0.000 0.167 0.333 0.500 0.667 0.818
sharing_discernment phase_arm : Phase 2 - Long Baseline 9175 4968 0.143 0.382 -1.000 1.00 -0.333 0.000 0.000 0.000 0.000 0.167 0.333 0.500 0.667 0.541
sharing_discernment phase_arm : Phase 2 - Original Baseline 4271 1968 0.133 0.380 -1.000 1.00 -0.333 0.000 0.000 0.000 0.000 0.167 0.333 0.500 0.667 0.461
sharing_discernment phase_arm : Phase 2 - SMS 13715 6540 0.270 0.423 -1.000 1.00 -0.167 0.000 0.000 0.167 0.333 0.333 0.500 0.667 1.000 0.477
reliability_discernment phase_arm : Phase 1 - Game 3470 3981 0.196 1.179 -4.000 4.00 -1.167 -0.667 -0.333 0.000 0.000 0.333 0.667 1.000 1.667 1.147
reliability_discernment phase_arm : Phase 1 - Original Baseline 4884 2544 0.400 1.310 -4.000 4.00 -1.167 -0.500 -0.167 0.000 0.167 0.500 1.000 1.333 2.167 0.521
reliability_discernment phase_arm : Phase 1 - SMS 4318 3201 0.707 1.385 -4.000 4.00 -0.833 -0.333 0.000 0.167 0.500 1.000 1.333 2.000 2.667 0.741
reliability_discernment phase_arm : Phase 1 - Video 4137 3381 0.421 1.264 -4.000 4.00 -1.000 -0.500 0.000 0.000 0.167 0.500 1.000 1.333 2.167 0.817
reliability_discernment phase_arm : Phase 2 - Long Baseline 9174 4969 0.418 1.325 -4.000 4.00 -1.167 -0.500 -0.167 0.000 0.167 0.667 1.000 1.500 2.167 0.542
reliability_discernment phase_arm : Phase 2 - Original Baseline 4271 1968 0.391 1.293 -4.000 4.00 -1.167 -0.500 -0.167 0.000 0.167 0.500 1.000 1.333 2.167 0.461
reliability_discernment phase_arm : Phase 2 - SMS 13717 6538 0.680 1.365 -4.000 4.00 -0.833 -0.333 0.000 0.167 0.500 0.833 1.333 2.000 2.500 0.477
manipulation_discernment phase_arm : Phase 1 - Game 3475 3976 -0.278 1.238 -4.000 4.00 -1.833 -1.167 -0.667 -0.500 -0.167 0.000 0.167 0.500 1.167 1.144
manipulation_discernment phase_arm : Phase 1 - Original Baseline 4885 2543 -0.349 1.370 -4.000 4.00 -2.167 -1.333 -0.833 -0.500 -0.167 0.000 0.167 0.667 1.333 0.521
manipulation_discernment phase_arm : Phase 1 - SMS 4323 3196 -0.636 1.474 -4.000 4.00 -2.667 -2.000 -1.333 -0.833 -0.500 0.000 0.000 0.500 1.000 0.739
manipulation_discernment phase_arm : Phase 1 - Video 4137 3381 -0.409 1.315 -4.000 4.00 -2.167 -1.333 -1.000 -0.500 -0.167 0.000 0.000 0.500 1.167 0.817
manipulation_discernment phase_arm : Phase 2 - Long Baseline 9174 4969 -0.402 1.352 -4.000 4.00 -2.167 -1.500 -1.000 -0.667 -0.167 0.000 0.167 0.667 1.333 0.542
manipulation_discernment phase_arm : Phase 2 - Original Baseline 4271 1968 -0.417 1.336 -4.000 4.00 -2.333 -1.500 -1.000 -0.500 -0.167 0.000 0.167 0.500 1.167 0.461
manipulation_discernment phase_arm : Phase 2 - SMS 13717 6538 -0.637 1.447 -4.000 4.00 -2.667 -2.000 -1.333 -0.833 -0.500 -0.167 0.000 0.500 1.167 0.477

Post-level variables

summary_stats_table_continous(
  df_long, 
  variables = c("share_score", "reliable_score", "manipulative_score"),
  filename = "continous_stat_results_consent_post.csv",
  caption = "Summary Statistics for Continous Variables",
  print_html = TRUE
  )
Summary Statistics for Continous Variables
Variable Total_Observations Number_Missing Mean SD Min Max Decile_10 Decile_20 Decile_30 Decile_40 Decile_50 Decile_60 Decile_70 Decile_80 Decile_90 Proportion_Missing
share_score 219604 516 0.607 0.488 0 1 0 0 0 1 1 1 1 1 1 0.002
reliable_score 219478 642 2.797 1.644 1 5 1 1 1 2 2 3 4 5 5 0.003
manipulative_score 219537 583 2.836 1.665 1 5 1 1 1 2 2 3 4 5 5 0.003

Post-level variables, by arm

summary_stats_table_continous(
  df_long, 
  variables = c("share_score", "reliable_score", "manipulative_score"),
  group = "arm_coded",
  filename = "continous_stat_results_consent_post_by_arm.csv",
  caption = "Summary Statistics for Continous Variables, by arm",
  print_html = TRUE
  )
Summary Statistics for Continous Variables, by arm
Variable Group Total_Observations Number_Missing Mean SD Min Max Decile_10 Decile_20 Decile_30 Decile_40 Decile_50 Decile_60 Decile_70 Decile_80 Decile_90 Proportion_Missing
share_score arm_coded : Game 17327 103 0.758 0.429 0 1 0 0 1 1 1 1 1 1 1 0.006
share_score arm_coded : Long Baseline 45872 8 0.684 0.465 0 1 0 0 0 1 1 1 1 1 1 0.000
share_score arm_coded : Original Baseline 45712 133 0.677 0.468 0 1 0 0 0 1 1 1 1 1 1 0.003
share_score arm_coded : SMS 90091 144 0.478 0.500 0 1 0 0 0 0 0 1 1 1 1 0.002
share_score arm_coded : Video 20602 128 0.715 0.451 0 1 0 0 1 1 1 1 1 1 1 0.006
reliable_score arm_coded : Game 17285 145 2.959 1.608 1 5 1 1 2 2 3 4 5 5 5 0.008
reliable_score arm_coded : Long Baseline 45873 7 3.032 1.650 1 5 1 1 2 2 3 4 5 5 5 0.000
reliable_score arm_coded : Original Baseline 45679 166 2.974 1.659 1 5 1 1 2 2 3 4 5 5 5 0.004
reliable_score arm_coded : SMS 90048 187 2.518 1.602 1 5 1 1 1 1 2 2 4 5 5 0.002
reliable_score arm_coded : Video 20593 137 2.964 1.634 1 5 1 1 2 2 3 4 5 5 5 0.007
manipulative_score arm_coded : Game 17295 135 2.654 1.603 1 5 1 1 1 2 2 3 4 5 5 0.008
manipulative_score arm_coded : Long Baseline 45870 10 2.861 1.670 1 5 1 1 1 2 3 3 4 5 5 0.000
manipulative_score arm_coded : Original Baseline 45673 172 2.798 1.669 1 5 1 1 1 2 2 3 4 5 5 0.004
manipulative_score arm_coded : SMS 90085 150 2.911 1.672 1 5 1 1 1 2 3 4 5 5 5 0.002
manipulative_score arm_coded : Video 20614 116 2.691 1.647 1 5 1 1 1 2 2 3 4 5 5 0.006

OLD CODE

# # Define the function to create summary statistics for unordered categorical variable

# summarize_categorical_combined <- function(data, variables) {
#   library(dplyr)
  
#   # Initialize an empty dataframe to store combined results
#   combined_summary <- data.frame(Variable = character(),
#                                  Category = character(),
#                                  Frequency = integer(),
#                                  Probability = numeric(),
#                                  TotalObservations = integer(),
#                                  stringsAsFactors = FALSE) # Avoid factor conversion
  
#   for (variable in variables) {
#     total_obs <- nrow(data)
    
#     # Calculate frequencies and probabilities, excluding NA values
#     frequencies <- table(data[[variable]], exclude = NULL)
#     probabilities <- prop.table(frequencies)
    
#     # Replace empty string with "Missing" in the names of the probabilities
#     category_names <- names(probabilities)
#     category_names[category_names == ""] <- "Missing"
    
#     # Create summary dataframe for the current variable
#     summary_df <- data.frame(
#                             Variable = variable,
#                             Category = category_names,
#                              Frequency = as.numeric(frequencies),
#                              Probability = as.numeric(probabilities),
#                              TotalObservations = total_obs)
    
#     # Combine with the overall summary
#     combined_summary <- rbind(combined_summary, summary_df)
#   }
  
#   return(combined_summary)
# }

# # Define the function to create summary statistics for ordered categorical variable

# summarize_ordinal <- function(data, variable) {
  
#   # Ensure the variable is treated as an ordered factor
#   data[[variable]] <- factor(data[[variable]], ordered = TRUE)
  
#   # Calculate total observations and number of missing values
#   total_obs <- nrow(data)
#   num_missing <- sum(is.na(data[[variable]]))
#   proportion_missing <- num_missing / total_obs
  
#   # Calculate frequencies and probabilities, excluding NA values
#   frequencies <- table(data[[variable]], exclude = NA)
#   probabilities <- prop.table(frequencies)
  
#   # Calculate mean rank (not mean value) excluding NA values
#   mean_rank <- mean(as.numeric(data[[variable]]), na.rm = TRUE)
  
#   # Create summary dataframe for the variable
#   summary_df <- data.frame(
#     Category = names(probabilities),
#     Frequency = as.numeric(frequencies),
#     Probability = as.numeric(probabilities),
#     MeanRank = mean_rank,
#     TotalObservations = total_obs - num_missing, # Exclude missing from total
#     Missing = num_missing,
#     ProportionMissing = proportion_missing,
#     stringsAsFactors = FALSE
#   )
  
#   # Add variable name to the dataframe
#   summary_df$Variable <- variable
  
#   return(summary_df)
# }


# summarize_ordinal_group <- function(data, variable, group_var = NULL) {
#   # If a grouping variable is provided, group by it; otherwise, process the entire data
#   if (!is.null(group_var) && group_var %in% names(data)) {
#     data_grouped <- data %>% group_by(!!sym(group_var))
#   } else {
#     data_grouped <- data
#   }
  
#   # Ensure the variable is treated as an ordered factor
#   data_grouped[[variable]] <- factor(data_grouped[[variable]], ordered = TRUE)
  
#   # Calculate statistics within each group or for the entire data
#   summary_df <- data_grouped %>% 
#     summarise(
#       TotalObservations = n(),
#       Missing = sum(is.na(.data[[variable]])),
#       ProportionMissing = Missing / TotalObservations,
#       MeanRank = mean(as.numeric(.data[[variable]]), na.rm = TRUE)
#     ) %>% 
#     mutate(Frequency = TotalObservations - Missing) %>%
#     complete(!!sym(variable), fill = list(Frequency = 0)) %>% # Ensure all levels are included
#     group_by(!!sym(variable)) %>% 
#     summarise(
#       Frequency = sum(Frequency),
#       Probability = Frequency / sum(Frequency),
#       MeanRank = first(MeanRank),
#       .groups = "drop" # Drop grouping
#     ) %>%
#     mutate(
#       Variable = variable,
#       Category = as.character(!!sym(variable)),
#       TotalObservations = first(TotalObservations),
#       Missing = first(Missing),
#       ProportionMissing = first(ProportionMissing)
#     )

#   # If a grouping variable was provided, add it to the dataframe
#   if (!is.null(group_var) && group_var %in% names(data)) {
#     summary_df[[group_var]] <- data[[group_var]][1]
#   }

#   # Arrange the dataframe to have the group_var column first if it exists
#   if (!is.null(group_var) && group_var %in% names(summary_df)) {
#     summary_df <- summary_df %>% 
#       select(!!sym(group_var), everything())
#   }
  
#   return(summary_df)
# }

Summary statistics for unordered categorical variables

User-post level variables

# unordered_cat_variables <- c("country_coded", "payment_amount_coded", "arm_coded", "phase_coded", "stage_reached_char", "manipulative_reliable_order", "attention_check_passed")
# results <- summarize_categorical_combined(df_wide_a, unordered_cat_variables)

# write.csv(results, "unordered_categorical_stat_results_consent.csv")

# results %>%
#   kable(digits = 3,caption = "Summary Statistics for Unordered Categorical Variables") %>%
#   kable_styling(bootstrap_options = c("striped", "hover")) %>%
#   collapse_rows(columns = 1, valign = "top") %>%
#  scroll_box( height = "500px")

Post level variables

# unordered_cat_variables_2 <- c("post_number", "post_type", "post_id", "arm_coded", "phase_coded")
# results <- summarize_categorical_combined(df_long_a, unordered_cat_variables_2)

# write.csv(results, "unordered_categorical_stat_results_consent_post.csv")

# results %>%
#   kable(digits = 3,caption = "Summary Statistics for Unordered Categorical Variables") %>%
#   kable_styling(bootstrap_options = c("striped", "hover")) %>%
#   collapse_rows(columns = 1, valign = "top") %>%
#   scroll_box( height = "500px")

Summary statistics for ordered categorical variables

User-post level variables

# ordered_cat_variables <- c("user_payment_condition", "quiz_consent", "manipulative_reliable_order", "attention_check_passed")

Post-level variables

# ordered_cat_variables_2 <- c("quiz_completed_coded_num")

# results <- summarize_ordinal(df_long_a, ordered_cat_variables_2)

# write.csv(results, "ordered_categorical_stat_results_consent_post.csv")

# results %>%
#   kable(digits = 3,caption = "Summary Statistics for Ordered Categorical Variables") %>%
#   kable_styling(bootstrap_options = c("striped", "hover")) %>%
#   collapse_rows(columns = 1, valign = "top") %>%
#   scroll_box( height = "500px")

Data Dictionary

Identifiers

# iden_table <- data.frame(variable=c("phase_coded",
#                                     "repeater",
#                                     "country_coded",
#                                     "arm_coded", 
#                                     "consent_coded",
#                                     "user_payment_condition",
#                                     "quiz_consent", 
#                                     "manipulative_reliable_order", 
#                                     "attention_check_passed",
#                                     "phone_number",
#                                     "payment_attempted",
#                                     "completed"),
#                          description=c("Phase 1 or Phase 2",
#                                        "Attempted TRUE if repeater, otherwise NA", 
#                                        "Kenya, Nigeria, South Africa, or Ghana",
#                                        "For Phase 1: Baseline 1, SMS, Video or Game; Phase 2: Short Baseline 2, Long Baseline or SMS",
#                                        "'I consent, start now' or 'No, let's stop here'", 
#                                        "High, Medium, Low Payment",  
#                                        "I acknowledge",
#                                        "Manipulative order 1 (1) or Manipulative order 2 (2)", 
#                                        "TRUE if passed attention check and FALSE if failed",
#                                        "Phone number", 
#                                        "TRUE if attempted", 
#                                        "TRUE if completed the entire chatbot"))
                                       
# iden_table %>%
#   kable("html", col.names = c("Variable", "Description")) %>%
#   kable_styling(bootstrap_options = c("striped", "hover")) %>%
#   scroll_box(width = "100%", height = "300px")