Skip to content

Commit

Permalink
Merge pull request #22 from sdaza/dev
Browse files Browse the repository at this point in the history
additional testing
  • Loading branch information
sdaza authored Dec 11, 2024
2 parents be8f87b + 3e25e16 commit d732f6e
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions tests/test_power_sim.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import pytest
from experiment_utils.power_sim import PowerSim
from experiment_utils.spark_instance import *


def test_power_estimation():
"""Test power estimation"""
p = PowerSim(metric='proportion', relative_effect=False, variants=1,
nsim=1000, alpha=0.05, alternative='two-tailed')
try:
p.get_power(baseline=[0.33], effect=[0.03], sample_size=[3000])
assert True
except Exception as e:
pytest.fail(f" raised an exception: {e}")


def test_plot_power():
"""Test plot power"""
p = PowerSim(metric='proportion', relative_effect=False,
variants=2, alternative='two-tailed',
nsim=100, correction='holm')
try:
p.grid_sim_power(baseline_rates=[[0.33]],
effects=[[0.01, 0.03], [0.03, 0.05], [0.03, 0.07]],
sample_sizes=[[1000], [5000], [9000]],
threads=16,
plot=True)
assert True
except Exception as e:
pytest.fail(f" raised an exception: {e}")

0 comments on commit d732f6e

Please sign in to comment.