Skip to content

Commit

Permalink
Added doc strings
Browse files Browse the repository at this point in the history
  • Loading branch information
ctokheim committed May 14, 2016
1 parent aa9460a commit 9365f83
Showing 1 changed file with 25 additions and 4 deletions.
29 changes: 25 additions & 4 deletions R/cancerSeqStudy.R
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ smg.binom.power <- function(my.mu,
muEffect <- 1 - ((1-my.mu)^Leff - r)^(1/Leff)
power <- c()
falsePositives <- c()
#for(i in seq(by, N, by=by)){
for(i in N){
# step one, find critical threshold
j <- 1
Expand Down Expand Up @@ -105,8 +104,8 @@ smg.binom.false.pos <- function(my.alpha, my.beta,
return(falsePositives)
}

#' calculates the false positives in a binomial model
#' if there is over-diserspion
#' calculates the false positives for a binomial model of
#' a ratio-metric feature.
#'
#' @param my.alpha alpha parameter for beta binomial
#' @param my.beta beta parameter for beta binomial
Expand Down Expand Up @@ -199,6 +198,15 @@ smg.bbd.power <- function(my.alpha, my.beta,
return(power)
}

#' calculates the power in a binomial power model
#' for ratio-metric approach
#'
#' @param p background proportion of total mutations falling into specific category
#' @param N vector of sample sizes
#' @param mu per base rate of mutation
#' @param r effect size for power analysis
#' @param signif.level alpha level for power analysis
#' @return vector containing power for each sample size
ratiometric.binom.power <- function(p, N, mu,
L=1500, r=.02,
signif.level=5e-6){
Expand Down Expand Up @@ -244,9 +252,22 @@ ratiometric.binom.power <- function(p, N, mu,
return(power)
}

#' Calculates the power in a ratio-metric approach using
#' a beta-binomial power model.
#'
#' The alpha and beta parameterize a proportion out of the
#' total mutations in a gene, rather than a mutation rate per base.
#'
#' @param my.alpha alpha parameter for beta binomial
#' @param my.beta beta parameter for beta binomial
#' @param N vector of sample sizes
#' @param mu per base rate of mutation
#' @param r effect size for power analysis
#' @param signif.level alpha level for power analysis
#' @return vector containing power for each sample size
ratiometric.bbd.power <- function(my.alpha, my.beta,
N, mu,
L=1500,r=.02,
L=1500, r=.02,
signif.level=5e-6){
# figure out what the ratio-metric probability is from
# the alpha and beta parameters
Expand Down

0 comments on commit 9365f83

Please sign in to comment.