shin2014timeconstraintspragmatic
/data/papers/shin2014timeconstraintspragmatic/analysis/effect_sizes.qmd---
title: "Effect size computation: shin2014timeconstraintspragmatic"
format:
html:
toc: true
execute:
echo: true
warning: true
message: false
---
Computes standardized mean differences (`d`) and sampling variances (`v`) for the
reconstructed high-vs-low stakes contrasts extracted into
`papers/shin2014timeconstraintspragmatic/shin2014timeconstraintspragmatic.yaml`.
## Shared helpers
```{r}
if (!requireNamespace("esc", quietly = TRUE)) {
stop("Package 'esc' is required for this template.", call. = FALSE)
}
suppressPackageStartupMessages(library(esc))
paper_key <- "shin2014timeconstraintspragmatic"
compute_between_groups <- function(
paper_key,
study_id,
effect_id,
n_low,
n_high,
mean_low,
mean_high,
sd_low,
sd_high,
notes_on_assumptions = ""
) {
res_d <- esc::esc_mean_sd(
grp1m = mean_low,
grp1sd = sd_low,
grp1n = n_low,
grp2m = mean_high,
grp2sd = sd_high,
grp2n = n_high,
es.type = "d"
)
res_g <- esc::esc_mean_sd(
grp1m = mean_low,
grp1sd = sd_low,
grp1n = n_low,
grp2m = mean_high,
grp2sd = sd_high,
grp2n = n_high,
es.type = "g"
)
audit <- data.frame(
paper_key = paper_key,
study_id = study_id,
effect_id = effect_id,
method_used = "between_groups",
sign_convention = "d = mean(low) - mean(high)",
n_low = n_low,
n_high = n_high,
mean_low = mean_low,
mean_high = mean_high,
sd_low = sd_low,
sd_high = sd_high,
d = as.numeric(res_d$es),
v = as.numeric(res_d$var),
g = as.numeric(res_g$es),
v_g = as.numeric(res_g$var),
notes_on_assumptions = notes_on_assumptions,
stringsAsFactors = FALSE
)
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",
audit$d,
audit$v,
gsub(
pattern = "\"",
replacement = "'",
x = paste0(
"Computed from reconstructed low- vs high-stakes condition summaries in analysis/effect_sizes.qmd ",
"(method=between_groups; sign convention d = mean(low) - mean(high))."
)
)
)
list(audit = audit, yaml_snippet = yaml_snippet)
}
```
## Study 1 / Effect s1_e1
### Experiment 1, Less-Time: low stakes vs high stakes
```{r}
inputs_s1_e1 <- list(
study_id = 1L,
effect_id = "s1_e1",
n_low = 38L,
n_high = 39L,
mean_low = 3.55,
mean_high = 4.23,
sd_low = 1.655,
sd_high = 1.55,
notes_on_assumptions = paste(
"Low-stakes Less-Time condition comes from the Experiment 1 main-text time-contrast summary.",
"High-stakes Less-Time condition comes from the TEI fig_1 caption recovered from the processed paper outputs.",
"The paper does not report a direct stakes test at fixed time, so this is a reconstructed between-subjects stakes contrast."
)
)
inputs_s1_e1
```
```{r}
res_s1_e1 <- compute_between_groups(
paper_key = paper_key,
study_id = inputs_s1_e1$study_id,
effect_id = inputs_s1_e1$effect_id,
n_low = inputs_s1_e1$n_low,
n_high = inputs_s1_e1$n_high,
mean_low = inputs_s1_e1$mean_low,
mean_high = inputs_s1_e1$mean_high,
sd_low = inputs_s1_e1$sd_low,
sd_high = inputs_s1_e1$sd_high,
notes_on_assumptions = inputs_s1_e1$notes_on_assumptions
)
res_s1_e1$audit
cat(res_s1_e1$yaml_snippet)
```
## Study 2 / Effect s2_e1
### Experiment 1, More-Time: low stakes vs high stakes
```{r}
inputs_s2_e1 <- list(
study_id = 2L,
effect_id = "s2_e1",
n_low = 43L,
n_high = 43L,
mean_low = 2.67,
mean_high = 2.92,
sd_low = 1.476,
sd_high = 1.98,
notes_on_assumptions = paste(
"Low-stakes More-Time condition comes from the Experiment 1 main-text time-contrast summary.",
"High-stakes More-Time condition comes from the TEI fig_1 caption recovered from the processed paper outputs.",
"The paper does not report a direct stakes test at fixed time, so this is a reconstructed between-subjects stakes contrast."
)
)
inputs_s2_e1
```
```{r}
res_s2_e1 <- compute_between_groups(
paper_key = paper_key,
study_id = inputs_s2_e1$study_id,
effect_id = inputs_s2_e1$effect_id,
n_low = inputs_s2_e1$n_low,
n_high = inputs_s2_e1$n_high,
mean_low = inputs_s2_e1$mean_low,
mean_high = inputs_s2_e1$mean_high,
sd_low = inputs_s2_e1$sd_low,
sd_high = inputs_s2_e1$sd_high,
notes_on_assumptions = inputs_s2_e1$notes_on_assumptions
)
res_s2_e1$audit
cat(res_s2_e1$yaml_snippet)
```
## Study 3 / Effect s3_e1
### Experiment 2, Less-Time: low stakes vs high stakes
```{r}
inputs_s3_e1 <- list(
study_id = 3L,
effect_id = "s3_e1",
n_low = 34L,
n_high = 27L,
mean_low = 1.85,
mean_high = 3.07,
sd_low = 0.857,
sd_high = 2.22,
notes_on_assumptions = paste(
"High-stakes Less-Time condition comes from the Experiment 2 main-text time-contrast summary.",
"Low-stakes Less-Time condition comes from footnote 32, recovered in the processed full text.",
"The paper does not report a direct stakes test at fixed time, so this is a reconstructed between-subjects stakes contrast."
)
)
inputs_s3_e1
```
```{r}
res_s3_e1 <- compute_between_groups(
paper_key = paper_key,
study_id = inputs_s3_e1$study_id,
effect_id = inputs_s3_e1$effect_id,
n_low = inputs_s3_e1$n_low,
n_high = inputs_s3_e1$n_high,
mean_low = inputs_s3_e1$mean_low,
mean_high = inputs_s3_e1$mean_high,
sd_low = inputs_s3_e1$sd_low,
sd_high = inputs_s3_e1$sd_high,
notes_on_assumptions = inputs_s3_e1$notes_on_assumptions
)
res_s3_e1$audit
cat(res_s3_e1$yaml_snippet)
```
## Study 4 / Effect s4_e1
### Experiment 2, More-Time: low stakes vs high stakes
```{r}
inputs_s4_e1 <- list(
study_id = 4L,
effect_id = "s4_e1",
n_low = 35L,
n_high = 31L,
mean_low = 2.71,
mean_high = 5.90,
sd_low = 1.29,
sd_high = 4.04,
notes_on_assumptions = paste(
"High-stakes More-Time condition comes from the Experiment 2 main-text time-contrast summary.",
"Low-stakes More-Time condition comes from footnote 32, recovered in the processed full text.",
"The paper does not report a direct stakes test at fixed time, so this is a reconstructed between-subjects stakes contrast."
)
)
inputs_s4_e1
```
```{r}
res_s4_e1 <- compute_between_groups(
paper_key = paper_key,
study_id = inputs_s4_e1$study_id,
effect_id = inputs_s4_e1$effect_id,
n_low = inputs_s4_e1$n_low,
n_high = inputs_s4_e1$n_high,
mean_low = inputs_s4_e1$mean_low,
mean_high = inputs_s4_e1$mean_high,
sd_low = inputs_s4_e1$sd_low,
sd_high = inputs_s4_e1$sd_high,
notes_on_assumptions = inputs_s4_e1$notes_on_assumptions
)
res_s4_e1$audit
cat(res_s4_e1$yaml_snippet)
```