| editor_options | ||||
|---|---|---|---|---|
|
BLPlabtools documents the BLP lab's
approach to conducting meta-analyses and analyzing experimental data.
remotes::install_github('setgree/BLPlabtools', build_vignettes = TRUE)
browseVignettes(package = "BLPlabtools")The overview vignette previews the remainder.
- Functions for meta-analysis and experimental analysis
- Vignettes that walk through different workflows, focusing on meta-analysis
- Datasets:
sv_data- data from sexual violence prevention meta-analysiscontact_data- data from contact hypothesis meta-analysismap_reduction_data- data from meat animal product reduction meta-analysis
Calculate effect sizes
library(BLPlabtools)
# Example: Convert difference in means to Cohen's d
d <- d_calc(stat_type = "d_i_m", stat = 0.7, sample_sd = 0.75)
# Result: d = 0.933
# Calculate variance of the effect size
variance <- var_d_calc(d = d, n_t = 21, n_c = 21)
# Result: variance = 0.092Run a meta-analysis
library(BLPlabtools)
library(dplyr, warn.conflicts = FALSE)
# Use built-in sexual violence prevention data
sv_data |> map_robust() This prints:
# A tibble: 1 × 5
N_observations N_studies Delta se pval
<int> <int> <dbl> <dbl> <noquote>
1 489 295 0.283 0.0251 <.0001
Calculate cluster-robust standard errors
library(BLPlabtools)
data(contact_data)
# basic model:
model <- lm(d ~ days_delay + publish, data = contact_data)
# Add cluster-robust SEs by unique_study_id and
robust_se(model, cluster = contact_data$unique_study_id)[[2]] This prints
t test of coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 0.49606110 0.14650011 3.3861 0.00244 **
days_delay -0.00020262 0.00036177 -0.5601 0.58061
publish -0.04319455 0.10299523 -0.4194 0.67867
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
The very first draft of this work was done to prepare for The contact hypothesis re-evaluated, whose code is preserved on Code Ocean.
Then, while preparing Prejudice Reduction: Progress and Challenges -- code and data here -- John-Henry and I came up with the first drafts of PaluckMetaSOP (meta-analysis functions) and blpl (table formatting tools). We refined those further while preparing Preventing Sexual Violence —A Behavioral Problem Without a Behaviorally-Informed Solution.
Finally, I (Seth Green) adapted these tools further for Meaningfully reducing consumption of meat and animal products is an unsolved problem: A meta-analysis, whose code and data is here.
This package represents the culmination and synthesis of those many earlier efforts.
To contribute:
- Clone this package (
git clone https://github.com/setgree/BLPlabtools.git); - Add or amend functions and vignettes
- Open a pull request
See R packages for guidance. Or just use Claude Code 😃