Effect size computations: turrindepistemiccontextualismidle

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

This file was rebuilt to follow the current project template:

Inputs and methods

paper_key <- "turrindepistemiccontextualismidle"
sign_convention <- "d = mean(low) - mean(high)"

effects <- list(
  list(
    study_id = 1,
    effect_id = "s1_e1",
    method_used = "between_groups",
    n_low = 102,
    n_high = 99,
    mean_low = 5.02,
    sd_low = 1.48,
    mean_high = 4.36,
    sd_high = 1.81,
    reported_d = 0.41,
    notes_on_assumptions = "Experiment 1 (bank): split Ns recovered from one-sample tests, Low t(101), High t(98)."
  ),
  list(
    study_id = 2,
    effect_id = "s2_e1",
    method_used = "between_groups",
    n_low = 52,
    n_high = 49,
    mean_low = 4.44,
    sd_low = 1.55,
    mean_high = 5.41,
    sd_high = 1.61,
    reported_d = 0.61,
    notes_on_assumptions = "Conceptual replication of Experiment 1 (flight): split Ns recovered from one-sample tests, Low t(51), High t(48)."
  ),
  list(
    study_id = 3,
    effect_id = "s3_e1",
    method_used = "between_groups",
    n_low = 98,
    n_high = 101,
    mean_low = 4.58,
    sd_low = 1.67,
    mean_high = 4.49,
    sd_high = 1.78,
    reported_d = 0.06,
    notes_on_assumptions = "Experiment 2 (bank; deferral): stakes held constant; map low=Yes ('I do know'), high=No ('I don't know'). Split Ns recovered from one-sample tests, Yes t(97), No t(100)."
  ),
  list(
    study_id = 4,
    effect_id = "s4_e1",
    method_used = "between_groups",
    n_low = 50,
    n_high = 51,
    mean_low = 4.54,
    sd_low = 1.73,
    mean_high = 4.61,
    sd_high = 1.98,
    reported_d = 0.04,
    notes_on_assumptions = "Conceptual replication of Experiment 2 (flight; deferral): stakes held constant; map low=Yes ('I do know'), high=No ('I don't know'). Split Ns recovered from one-sample tests, Yes t(49), No t(50)."
  ),
  list(
    study_id = 5,
    effect_id = "s5_e1",
    method_used = "between_groups",
    n_low = 102,
    n_high = 100,
    mean_low = 4.79,
    sd_low = 1.72,
    mean_high = 4.64,
    sd_high = 1.68,
    reported_d = 0.09,
    notes_on_assumptions = "Experiment 3 (bank): split Ns recovered from one-sample tests, Low t(101), High t(99)."
  ),
  list(
    study_id = 6,
    effect_id = "s6_e1",
    method_used = "between_groups",
    n_low = 50,
    n_high = 51,
    mean_low = 4.90,
    sd_low = 1.61,
    mean_high = 4.76,
    sd_high = 1.72,
    reported_d = 0.08,
    notes_on_assumptions = "Conceptual replication of Experiment 3 (flight): split Ns recovered from one-sample tests, Low t(49), High t(50)."
  ),
  list(
    study_id = 7,
    effect_id = "s7_e1",
    method_used = "between_groups",
    n_low = 99 / 2,
    n_high = 99 / 2,
    mean_low = 8.31,
    sd_low = 1.86,
    mean_high = 8.62,
    sd_high = 1.98,
    t_value = -0.81,
    df = 97,
    imputed_flag = TRUE,
    needs_sensitivity = TRUE,
    notes_on_assumptions = "Experiment 4 (bank; evidence strength required): split Ns not reported; equal-N assumption authorized by analyst, n_low=n_high=99/2."
  ),
  list(
    study_id = 8,
    effect_id = "s8_e1",
    method_used = "between_reported_d_t_df",
    reported_d = 0.34,
    t_value = 1.69,
    df = 98,
    mean_low = 8.59,
    mean_high = 9.08,
    notes_on_assumptions = "Conceptual replication of Experiment 4 (flight): reported Cohen's d is unsigned; sign set from means using d = mean(low) - mean(high)."
  )
)

legacy_effect_sizes <- data.frame(
  study_id = c(1, 2, 3, 4, 5, 6, 7, 8),
  effect_id = c("s1_e1", "s2_e1", "s3_e1", "s4_e1", "s5_e1", "s6_e1", "s7_e1", "s8_e1"),
  previous_d = c(
    0.399811605602,
    -0.614166764737,
    0.052122137662,
    -0.037624978833,
    0.088218811866,
    0.084010249876,
    NA_real_,
    -0.34
  ),
  previous_v = c(
    0.020306563127,
    0.041543987117,
    0.020111966953,
    0.039614992829,
    0.019823377966,
    0.039643488198,
    NA_real_,
    0.041064569211
  )
)

Shared helpers

if (!requireNamespace("esc", quietly = TRUE)) {
  stop("Package 'esc' is required for this analysis. Install with install.packages('esc').", call. = FALSE)
}
suppressPackageStartupMessages(library(esc))

default_or <- function(x, default) {
  if (is.null(x)) default else x
}

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)))
}

# Between-subjects: compute v when only reported d + t(df) are available.
var_d_between_from_d_t_df <- function(d, t_value, df) {
  (d / t_value)^2 + (d^2) / (2 * df)
}

infer_sign <- function(mean_low, mean_high, sign_d) {
  if (!is.na(mean_low) && !is.na(mean_high) && mean_low != mean_high) {
    return(sign(mean_low - mean_high))
  }
  stop_if_missing(sign_d, "sign_d (cannot infer sign from means)")
  if (!is.element(sign_d, c(-1, 1))) stop("sign_d must be +1 or -1", call. = FALSE)
  sign_d
}

extract_esc <- function(x) {
  list(
    d = as.numeric(x$es),
    v = as.numeric(x$var)
  )
}

compute_with_esc <- function(fun, ...) {
  d_obj <- fun(..., es.type = "d")
  g_obj <- fun(..., es.type = "g")
  d_out <- extract_esc(d_obj)
  g_out <- extract_esc(g_obj)
  list(d = d_out$d, v = d_out$v, g = g_out$d, v_g = g_out$v)
}

Computation

compute_effect <- function(effect_inputs) {
  study_id <- effect_inputs$study_id
  effect_id <- effect_inputs$effect_id
  method_used <- effect_inputs$method_used

  n_high <- default_or(effect_inputs$n_high, NA_real_)
  n_low <- default_or(effect_inputs$n_low, NA_real_)
  mean_high <- default_or(effect_inputs$mean_high, NA_real_)
  mean_low <- default_or(effect_inputs$mean_low, NA_real_)
  sd_high <- default_or(effect_inputs$sd_high, NA_real_)
  sd_low <- default_or(effect_inputs$sd_low, NA_real_)
  reported_d <- default_or(effect_inputs$reported_d, NA_real_)
  t_value <- default_or(effect_inputs$t_value, NA_real_)
  df <- default_or(effect_inputs$df, NA_real_)
  sign_d <- default_or(effect_inputs$sign_d, NA_real_)
  notes_on_assumptions <- default_or(effect_inputs$notes_on_assumptions, "")
  imputed_flag <- default_or(effect_inputs$imputed_flag, FALSE)
  needs_sensitivity <- default_or(effect_inputs$needs_sensitivity, FALSE)

  d <- NA_real_
  v <- NA_real_
  g <- NA_real_
  v_g <- NA_real_
  computed_from_suggested <- NA_character_

  if (method_used == "between_groups") {
    computed_from_suggested <- "groups"
    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")

    # esc_mean_sd computes grp1 - grp2; use grp1=low and grp2=high to match sign convention.
    res <- compute_with_esc(
      esc::esc_mean_sd,
      grp1m = mean_low,
      grp1sd = sd_low,
      grp1n = n_low,
      grp2m = mean_high,
      grp2sd = sd_high,
      grp2n = n_high
    )
    d <- res$d
    v <- res$v
    g <- res$g
    v_g <- res$v_g
  } else if (method_used == "between_reported_d_t_df") {
    computed_from_suggested <- "reported_d"
    stop_if_missing(reported_d, "reported_d")
    stop_if_missing(t_value, "t_value")
    stop_if_missing(df, "df")

    sign_used <- infer_sign(mean_low, mean_high, sign_d)
    d <- sign_used * abs(reported_d)
    v <- var_d_between_from_d_t_df(d = d, t_value = abs(t_value), df = df)
    J <- hedges_correction(df)
    g <- J * d
    v_g <- (J^2) * v
  } else {
    stop(sprintf("Unknown method_used: %s", method_used), call. = FALSE)
  }

  inputs_used <- paste(
    c(
      sprintf("method=%s", method_used),
      sprintf("sign_convention=%s", sign_convention),
      if (!is.na(n_low)) sprintf("n_low=%s", n_low) else NULL,
      if (!is.na(n_high)) sprintf("n_high=%s", n_high) else NULL,
      if (!is.na(mean_low)) sprintf("mean_low=%s", mean_low) else NULL,
      if (!is.na(mean_high)) sprintf("mean_high=%s", mean_high) else NULL,
      if (!is.na(sd_low)) sprintf("sd_low=%s", sd_low) else NULL,
      if (!is.na(sd_high)) sprintf("sd_high=%s", sd_high) else NULL,
      if (!is.na(df)) sprintf("df=%s", df) else NULL,
      if (!is.na(t_value)) sprintf("t=%s", t_value) else NULL,
      if (!is.na(reported_d)) sprintf("reported_d=%s", reported_d) else NULL,
      if (!is.na(sign_d)) sprintf("sign_d=%s", sign_d) else NULL,
      if (isTRUE(imputed_flag)) "imputed_equal_n=TRUE" else NULL
    ),
    collapse = ", "
  )

  data.frame(
    paper_key = paper_key,
    study_id = study_id,
    effect_id = effect_id,
    design = "Between-Subjects",
    method_used = method_used,
    computed_from_suggested = computed_from_suggested,
    inputs_used = inputs_used,
    d = d,
    v = v,
    g = g,
    v_g = v_g,
    notes_on_assumptions = notes_on_assumptions,
    imputed_flag = imputed_flag,
    needs_sensitivity = needs_sensitivity,
    stringsAsFactors = FALSE
  )
}

audit <- do.call(rbind, lapply(effects, compute_effect))
audit
                          paper_key study_id effect_id           design
1 turrindepistemiccontextualismidle        1     s1_e1 Between-Subjects
2 turrindepistemiccontextualismidle        2     s2_e1 Between-Subjects
3 turrindepistemiccontextualismidle        3     s3_e1 Between-Subjects
4 turrindepistemiccontextualismidle        4     s4_e1 Between-Subjects
5 turrindepistemiccontextualismidle        5     s5_e1 Between-Subjects
6 turrindepistemiccontextualismidle        6     s6_e1 Between-Subjects
7 turrindepistemiccontextualismidle        7     s7_e1 Between-Subjects
8 turrindepistemiccontextualismidle        8     s8_e1 Between-Subjects
              method_used computed_from_suggested
1          between_groups                  groups
2          between_groups                  groups
3          between_groups                  groups
4          between_groups                  groups
5          between_groups                  groups
6          between_groups                  groups
7          between_groups                  groups
8 between_reported_d_t_df              reported_d
                                                                                                                                                                                 inputs_used
1                         method=between_groups, sign_convention=d = mean(low) - mean(high), n_low=102, n_high=99, mean_low=5.02, mean_high=4.36, sd_low=1.48, sd_high=1.81, reported_d=0.41
2                          method=between_groups, sign_convention=d = mean(low) - mean(high), n_low=52, n_high=49, mean_low=4.44, mean_high=5.41, sd_low=1.55, sd_high=1.61, reported_d=0.61
3                         method=between_groups, sign_convention=d = mean(low) - mean(high), n_low=98, n_high=101, mean_low=4.58, mean_high=4.49, sd_low=1.67, sd_high=1.78, reported_d=0.06
4                          method=between_groups, sign_convention=d = mean(low) - mean(high), n_low=50, n_high=51, mean_low=4.54, mean_high=4.61, sd_low=1.73, sd_high=1.98, reported_d=0.04
5                        method=between_groups, sign_convention=d = mean(low) - mean(high), n_low=102, n_high=100, mean_low=4.79, mean_high=4.64, sd_low=1.72, sd_high=1.68, reported_d=0.09
6                           method=between_groups, sign_convention=d = mean(low) - mean(high), n_low=50, n_high=51, mean_low=4.9, mean_high=4.76, sd_low=1.61, sd_high=1.72, reported_d=0.08
7 method=between_groups, sign_convention=d = mean(low) - mean(high), n_low=49.5, n_high=49.5, mean_low=8.31, mean_high=8.62, sd_low=1.86, sd_high=1.98, df=97, t=-0.81, imputed_equal_n=TRUE
8                                                  method=between_reported_d_t_df, sign_convention=d = mean(low) - mean(high), mean_low=8.59, mean_high=9.08, df=98, t=1.69, reported_d=0.34
            d          v           g        v_g
1  0.39981161 0.02030257  0.39830288 0.02030257
2 -0.61416676 0.04150626 -0.60950221 0.04150626
3  0.05212214 0.02011190  0.05192345 0.02011190
4 -0.03762498 0.03961485 -0.03733922 0.03961485
5  0.08821881 0.01982319  0.08788758 0.01982319
6  0.08401025 0.03964278  0.08337220 0.03964278
7 -0.16137955 0.04053557 -0.16012855 0.04053557
8 -0.34000000 0.04106457 -0.33739019 0.04043657
                                                                                                                                                                                  notes_on_assumptions
1                                                                                                               Experiment 1 (bank): split Ns recovered from one-sample tests, Low t(101), High t(98).
2                                                                                    Conceptual replication of Experiment 1 (flight): split Ns recovered from one-sample tests, Low t(51), High t(48).
3                            Experiment 2 (bank; deferral): stakes held constant; map low=Yes ('I do know'), high=No ('I don't know'). Split Ns recovered from one-sample tests, Yes t(97), No t(100).
4 Conceptual replication of Experiment 2 (flight; deferral): stakes held constant; map low=Yes ('I do know'), high=No ('I don't know'). Split Ns recovered from one-sample tests, Yes t(49), No t(50).
5                                                                                                               Experiment 3 (bank): split Ns recovered from one-sample tests, Low t(101), High t(99).
6                                                                                    Conceptual replication of Experiment 3 (flight): split Ns recovered from one-sample tests, Low t(49), High t(50).
7                                                                 Experiment 4 (bank; evidence strength required): split Ns not reported; equal-N assumption authorized by analyst, n_low=n_high=99/2.
8                                                               Conceptual replication of Experiment 4 (flight): reported Cohen's d is unsigned; sign set from means using d = mean(low) - mean(high).
  imputed_flag needs_sensitivity
1        FALSE             FALSE
2        FALSE             FALSE
3        FALSE             FALSE
4        FALSE             FALSE
5        FALSE             FALSE
6        FALSE             FALSE
7         TRUE              TRUE
8        FALSE             FALSE

Comparison With Previous Stored Values

comparison <- merge(
  audit[, c("study_id", "effect_id", "d", "v", "method_used", "imputed_flag")],
  legacy_effect_sizes,
  by = c("study_id", "effect_id"),
  all.x = TRUE
)
comparison$delta_d <- comparison$d - comparison$previous_d
comparison$delta_v <- comparison$v - comparison$previous_v
comparison$abs_delta_d <- abs(comparison$delta_d)
comparison$abs_delta_v <- abs(comparison$delta_v)
comparison <- comparison[order(comparison$study_id), ]
comparison
  study_id effect_id           d          v             method_used
1        1     s1_e1  0.39981161 0.02030257          between_groups
2        2     s2_e1 -0.61416676 0.04150626          between_groups
3        3     s3_e1  0.05212214 0.02011190          between_groups
4        4     s4_e1 -0.03762498 0.03961485          between_groups
5        5     s5_e1  0.08821881 0.01982319          between_groups
6        6     s6_e1  0.08401025 0.03964278          between_groups
7        7     s7_e1 -0.16137955 0.04053557          between_groups
8        8     s8_e1 -0.34000000 0.04106457 between_reported_d_t_df
  imputed_flag  previous_d previous_v       delta_d       delta_v  abs_delta_d
1        FALSE  0.39981161 0.02030656  1.121325e-13 -3.996333e-06 1.121325e-13
2        FALSE -0.61416676 0.04154399  8.304468e-14 -3.772385e-05 8.304468e-14
3        FALSE  0.05212214 0.02011197  4.513750e-14 -6.929864e-08 4.513750e-14
4        FALSE -0.03762498 0.03961499  1.362799e-14 -1.415777e-07 1.362799e-14
5        FALSE  0.08821881 0.01982338 -4.686390e-13 -1.926380e-07 4.686390e-13
6        FALSE  0.08401025 0.03964349 -2.342571e-13 -7.058425e-07 2.342571e-13
7         TRUE          NA         NA            NA            NA           NA
8        FALSE -0.34000000 0.04106457  0.000000e+00 -3.809730e-13 0.000000e+00
   abs_delta_v
1 3.996333e-06
2 3.772385e-05
3 6.929864e-08
4 1.415777e-07
5 1.926380e-07
6 7.058425e-07
7           NA
8 3.809730e-13

Study 7 Equal-N Sensitivity

The primary Study 7 estimate uses n_low = n_high = 99 / 2. The two possible integer splits differ only by one participant. This table checks both directions.

study7_sensitivity_inputs <- list(
  list(split = "equal_fractional_49.5_49.5", n_low = 99 / 2, n_high = 99 / 2),
  list(split = "low49_high50", n_low = 49, n_high = 50),
  list(split = "low50_high49", n_low = 50, n_high = 49)
)

study7_sensitivity <- do.call(rbind, lapply(study7_sensitivity_inputs, function(x) {
  res <- compute_with_esc(
    esc::esc_mean_sd,
    grp1m = 8.31,
    grp1sd = 1.86,
    grp1n = x$n_low,
    grp2m = 8.62,
    grp2sd = 1.98,
    grp2n = x$n_high
  )
  data.frame(
    split = x$split,
    n_low = x$n_low,
    n_high = x$n_high,
    d = res$d,
    v = res$v,
    stringsAsFactors = FALSE
  )
}))

study7_sensitivity$delta_d_from_primary <- study7_sensitivity$d - study7_sensitivity$d[1]
study7_sensitivity$delta_v_from_primary <- study7_sensitivity$v - study7_sensitivity$v[1]
study7_sensitivity
                       split n_low n_high          d          v
1 equal_fractional_49.5_49.5  49.5   49.5 -0.1613796 0.04053557
2               low49_high50  49.0   50.0 -0.1613276 0.04053961
3               low50_high49  50.0   49.0 -0.1614315 0.04053978
  delta_d_from_primary delta_v_from_primary
1         0.000000e+00         0.000000e+00
2         5.191505e-05         4.038248e-06
3        -5.196520e-05         4.207583e-06

Paste-ready YAML snippets

for (i in seq_len(nrow(audit))) {
  row <- audit[i, ]
  cat(sprintf("\n# %s (study_id=%s)\n", row$effect_id, row$study_id))
  cat(sprintf(
    "effect_size:\n  metric: SMD\n  d: %.12f\n  v: %.12f\n  computed_from: %s\n  needs_review: false\n  notes: \"%s\"\n",
    row$d,
    row$v,
    row$computed_from_suggested,
    gsub("\"", "'", row$inputs_used)
  ))
}

# s1_e1 (study_id=1)
effect_size:
  metric: SMD
  d: 0.399811605602
  v: 0.020302566794
  computed_from: groups
  needs_review: false
  notes: "method=between_groups, sign_convention=d = mean(low) - mean(high), n_low=102, n_high=99, mean_low=5.02, mean_high=4.36, sd_low=1.48, sd_high=1.81, reported_d=0.41"

# s2_e1 (study_id=2)
effect_size:
  metric: SMD
  d: -0.614166764737
  v: 0.041506263263
  computed_from: groups
  needs_review: false
  notes: "method=between_groups, sign_convention=d = mean(low) - mean(high), n_low=52, n_high=49, mean_low=4.44, mean_high=5.41, sd_low=1.55, sd_high=1.61, reported_d=0.61"

# s3_e1 (study_id=3)
effect_size:
  metric: SMD
  d: 0.052122137662
  v: 0.020111897654
  computed_from: groups
  needs_review: false
  notes: "method=between_groups, sign_convention=d = mean(low) - mean(high), n_low=98, n_high=101, mean_low=4.58, mean_high=4.49, sd_low=1.67, sd_high=1.78, reported_d=0.06"

# s4_e1 (study_id=4)
effect_size:
  metric: SMD
  d: -0.037624978833
  v: 0.039614851251
  computed_from: groups
  needs_review: false
  notes: "method=between_groups, sign_convention=d = mean(low) - mean(high), n_low=50, n_high=51, mean_low=4.54, mean_high=4.61, sd_low=1.73, sd_high=1.98, reported_d=0.04"

# s5_e1 (study_id=5)
effect_size:
  metric: SMD
  d: 0.088218811866
  v: 0.019823185328
  computed_from: groups
  needs_review: false
  notes: "method=between_groups, sign_convention=d = mean(low) - mean(high), n_low=102, n_high=100, mean_low=4.79, mean_high=4.64, sd_low=1.72, sd_high=1.68, reported_d=0.09"

# s6_e1 (study_id=6)
effect_size:
  metric: SMD
  d: 0.084010249876
  v: 0.039642782355
  computed_from: groups
  needs_review: false
  notes: "method=between_groups, sign_convention=d = mean(low) - mean(high), n_low=50, n_high=51, mean_low=4.9, mean_high=4.76, sd_low=1.61, sd_high=1.72, reported_d=0.08"

# s7_e1 (study_id=7)
effect_size:
  metric: SMD
  d: -0.161379553952
  v: 0.040535572527
  computed_from: groups
  needs_review: false
  notes: "method=between_groups, sign_convention=d = mean(low) - mean(high), n_low=49.5, n_high=49.5, mean_low=8.31, mean_high=8.62, sd_low=1.86, sd_high=1.98, df=97, t=-0.81, imputed_equal_n=TRUE"

# s8_e1 (study_id=8)
effect_size:
  metric: SMD
  d: -0.340000000000
  v: 0.041064569211
  computed_from: reported_d
  needs_review: false
  notes: "method=between_reported_d_t_df, sign_convention=d = mean(low) - mean(high), mean_low=8.59, mean_high=9.08, df=98, t=1.69, reported_d=0.34"