Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
Snoopy1866 committed Sep 14, 2024
1 parent cb747f5 commit b8326c6
Show file tree
Hide file tree
Showing 2 changed files with 286 additions and 45 deletions.
60 changes: 60 additions & 0 deletions main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
from pystatpower.procedures.two_proportion import *

result = (
TwoProportion(EnumSolvableParameter.N)
.set_alpha(0.05)
.set_power(0.8)
.set_alternative(EnumAlternative.TWO_SIDED)
.set_group_allocation(GroupAllocation(EnumGroupAllocation.EQUAL))
.set_test_type(EnumTestType.Z_TEST_POOLED)
.set_treatment_proportion(0.95)
.set_reference_proportion(0.80)
.get_solver()
.solve()
)

print(result)


result = (
TwoProportion(EnumSolvableParameter.N)
.set_alpha(0.05)
.set_power(0.8)
.set_alternative(EnumAlternative.TWO_SIDED)
.set_group_allocation(GroupAllocation(EnumGroupAllocation.FIX_TREATMENT_GROUP).set_treatment_n(100))
.set_test_type(EnumTestType.Z_TEST_POOLED)
.set_treatment_proportion(0.95)
.set_reference_proportion(0.80)
.get_solver()
.solve()
)

print(result)


result = (
TwoProportion(EnumSolvableParameter.N)
.set_alpha(0.05)
.set_power(0.8)
.set_alternative(EnumAlternative.TWO_SIDED)
.set_group_allocation(GroupAllocation(EnumGroupAllocation.EQUAL))
.set_test_type(EnumTestType.Z_TEST_POOLED)
.set_treatment_proportion(0.68)
.set_reference_proportion(0.69)
.get_solver()
.solve()
)

print(result)


result = fun_power(
alpha=0.05,
treatment_n=10000,
reference_n=10000,
treatment_proportion=0.68,
reference_proportion=0.69,
alternative=EnumAlternative.TWO_SIDED,
test_type=EnumTestType.Z_TEST_POOLED,
)
print(result)
Loading

0 comments on commit b8326c6

Please sign in to comment.