Effect size computation: spatansemenescundfeelingcertaintyshiftiness

Computes standardized mean differences (d) and sampling variances (v) for the extraction YAML papers/spatansemenescundfeelingcertaintyshiftiness/spatansemenescundfeelingcertaintyshiftiness.yaml.

Data source

Group descriptive statistics from Table 5 (knowledge ascription means/SDs and Ns):
papers/spatansemenescundfeelingcertaintyshiftiness/out/tables/camelot_stream_p10_t1.csv.

Shared helpers

paper_key <- "spatansemenescundfeelingcertaintyshiftiness"

stop_if_missing <- function(x, name) {
  if (is.na(x)) stop(sprintf("Missing required input: %s", name), call. = FALSE)
}

# Exact small-sample correction factor used by metafor (.cmicalc).
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_effect_size_between_groups <- function(
    paper_key,
    study_id,
    effect_id,
    n_low,
    n_high,
    mean_low,
    mean_high,
    sd_low,
    sd_high,
    sign_convention = "d = mean(low) - mean(high)",
    notes_on_assumptions = ""
) {
  stop_if_missing(n_low, "n_low")
  stop_if_missing(n_high, "n_high")
  stop_if_missing(mean_low, "mean_low")
  stop_if_missing(mean_high, "mean_high")
  stop_if_missing(sd_low, "sd_low")
  stop_if_missing(sd_high, "sd_high")

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

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

  inputs_used <- sprintf(
    "method=between_groups, sign_convention=%s, n_low=%s, n_high=%s, mean_low=%s, mean_high=%s, sd_low=%s, sd_high=%s",
    sign_convention, n_low, n_high, mean_low, mean_high, sd_low, sd_high
  )

  audit <- data.frame(
    paper_key = paper_key,
    study_id = study_id,
    effect_id = effect_id,
    computed_from_suggested = "groups",
    inputs_used = inputs_used,
    d = d,
    v = v,
    g = g,
    v_g = v_g,
    notes_on_assumptions = notes_on_assumptions
  )

  yaml_snippet <- sprintf(
    "effect_size:\\n  metric: SMD\\n  d: %.12f\\n  v: %.12f\\n  computed_from: groups\\n  needs_review: false\\n  notes: \"%s\"\\n",
    d, v, gsub(pattern = "\"", replacement = "'", x = inputs_used)
  )

  list(audit = audit, yaml_snippet = yaml_snippet)
}

Study 1: Error × Stakes × Certainty (between-subjects)

Effect s1_e1: Uncertain, low error (Con 1: U_LE_LS vs Con 3: U_LE_HS)

res_s1_e1 <- compute_effect_size_between_groups(
  paper_key = paper_key,
  study_id = 1,
  effect_id = "s1_e1",
  n_low = 96,
  n_high = 96,
  mean_low = 5.41,
  mean_high = 5.63,
  sd_low = 1.23,
  sd_high = 1.15,
  notes_on_assumptions = "Between-subjects stakes contrast within uncertain participants; low-error vignette (no explicit error possibility)."
)
res_s1_e1$audit
                                    paper_key study_id effect_id
1 spatansemenescundfeelingcertaintyshiftiness        1     s1_e1
  computed_from_suggested
1                  groups
                                                                                                                                       inputs_used
1 method=between_groups, sign_convention=d = mean(low) - mean(high), n_low=96, n_high=96, mean_low=5.41, mean_high=5.63, sd_low=1.23, sd_high=1.15
           d          v          g        v_g
1 -0.1847696 0.02092317 -0.1840391 0.02075806
                                                                                                 notes_on_assumptions
1 Between-subjects stakes contrast within uncertain participants; low-error vignette (no explicit error possibility).
cat(res_s1_e1$yaml_snippet)
effect_size:\n  metric: SMD\n  d: -0.184769596817\n  v: 0.020923174923\n  computed_from: groups\n  needs_review: false\n  notes: "method=between_groups, sign_convention=d = mean(low) - mean(high), n_low=96, n_high=96, mean_low=5.41, mean_high=5.63, sd_low=1.23, sd_high=1.15"\n

Effect s1_e2: Uncertain, high error (Con 4: U_HE_LS vs Con 2: U_HE_HS)

res_s1_e2 <- compute_effect_size_between_groups(
  paper_key = paper_key,
  study_id = 1,
  effect_id = "s1_e2",
  n_low = 105,
  n_high = 96,
  mean_low = 5.20,
  mean_high = 5.04,
  sd_low = 1.39,
  sd_high = 1.38,
  notes_on_assumptions = "Between-subjects stakes contrast within uncertain participants; high-error vignette (explicit map-mistake possibility)."
)
res_s1_e2$audit
                                    paper_key study_id effect_id
1 spatansemenescundfeelingcertaintyshiftiness        1     s1_e2
  computed_from_suggested
1                  groups
                                                                                                                                       inputs_used
1 method=between_groups, sign_convention=d = mean(low) - mean(high), n_low=105, n_high=96, mean_low=5.2, mean_high=5.04, sd_low=1.39, sd_high=1.38
          d        v         g       v_g
1 0.1155039 0.019974 0.1150679 0.0198235
                                                                                                     notes_on_assumptions
1 Between-subjects stakes contrast within uncertain participants; high-error vignette (explicit map-mistake possibility).
cat(res_s1_e2$yaml_snippet)
effect_size:\n  metric: SMD\n  d: 0.115503856238\n  v: 0.019973996645\n  computed_from: groups\n  needs_review: false\n  notes: "method=between_groups, sign_convention=d = mean(low) - mean(high), n_low=105, n_high=96, mean_low=5.2, mean_high=5.04, sd_low=1.39, sd_high=1.38"\n

Effect s1_e3: Certain, low error (Con 5: C_LE_LS vs Con 7: C_LE_HS)

res_s1_e3 <- compute_effect_size_between_groups(
  paper_key = paper_key,
  study_id = 1,
  effect_id = "s1_e3",
  n_low = 123,
  n_high = 126,
  mean_low = 6.93,
  mean_high = 6.92,
  sd_low = 0.33,
  sd_high = 0.27,
  notes_on_assumptions = "Between-subjects stakes contrast within certain participants; low-error vignette (no explicit error possibility)."
)
res_s1_e3$audit
                                    paper_key study_id effect_id
1 spatansemenescundfeelingcertaintyshiftiness        1     s1_e3
  computed_from_suggested
1                  groups
                                                                                                                                         inputs_used
1 method=between_groups, sign_convention=d = mean(low) - mean(high), n_low=123, n_high=126, mean_low=6.93, mean_high=6.92, sd_low=0.33, sd_high=0.27
           d          v          g        v_g
1 0.03320786 0.01606882 0.03310691 0.01597127
                                                                                               notes_on_assumptions
1 Between-subjects stakes contrast within certain participants; low-error vignette (no explicit error possibility).
cat(res_s1_e3$yaml_snippet)
effect_size:\n  metric: SMD\n  d: 0.033207864478\n  v: 0.016068821550\n  computed_from: groups\n  needs_review: false\n  notes: "method=between_groups, sign_convention=d = mean(low) - mean(high), n_low=123, n_high=126, mean_low=6.93, mean_high=6.92, sd_low=0.33, sd_high=0.27"\n

Effect s1_e4: Certain, high error (Con 8: C_HE_LS vs Con 6: C_HE_HS)

res_s1_e4 <- compute_effect_size_between_groups(
  paper_key = paper_key,
  study_id = 1,
  effect_id = "s1_e4",
  n_low = 117,
  n_high = 124,
  mean_low = 6.87,
  mean_high = 6.86,
  sd_low = 0.88,
  sd_high = 0.40,
  notes_on_assumptions = "Between-subjects stakes contrast within certain participants; high-error vignette (explicit map-mistake possibility)."
)
res_s1_e4$audit
                                    paper_key study_id effect_id
1 spatansemenescundfeelingcertaintyshiftiness        1     s1_e4
  computed_from_suggested
1                  groups
                                                                                                                                        inputs_used
1 method=between_groups, sign_convention=d = mean(low) - mean(high), n_low=117, n_high=124, mean_low=6.87, mean_high=6.86, sd_low=0.88, sd_high=0.4
           d          v          g        v_g
1 0.01477309 0.01661198 0.01472667 0.01650776
                                                                                                   notes_on_assumptions
1 Between-subjects stakes contrast within certain participants; high-error vignette (explicit map-mistake possibility).
cat(res_s1_e4$yaml_snippet)
effect_size:\n  metric: SMD\n  d: 0.014773087422\n  v: 0.016611981254\n  computed_from: groups\n  needs_review: false\n  notes: "method=between_groups, sign_convention=d = mean(low) - mean(high), n_low=117, n_high=124, mean_low=6.87, mean_high=6.86, sd_low=0.88, sd_high=0.4"\n

Combined audit table

audits <- do.call(rbind, list(res_s1_e1$audit, res_s1_e2$audit, res_s1_e3$audit, res_s1_e4$audit))
audits
                                    paper_key study_id effect_id
1 spatansemenescundfeelingcertaintyshiftiness        1     s1_e1
2 spatansemenescundfeelingcertaintyshiftiness        1     s1_e2
3 spatansemenescundfeelingcertaintyshiftiness        1     s1_e3
4 spatansemenescundfeelingcertaintyshiftiness        1     s1_e4
  computed_from_suggested
1                  groups
2                  groups
3                  groups
4                  groups
                                                                                                                                         inputs_used
1   method=between_groups, sign_convention=d = mean(low) - mean(high), n_low=96, n_high=96, mean_low=5.41, mean_high=5.63, sd_low=1.23, sd_high=1.15
2   method=between_groups, sign_convention=d = mean(low) - mean(high), n_low=105, n_high=96, mean_low=5.2, mean_high=5.04, sd_low=1.39, sd_high=1.38
3 method=between_groups, sign_convention=d = mean(low) - mean(high), n_low=123, n_high=126, mean_low=6.93, mean_high=6.92, sd_low=0.33, sd_high=0.27
4  method=between_groups, sign_convention=d = mean(low) - mean(high), n_low=117, n_high=124, mean_low=6.87, mean_high=6.86, sd_low=0.88, sd_high=0.4
            d          v           g        v_g
1 -0.18476960 0.02092317 -0.18403912 0.02075806
2  0.11550386 0.01997400  0.11506790 0.01982350
3  0.03320786 0.01606882  0.03310691 0.01597127
4  0.01477309 0.01661198  0.01472667 0.01650776
                                                                                                     notes_on_assumptions
1     Between-subjects stakes contrast within uncertain participants; low-error vignette (no explicit error possibility).
2 Between-subjects stakes contrast within uncertain participants; high-error vignette (explicit map-mistake possibility).
3       Between-subjects stakes contrast within certain participants; low-error vignette (no explicit error possibility).
4   Between-subjects stakes contrast within certain participants; high-error vignette (explicit map-mistake possibility).