Skip to content

Instantly share code, notes, and snippets.

View ConnorEsterwood's full-sized avatar

Connor Esterwood ConnorEsterwood

View GitHub Profile
@ConnorEsterwood
ConnorEsterwood / power_tau.R
Created July 27, 2020 18:59 — forked from bwiernik/power_tau.R
Power function for testing τ = 0 for random effects meta-analyses
# Based on methods described by Hedges and Pigott, https://doi.org/10.1037/1082-989X.9.4.426, p. 438
# Written 2019-10-25 by Brenton M. Wiernik
# Licensed GPL v3.0
power_curve <- function(object, tau, level = .95) {
if (! inherits(object, "rma.uni")) stop("'object' must be an object of class 'rma.uni'")
tau2 <- tau^2
obs_tau2 <- object$tau2
obs_tau <- sqrt(obs_tau2)
obs_H2 <- object$H2