Skip to content

Instantly share code, notes, and snippets.

Created July 29, 2017 09:24
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/32eef6305b533fcb12e4b8f21ff38a27 to your computer and use it in GitHub Desktop.
Save anonymous/32eef6305b533fcb12e4b8f21ff38a27 to your computer and use it in GitHub Desktop.
# The included numbers will per calulate power for a meta-analysis to detect a summary effect size of 0.2, with an average sample size per group of = 50, a total of 15 effect sizes, and moderate heterogeneity.
es <- 0.2 # Enter your summary effect size
as <- 50 # Average per number per group
mk <- 15 # Number of effect sizes
hg <- 1 # Heterogeniety (".33" for small, "1" for moderate, & "3" for large)
eq1 <- ((as+as)/((as)*(as))) + ((es^2)/(2*(as+as)))
eq2 <- hg*(eq1)
eq3 <- eq2+eq1
eq4 <- eq3/mk
eq5 <- (es/sqrt(eq4))
Power <- (1-pnorm(1.96-eq5)) # Two-tailed
Power
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment