Effect size computation — pinillossimpsonndexperimentalevidencesupporting

paper_key <- "pinillossimpsonndexperimentalevidencesupporting"
options(digits = 15)

# Helpers (adapted from docs/quarto_effect_template.qmd)
stop_if_missing <- function(x, name) {
  if (is.na(x)) stop(sprintf("Missing required input: %s", name), call. = FALSE)
}

hedges_correction <- function(df) {
  ifelse(df <= 1, NA_real_, exp(lgamma(df/2) - log(sqrt(df/2)) - lgamma((df - 1)/2)))
}

pooled_sd <- function(n_high, n_low, sd_high, sd_low) {
  sqrt(((n_high - 1) * sd_high^2 + (n_low - 1) * sd_low^2) / (n_high + n_low - 2))
}

d_from_groups_independent <- function(n_high, n_low, mean_high, mean_low, sd_high, sd_low) {
  s <- pooled_sd(n_high, n_low, sd_high, sd_low)
  (mean_low - mean_high) / s
}

var_d_independent <- function(d, n_high, n_low) {
  n <- n_high + n_low
  (n / (n_high * n_low)) + (d^2 / (2 * (n - 2)))
}

compute_between_groups <- function(
    study_id,
    effect_id,
    n_high,
    n_low,
    mean_high,
    mean_low,
    sd_high,
    sd_low,
    sign_convention = "d = mean(low) - mean(high)",
    notes_on_assumptions = "",
    imputed_flag = FALSE,
    needs_sensitivity = FALSE
) {
  stop_if_missing(n_high, "n_high")
  stop_if_missing(n_low, "n_low")
  stop_if_missing(mean_high, "mean_high")
  stop_if_missing(mean_low, "mean_low")
  stop_if_missing(sd_high, "sd_high")
  stop_if_missing(sd_low, "sd_low")

  d <- d_from_groups_independent(n_high, n_low, mean_high, mean_low, sd_high, sd_low)
  v <- var_d_independent(d, n_high, n_low)

  df_used <- n_high + n_low - 2
  J <- hedges_correction(df_used)
  g <- J * d
  v_g <- (J^2) * v

  data.frame(
    paper_key = paper_key,
    study_id = study_id,
    effect_id = effect_id,
    method_used = "between_groups",
    sign_convention = sign_convention,
    n_high = n_high,
    n_low = n_low,
    mean_high = mean_high,
    mean_low = mean_low,
    sd_high = sd_high,
    sd_low = sd_low,
    d = d,
    v = v,
    hedges_J = J,
    g = g,
    v_g = v_g,
    notes_on_assumptions = notes_on_assumptions,
    imputed_flag = imputed_flag,
    needs_sensitivity = needs_sensitivity,
    stringsAsFactors = FALSE
  )
}

Study 1 (Experiment 1): Water purifier — evidence-seeking (s1_e1)

res_s1_e1 <- compute_between_groups(
  study_id = 1,
  effect_id = "s1_e1",
  n_high = 48,
  n_low = 46,
  mean_high = 1.29,
  mean_low = 0.72,
  sd_high = 1.254,
  sd_low = 0.72,
  notes_on_assumptions = "Independent groups; outcome is number of comparisons/checks. Sign convention: d = mean(low) - mean(high).",
  imputed_flag = FALSE,
  needs_sensitivity = FALSE
)
res_s1_e1
                                        paper_key study_id effect_id
1 pinillossimpsonndexperimentalevidencesupporting        1     s1_e1
     method_used            sign_convention n_high n_low mean_high mean_low
1 between_groups d = mean(low) - mean(high)     48    46      1.29     0.72
  sd_high sd_low                  d                  v          hedges_J
1   1.254   0.72 -0.554440139474935 0.0442431369651865 0.991821891447609
                   g                v_g
1 -0.549905867828506 0.0435224456571602
                                                                                       notes_on_assumptions
1 Independent groups; outcome is number of comparisons/checks. Sign convention: d = mean(low) - mean(high).
  imputed_flag needs_sensitivity
1        FALSE             FALSE

Study 1 (Experiment 2): Airplane — stakes effect within Low Probability (LSLP vs HSLP) (s2_e1)

res_s2_e1 <- compute_between_groups(
  study_id = 2,
  effect_id = "s2_e1",
  n_high = 61,
  n_low = 50,
  mean_high = 1.93,
  mean_low = 1.6,
  sd_high = 0.944,
  sd_low = 0.969,
  notes_on_assumptions = "2×2 between-subjects design (stakes × probability). This effect compares High vs Low stakes at Low probability.",
  imputed_flag = FALSE,
  needs_sensitivity = FALSE
)
res_s2_e1
                                        paper_key study_id effect_id
1 pinillossimpsonndexperimentalevidencesupporting        2     s2_e1
     method_used            sign_convention n_high n_low mean_high mean_low
1 between_groups d = mean(low) - mean(high)     61    50      1.93      1.6
  sd_high sd_low                  d                  v          hedges_J
1   0.944  0.969 -0.345434178152552 0.0369408039598129 0.993100800218927
                   g                v_g
1 -0.343050958746267 0.0364328383303906
                                                                                             notes_on_assumptions
1 2×2 between-subjects design (stakes × probability). This effect compares High vs Low stakes at Low probability.
  imputed_flag needs_sensitivity
1        FALSE             FALSE

Study 1 (Experiment 2): Airplane — stakes effect within High Probability (LSHP vs HSHP) (s2_e2)

res_s2_e2 <- compute_between_groups(
  study_id = 2,
  effect_id = "s2_e2",
  n_high = 61,
  n_low = 58,
  mean_high = 2.15,
  mean_low = 1.76,
  sd_high = 1.152,
  sd_low = 0.823,
  notes_on_assumptions = "2×2 between-subjects design (stakes × probability). This effect compares High vs Low stakes at High probability.",
  imputed_flag = FALSE,
  needs_sensitivity = FALSE
)
res_s2_e2
                                        paper_key study_id effect_id
1 pinillossimpsonndexperimentalevidencesupporting        2     s2_e2
     method_used            sign_convention n_high n_low mean_high mean_low
1 between_groups d = mean(low) - mean(high)     61    58      2.15     1.76
  sd_high sd_low                  d                 v          hedges_J
1   1.152  0.823 -0.387959471896737 0.034278037966776 0.993573719861191
                   g               v_g
1 -0.385466335647824 0.033838893000363
                                                                                              notes_on_assumptions
1 2×2 between-subjects design (stakes × probability). This effect compares High vs Low stakes at High probability.
  imputed_flag needs_sensitivity
1        FALSE             FALSE

Study 2 (Coin): Agreement with knowledge ascription (s3_e1)

res_s3_e1 <- compute_between_groups(
  study_id = 3,
  effect_id = "s3_e1",
  n_high = 78,
  n_low = 87,
  mean_high = 3.06,
  mean_low = 3.68,
  sd_high = 1.76,
  sd_low = 1.80,
  notes_on_assumptions = "Independent groups; Likert 0–6 agreement scale.",
  imputed_flag = FALSE,
  needs_sensitivity = FALSE
)
res_s3_e1
                                        paper_key study_id effect_id
1 pinillossimpsonndexperimentalevidencesupporting        3     s3_e1
     method_used            sign_convention n_high n_low mean_high mean_low
1 between_groups d = mean(low) - mean(high)     78    87      3.06     3.68
  sd_high sd_low                 d                  v          hedges_J
1    1.76    1.8 0.348076772822079 0.0246864142823528 0.995390523532338
                  g                v_g
1 0.346472321128816 0.0244593559099331
                             notes_on_assumptions imputed_flag
1 Independent groups; Likert 0–6 agreement scale.        FALSE
  needs_sensitivity
1             FALSE

Study 2 (Air): Agreement with knowledge ascription (s4_e1)

res_s4_e1 <- compute_between_groups(
  study_id = 4,
  effect_id = "s4_e1",
  n_high = 30,
  n_low = 25,
  mean_high = 2.03,
  mean_low = 2.16,
  sd_high = 1.0,
  sd_low = 1.03,
  notes_on_assumptions = "Independent groups; Likert 0–4 agreement scale.",
  imputed_flag = FALSE,
  needs_sensitivity = FALSE
)
res_s4_e1
                                        paper_key study_id effect_id
1 pinillossimpsonndexperimentalevidencesupporting        4     s4_e1
     method_used            sign_convention n_high n_low mean_high mean_low
1 between_groups d = mean(low) - mean(high)     30    25      2.03     2.16
  sd_high sd_low                 d                  v          hedges_J
1       1   1.03 0.128243714633482 0.0734884885252484 0.985770713419741
                  g                v_g
1 0.126418898065845 0.0714119904031873
                             notes_on_assumptions imputed_flag
1 Independent groups; Likert 0–4 agreement scale.        FALSE
  needs_sensitivity
1             FALSE

Study 2 (Bridge): Agreement with knowledge ascription (s5_e1)

res_s5_e1 <- compute_between_groups(
  study_id = 5,
  effect_id = "s5_e1",
  n_high = 31,
  n_low = 28,
  mean_high = 1.71,
  mean_low = 2.32,
  sd_high = 1.13,
  sd_low = 1.16,
  notes_on_assumptions = "Independent groups; Likert 0–4 agreement scale.",
  imputed_flag = FALSE,
  needs_sensitivity = FALSE
)
res_s5_e1
                                        paper_key study_id effect_id
1 pinillossimpsonndexperimentalevidencesupporting        5     s5_e1
     method_used            sign_convention n_high n_low mean_high mean_low
1 between_groups d = mean(low) - mean(high)     31    28      1.71     2.32
  sd_high sd_low                d                  v          hedges_J
1    1.13   1.16 0.53307299757469 0.0704650416404434 0.986774400008923
                  g                v_g
1 0.526022787342723 0.0686134822303738
                             notes_on_assumptions imputed_flag
1 Independent groups; Likert 0–4 agreement scale.        FALSE
  needs_sensitivity
1             FALSE