Skip to content

Power Analysis

Utilities to estimate sample sizes and power for harmonisation experiments.

Cohens_D_PowerAnalysis(data, batch, a, b)

Perform power analysis for Cohen's d between each pair of batches given in the batch variable. Each batch pair is tested seperately and we return the power vs sample size curve for three effect sizes: 0.1, 0.5, 0.8 and 1.2 (small, medium, large, very large) The values for Cohen's d given in a are for each unique pair of batches in batch variable. Note: As Cohen's d is a relatively simple test, we can use analytical solutions using a 2 sample t-test power analysis. This assumption may not hold for highly non-normal data or for other tests

Variance_Ratio_PowerAnalysis(data, batch, ratio_of_variance, unique_batches)

As variance ratio is tested using an F-test, we can use the FTestAnovaPower from statsmodels to perform power analysis.

Example

Programmatic usage:

from DiagnoseHarmonisation.PowerAnalysis import estimate_power
estimate_power(effect_size=0.5, n=50, alpha=0.05)