Title: | Sample Size and Power for Association Studies Involving Mitochondrial DNA Haplogroups |
---|---|
Description: | Calculate Sample Size and Power for Association Studies Involving Mitochondrial DNA Haplogroups. Based on formulae by Samuels et al. AJHG, 2006. 78(4):713-720. <DOI:10.1086/502682>. |
Authors: | Aurora Baluja [aut, cre] |
Maintainer: | Aurora Baluja <[email protected]> |
License: | GPL-3 |
Version: | 0.1.1 |
Built: | 2025-03-05 04:47:54 UTC |
Source: | https://github.com/aurora-mareviv/mthapower |
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.
Note: I assume that case-control equations are valid for cohorts with a balanced number of cases and controls.
This function may not be generalizable for all studies involving mtDNA haplogroups.
mthacases(p0 = p0, Nh = Nh, OR.cas.ctrl = OR.cas.ctrl, power = power, sig.level = sig.level)
mthacases(p0 = p0, Nh = Nh, OR.cas.ctrl = OR.cas.ctrl, power = power, sig.level = sig.level)
p0 |
the frequency of the haplogroup in the control population, (that is, the controls among exposed). It depends on haplogroup baseline frequency. |
Nh |
number of haplogroup categories. Usually 10 haplogroups plus one category for rare haplogroups: |
OR.cas.ctrl |
|
power |
the power to detect a given OR in my study (usually 80-90). |
sig.level |
the alpha error accepted. Can take 3 possible values: |
Gives the result in a data frame, easy to print in a plot.
Author and maintainer: Aurora Baluja. Email: [email protected]
1. DC Samuels, AD Carothers, R Horton, PF Chinnery. The Power to Detect Disease Associations with Mitochondrial DNA Haplogroups. AJHG, 2006. 78(4):713-720. DOI:10.1086/502682.
2. Source code: github.com/aurora-mareviv/mthapower.
3. Shiny app: aurora.shinyapps.io/mtDNA_power_calc.
mydata <- mthacases(p0=0.445, Nh=11, OR.cas.ctrl=c(2), power=80, sig.level=0.05) # Baudouin study mydata <- mthacases(p0=0.445, Nh=11, OR.cas.ctrl=c(1.25,1.5,1.75,2,2.25,2.5,2.75,3), power=80, sig.level=0.05) mydata <- mydata[c(2,6)] mydata plot(mydata)
mydata <- mthacases(p0=0.445, Nh=11, OR.cas.ctrl=c(2), power=80, sig.level=0.05) # Baudouin study mydata <- mthacases(p0=0.445, Nh=11, OR.cas.ctrl=c(1.25,1.5,1.75,2,2.25,2.5,2.75,3), power=80, sig.level=0.05) mydata <- mydata[c(2,6)] mydata plot(mydata)
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.
Note: I assume that case-control equations are valid for cohorts with a balanced number of cases and controls.
This function may not be generalizable for all studies involving mtDNA haplogroups.
mthapower(n.cases = ncases, p0 = p0, Nh = Nh, OR.cas.ctrl = OR.cas.ctrl, sig.level = sig.level)
mthapower(n.cases = ncases, p0 = p0, Nh = Nh, OR.cas.ctrl = OR.cas.ctrl, sig.level = sig.level)
n.cases |
number of cases or controls from the study. It can be either a single value, or a sequence: |
p0 |
the frequency of the haplogroup in the control population. It depends on haplogroup baseline frequency. |
Nh |
number of categories for haplogroups. Usually 10 haplogroups plus one category for rare haplogroups: |
OR.cas.ctrl |
(p1 / (1-p1)) / (p0 / (1-p0)) the OR you want to detect with your data. |
sig.level |
the alpha error accepted. Can take 3 possible values: |
Calculates power given the number of cases and other parameters. The output is an object of class data.frame
, ready to plot.
Author and maintainer: Aurora Baluja. Email: [email protected]
1. DC Samuels, AD Carothers, R Horton, PF Chinnery. The Power to Detect Disease Associations with Mitochondrial DNA Haplogroups. AJHG, 2006. 78(4):713-720. DOI:10.1086/502682.
2. Source code: github.com/aurora-mareviv/mthapower.
3. Shiny app: aurora.shinyapps.io/mtDNA_power_calc.
# Example 1: pow <- mthapower(n.cases=203, p0=0.443, Nh=13, OR.cas.ctrl=2.33, sig.level=0.05) # Example 2: # Create data frames pow.H150 <- mthapower(n.cases=seq(50,1000,by=50), p0=0.433, Nh=11, OR.cas.ctrl=1.5, sig.level=0.05) pow.H175 <- mthapower(n.cases=seq(50,1000,by=50), p0=0.433, Nh=11, OR.cas.ctrl=1.75, sig.level=0.05) pow.H200 <- mthapower(n.cases=seq(50,1000,by=50), p0=0.433, Nh=11, OR.cas.ctrl=2, sig.level=0.05) pow.H250 <- mthapower(n.cases=seq(50,1000,by=50), p0=0.433, Nh=11, OR.cas.ctrl=2.5, sig.level=0.05) # Bind the three data frames: bindata <- rbind(pow.H150,pow.H175,pow.H200,pow.H250) # Adds column OR to binded data frame: bindata$OR <- rep(factor(c(1.50,1.75,2,2.5)), times = c(nrow(pow.H150), nrow(pow.H175), nrow(pow.H200), nrow(pow.H250))) # Create plot: # install.packages("car") library(car) scatterplot(power~ncases | OR, regLine=FALSE, smooth=FALSE, boxplots=FALSE, by.groups=TRUE, data=bindata)
# Example 1: pow <- mthapower(n.cases=203, p0=0.443, Nh=13, OR.cas.ctrl=2.33, sig.level=0.05) # Example 2: # Create data frames pow.H150 <- mthapower(n.cases=seq(50,1000,by=50), p0=0.433, Nh=11, OR.cas.ctrl=1.5, sig.level=0.05) pow.H175 <- mthapower(n.cases=seq(50,1000,by=50), p0=0.433, Nh=11, OR.cas.ctrl=1.75, sig.level=0.05) pow.H200 <- mthapower(n.cases=seq(50,1000,by=50), p0=0.433, Nh=11, OR.cas.ctrl=2, sig.level=0.05) pow.H250 <- mthapower(n.cases=seq(50,1000,by=50), p0=0.433, Nh=11, OR.cas.ctrl=2.5, sig.level=0.05) # Bind the three data frames: bindata <- rbind(pow.H150,pow.H175,pow.H200,pow.H250) # Adds column OR to binded data frame: bindata$OR <- rep(factor(c(1.50,1.75,2,2.5)), times = c(nrow(pow.H150), nrow(pow.H175), nrow(pow.H200), nrow(pow.H250))) # Create plot: # install.packages("car") library(car) scatterplot(power~ncases | OR, regLine=FALSE, smooth=FALSE, boxplots=FALSE, by.groups=TRUE, data=bindata)