项目作者: aurora-mareviv

项目描述 :
Sample size and power for association studies involving mitochondrial DNA haplogroups -
高级语言: R
项目地址: git://github.com/aurora-mareviv/mthapower.git
创建时间: 2017-06-30T16:51:33Z
项目社区:https://github.com/aurora-mareviv/mthapower

开源协议:GNU General Public License v3.0

下载


" class="reference-link">mthapower

CRAN version Downloads from Rstudio mirror

Calculate sample size and power for association studies involving mitochondrial DNA haplogroups - Based on Samuels et al. AJHG, 2006. 78(4):713-720. DOI:10.1086/502682

Installation

  • From CRAN:
  1. install.packages("mthapower")
  • From GitHub:
  1. # install.packages("devtools")
  2. devtools::install_github("aurora-mareviv/mthapower")

Shiny app

  1. # install.packages("shiny")
  2. shiny::runGist('5895082')

Examples

Sample size estimation

  • Determine the minimum number of cases (Ncmin), required to detect: either a change from p0 (haplogroup frequency in controls) to p1 (haplogroup frequency in cases), or a given OR, with a predefined confidence interval, in a study with Nh haplogroups.
  1. library(mthapower)
  2. library(dplyr)
  3. mydata <- mthacases(p0=0.445, Nh=11,
  4. OR.cas.ctrl=c(2), power=80,
  5. sig.level=0.05) # Baudouin study
  6. mydata <- mthacases(p0=0.445, Nh=11,
  7. OR.cas.ctrl=c(1.25,1.5,1.75,2,2.25,2.5,2.75,3),
  8. power=80, sig.level=0.05)
  9. mydata <- mydata[c(2,6)]
  10. mydata %>%
  11. knitr::kable()
cases.min ORcas.ctrl
2598.580 1.25
782.882 1.50
410.041 1.75
267.193 2.00
195.428 2.25
153.394 2.50
126.216 2.75
107.388 3.00
  1. plot(mydata)

Power estimation

  • For a given study size, determine the minimum effect size that can be detected with the desired power and significance level, in a study with Nh haplogroups.
  1. # Example 2a:
  2. # library(mthapower)
  3. pow <- mthapower(n.cases=203, p0=0.443, Nh=13, OR.cas.ctrl=2.33, sig.level=0.05)
  4. pow %>%
  5. knitr::kable()
Nh ncases p0 p1 OR.ctrl.cas OR.cas.ctrl power sig.level
13 203 0.443 0.65 0.429 2.33 82.759 0.05
  1. # Example 2b:
  2. # Create data frames
  3. pow.H150 <- mthapower(n.cases=seq(50,1000,by=50), p0=0.433, Nh=11,
  4. OR.cas.ctrl=1.5, sig.level=0.05)
  5. pow.H175 <- mthapower(n.cases=seq(50,1000,by=50), p0=0.433, Nh=11,
  6. OR.cas.ctrl=1.75, sig.level=0.05)
  7. pow.H200 <- mthapower(n.cases=seq(50,1000,by=50), p0=0.433, Nh=11,
  8. OR.cas.ctrl=2, sig.level=0.05)
  9. pow.H250 <- mthapower(n.cases=seq(50,1000,by=50), p0=0.433, Nh=11,
  10. OR.cas.ctrl=2.5, sig.level=0.05)
  11. # Bind the three data frames:
  12. bindata <- rbind(pow.H150,pow.H175,pow.H200,pow.H250)
  13. # Adds column OR to binded data frame:
  14. bindata$OR <- rep(factor(c(1.50,1.75,2,2.5)),
  15. times = c(nrow(pow.H150),
  16. nrow(pow.H175),
  17. nrow(pow.H200),
  18. nrow(pow.H250)))
  19. # Create plot:
  20. # install.packages("car")
  21. library(car)
  22. scatterplot(power~ncases | OR, regLine=FALSE,
  23. smooth=FALSE,
  24. boxplots=FALSE, by.groups=TRUE,
  25. data=bindata)