Skip to content
madajz edited this page Feb 21, 2023 · 12 revisions

Welcome to the bifurcatoR wiki! Here you will find the expanded methods section for the functions utilized in the bifurcatoR Shiny app (https://vai-bbc.shinyapps.io/Shiny_BifurcatoR).

Function

Calc Power

Deprecated.

est_pow

This function is the workhorse for Module II of the BifurcatoR Shiny app (https://vai-bbc.shinyapps.io/Shiny_BifurcatoR). The purpose of this module and this function is to estimate the expected power to detect significant evidence against unimodality in a sample of size n via any of: Hartigan's Dip test (https://cran.r-project.org/web/packages/diptest/index.html),a bootstrap likelihood ratio test via mclust (https://cran.r-project.org/web/packages/mclust/index.html), and a bimodality coefficient > 0.555 as implemented and recommended by _mousetrap _(https://cran.r-project.org/web/packages/mousetrap/index.html). This module will also estimate the false positive rate if data are drawn from a unimodal distribution (possible distributions are Weibull, Gaussian, and Beta). For Weibull and Gaussian, Bimodal distributions are created as a mixture of two unimodal distributions with the given inputs; for Beta bimodality is achieved when both shape parameters are less than 1. To estimate the false positive rate when data come from a comparable unimodal distribution, we average the two sets of Weibull parameters, the means for Gaussian are also averaged but the variations are pooled (https://en.wikipedia.org/wiki/Pooled_variance), and for Beta, the default unimodal distribution has both shape parameters equal to 2. The inputs for this function are, in order:

  • n: the total sample size to sampled from the parent distribution
  • alpha: the desired significance level/ type-I error rate. Note that any multiple testing corrections must be performed outside of this function
  • nsim: the number of simulated samples of size n to be drawn. The higher this number, the more accurate the the power calculation, but the longer run time. Power = the number of bimodal datasets with significant evidence of bimodality / nsim. The false positive rate is the number of unimodal datasets with significant evidence / nsim.
  • dist: the distribution the simulated data is to be sample from. Currently the options are Gaussian and beta (soon Weibull).
    • If dist == 'beta', the expected parameter list should contain the two shape parameters s1 and s2,in alternative notation for the beta distribtuion s1 = α and s2 = β
      • A useful feature of the beta distribution: if both α and β are less than 1, the distribution is bimodal
      • The unimodal distribution used to estimate the false positive rate comes from beta(α = 2, β = 2)
    • if dist == 'norm', the expected parameter list should contain: two means mu1 & mu2, two standard deviations sd1 & sd2, and p the proportion of samples in mode 1
      • The unimodal distribution used to estimate the false positive rate uses mu = weighted average of mu1 and mu2, where n1 = floor(p*n) and n2 = floor((1-p)*n), sd is the pooled sd of sd1 and sd2 using the same n1 and n2 as used for the means
        • floor() is used here to make sure power is not overestimated when n*p results in a fractional sample.
    • is dist == "weib", the expected parameter list should contain: two shape parameters sp1 & sp2, two scale parameters sc1 & sc2, and p the proportion of samples in mode 1
Clone this wiki locally