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

additional testing #22

Merged
merged 2 commits into from
Dec 11, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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}")
Loading