Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rateCvToAlphaBeta function #1

Open
xiasijian opened this issue May 16, 2023 · 1 comment
Open

rateCvToAlphaBeta function #1

xiasijian opened this issue May 16, 2023 · 1 comment

Comments

@xiasijian
Copy link

image
image

Why could not find rateCvToAlphaBeta function?

@xiasijian
Copy link
Author

#' Converts mutation rate and coefficient of variation (CV) parameters
#' to equivalent alpha and beta parameters typically used for beta-binomial.
#'
#' @param rate mutation rate
#' @param cv coefficient of variation for mutation rate
#' @return Param list containing alpha and beta
rateCvToAlphaBeta <- function(rate, cv) {
ab <- rate * (1-rate) / (cv*rate)^2 - 1
my.alpha <- rate * ab
my.beta <- (1-rate)*ab
return(list(alpha=my.alpha, beta=my.beta))
}

#############################

Analyze power and false positives

when using a beta-binomial model

#############################
smgBbdFullAnalysis <- function(mu, cv, Leff, signif.level, effect.size,
desired.power, samp.sizes){

find the power and numer of samples needed for a desired power

powerResult <- smgBbdRequiredSampleSize(desired.power, mu, cv, samp.sizes,
effect.size, signif.level, Leff)
bbd.samp.size.min <- powerResult$samp.size.min
bbd.samp.size.max <- powerResult$samp.size.max
power.result.bbd <- powerResult$power

get alpha and beta parameterization

for beta-binomial

params <- rateCvToAlphaBeta(mu, cv)
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant