Effect size computations: buckwalter2014themysterofstakes

Computes standardized mean differences (d) and sampling variances (v) for papers/buckwalter2014themysterofstakes/buckwalter2014themysterofstakes.yaml.

All effects below use the analyst-authorized equal-cell assumption.

Inputs and methods

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

effects <- list(
  list(
    study_id = 1,
    effect_id = "s1_e1",
    method_used = "between_groups",
    n_low = 185 / 8,
    n_high = 185 / 8,
    mean_low = 3.48,
    sd_low = 1.62,
    mean_high = 4.15,
    sd_high = 1.05,
    notes_on_assumptions = "Bank denial, low error. Equal-cell approximation in 2x2x2 design: analyzed N=185 implies 23.125 per cell."
  ),
  list(
    study_id = 1,
    effect_id = "s1_e2",
    method_used = "between_groups",
    n_low = 185 / 8,
    n_high = 185 / 8,
    mean_low = 4.27,
    sd_low = 1.08,
    mean_high = 3.92,
    sd_high = 1.12,
    notes_on_assumptions = "Bank denial, high error. Equal-cell approximation in 2x2x2 design: analyzed N=185 implies 23.125 per cell."
  ),
  list(
    study_id = 1,
    effect_id = "s1_e3",
    method_used = "between_groups",
    n_low = 185 / 8,
    n_high = 185 / 8,
    mean_low = 4.70,
    sd_low = 0.56,
    mean_high = 4.48,
    sd_high = 0.59,
    notes_on_assumptions = "Bank assertion, low error. Equal-cell approximation in 2x2x2 design: analyzed N=185 implies 23.125 per cell."
  ),
  list(
    study_id = 1,
    effect_id = "s1_e4",
    method_used = "between_groups",
    n_low = 185 / 8,
    n_high = 185 / 8,
    mean_low = 4.05,
    sd_low = 1.30,
    mean_high = 4.33,
    sd_high = 0.73,
    notes_on_assumptions = "Bank assertion, high error. Equal-cell approximation in 2x2x2 design: analyzed N=185 implies 23.125 per cell."
  ),
  list(
    study_id = 2,
    effect_id = "s2_e1",
    method_used = "between_groups",
    n_low = 90 / 4,
    n_high = 90 / 4,
    mean_low = 2.61,
    sd_low = 0.89,
    mean_high = 5.12,
    sd_high = 3.42,
    notes_on_assumptions = "Typo knowledge probe. Equal-cell approximation in 2x2 design: analyzed N=90 implies 22.5 per cell."
  )
)

Computation

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

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

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

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 <- effect_inputs$n_high
  n_low <- effect_inputs$n_low
  mean_high <- effect_inputs$mean_high
  mean_low <- effect_inputs$mean_low
  sd_high <- effect_inputs$sd_high
  sd_low <- effect_inputs$sd_low
  notes_on_assumptions <- effect_inputs$notes_on_assumptions

  if (method_used != "between_groups") {
    stop(sprintf("This paper uses between_groups only; got method_used=%s", method_used), call. = 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")

  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
  )

  inputs_used <- paste(
    c(
      sprintf("method=%s", method_used),
      sprintf("sign_convention=%s", sign_convention),
      sprintf("n_low=%s", n_low),
      sprintf("n_high=%s", n_high),
      sprintf("mean_low=%s", mean_low),
      sprintf("sd_low=%s", sd_low),
      sprintf("mean_high=%s", mean_high),
      sprintf("sd_high=%s", sd_high)
    ),
    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 = "groups",
    inputs_used = inputs_used,
    d = res$d,
    v = res$v,
    g = res$g,
    v_g = res$v_g,
    notes_on_assumptions = notes_on_assumptions,
    stringsAsFactors = FALSE
  )
}

audit <- do.call(rbind, lapply(effects, compute_effect))
audit
                        paper_key study_id effect_id           design
1 buckwalter2014themysterofstakes        1     s1_e1 Between-Subjects
2 buckwalter2014themysterofstakes        1     s1_e2 Between-Subjects
3 buckwalter2014themysterofstakes        1     s1_e3 Between-Subjects
4 buckwalter2014themysterofstakes        1     s1_e4 Between-Subjects
5 buckwalter2014themysterofstakes        2     s2_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
                                                                                                                                               inputs_used
1 method=between_groups, sign_convention=d = mean(low) - mean(high), n_low=23.125, n_high=23.125, mean_low=3.48, sd_low=1.62, mean_high=4.15, sd_high=1.05
2 method=between_groups, sign_convention=d = mean(low) - mean(high), n_low=23.125, n_high=23.125, mean_low=4.27, sd_low=1.08, mean_high=3.92, sd_high=1.12
3  method=between_groups, sign_convention=d = mean(low) - mean(high), n_low=23.125, n_high=23.125, mean_low=4.7, sd_low=0.56, mean_high=4.48, sd_high=0.59
4  method=between_groups, sign_convention=d = mean(low) - mean(high), n_low=23.125, n_high=23.125, mean_low=4.05, sd_low=1.3, mean_high=4.33, sd_high=0.73
5     method=between_groups, sign_convention=d = mean(low) - mean(high), n_low=22.5, n_high=22.5, mean_low=2.61, sd_low=0.89, mean_high=5.12, sd_high=3.42
           d          v          g        v_g
1 -0.4908129 0.08909078 -0.4824467 0.08909078
2  0.3181292 0.08758061  0.3127066 0.08758061
3  0.3824786 0.08806800  0.3759591 0.08806800
4 -0.2655908 0.08724906 -0.2610637 0.08724906
5 -1.0044622 0.10009938 -0.9868400 0.10009938
                                                                                           notes_on_assumptions
1     Bank denial, low error. Equal-cell approximation in 2x2x2 design: analyzed N=185 implies 23.125 per cell.
2    Bank denial, high error. Equal-cell approximation in 2x2x2 design: analyzed N=185 implies 23.125 per cell.
3  Bank assertion, low error. Equal-cell approximation in 2x2x2 design: analyzed N=185 implies 23.125 per cell.
4 Bank assertion, high error. Equal-cell approximation in 2x2x2 design: analyzed N=185 implies 23.125 per cell.
5            Typo knowledge probe. Equal-cell approximation in 2x2 design: analyzed N=90 implies 22.5 per cell.

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.490812856859
  v: 0.089090781194
  computed_from: groups
  needs_review: false
  notes: "method=between_groups, sign_convention=d = mean(low) - mean(high), n_low=23.125, n_high=23.125, mean_low=3.48, sd_low=1.62, mean_high=4.15, sd_high=1.05"

# s1_e2 (study_id=1)
effect_size:
  metric: SMD
  d: 0.318129239182
  v: 0.087580607706
  computed_from: groups
  needs_review: false
  notes: "method=between_groups, sign_convention=d = mean(low) - mean(high), n_low=23.125, n_high=23.125, mean_low=4.27, sd_low=1.08, mean_high=3.92, sd_high=1.12"

# s1_e3 (study_id=1)
effect_size:
  metric: SMD
  d: 0.382478573848
  v: 0.088067998481
  computed_from: groups
  needs_review: false
  notes: "method=between_groups, sign_convention=d = mean(low) - mean(high), n_low=23.125, n_high=23.125, mean_low=4.7, sd_low=0.56, mean_high=4.48, sd_high=0.59"

# s1_e4 (study_id=1)
effect_size:
  metric: SMD
  d: -0.265590823941
  v: 0.087249064711
  computed_from: groups
  needs_review: false
  notes: "method=between_groups, sign_convention=d = mean(low) - mean(high), n_low=23.125, n_high=23.125, mean_low=4.05, sd_low=1.3, mean_high=4.33, sd_high=0.73"

# s2_e1 (study_id=2)
effect_size:
  metric: SMD
  d: -1.004462158914
  v: 0.100099380319
  computed_from: groups
  needs_review: false
  notes: "method=between_groups, sign_convention=d = mean(low) - mean(high), n_low=22.5, n_high=22.5, mean_low=2.61, sd_low=0.89, mean_high=5.12, sd_high=3.42"