← Về thư mục
tests/statistical-power/test_scripts.py
- SampleSizeTests · class · L42-L98 — class SampleSizeTests(unittest.TestCase)
- test_two_sample_t_test_matches_cohens_canonical_value · method · L43-L47 — def test_two_sample_t_test_matches_cohens_canonical_value(self) -> None: # Cohen (1988): d = 0.5, alpha = .05 two-sided, power = .80 -> 64/group.
- test_correlation_matches_the_published_value · method · L49-L53 — def test_correlation_matches_the_published_value(self) -> None: # r = 0.30, alpha = .05 two-sided, power = .80 -> n = 85.
- test_anova_returns_total_n_not_per_group · method · L55-L61 — def test_anova_returns_total_n_not_per_group(self) -> None: # f = 0.25, k = 4, power = .80 -> ~180 total (45 per group).
- test_smaller_effects_need_larger_samples · method · L63-L68 — def test_smaller_effects_need_larger_samples(self) -> None
- test_higher_power_needs_a_larger_sample · method · L70-L73 — def test_higher_power_needs_a_larger_sample(self) -> None
- test_a_one_sided_test_needs_fewer_subjects · method · L75-L80 — def test_a_one_sided_test_needs_fewer_subjects(self) -> None
- test_round_up_is_the_default_because_a_fraction_of_a_subject_is_not_a_subject · method · L82-L91 — def test_round_up_is_the_default_because_a_fraction_of_a_subject_is_not_a_subject( self, ) -> None
- test_an_unequal_allocation_ratio_changes_the_first_group · method · L93-L98 — def test_an_unequal_allocation_ratio_changes_the_first_group(self) -> None
- RequiredArgumentTests · class · L101-L132 — class RequiredArgumentTests(unittest.TestCase)
- test_each_test_names_the_parameter_it_is_missing · method · L102-L114 — def test_each_test_names_the_parameter_it_is_missing(self) -> None
- test_an_unknown_test_is_named_in_the_error · method · L116-L118 — def test_an_unknown_test_is_named_in_the_error(self) -> None
- test_test_names_are_case_insensitive · method · L120-L124 — def test_test_names_are_case_insensitive(self) -> None
- test_power_requires_a_sample_size · method · L126-L128 — def test_power_requires_a_sample_size(self) -> None
- test_mde_requires_a_sample_size · method · L130-L132 — def test_mde_requires_a_sample_size(self) -> None
- PowerTests · class · L135-L181 — class PowerTests(unittest.TestCase)
- test_power_at_the_solved_sample_size_reaches_the_target · method · L136-L140 — def test_power_at_the_solved_sample_size_reaches_the_target(self) -> None
- test_power_is_bounded_and_monotone_in_n · method · L142-L148 — def test_power_is_bounded_and_monotone_in_n(self) -> None
- test_a_zero_effect_has_power_equal_to_alpha · method · L150-L156 — def test_a_zero_effect_has_power_equal_to_alpha(self) -> None: # With no true effect, the rejection rate is the type-I error rate.
- test_correlation_power_round_trips_with_its_sample_size · method · L158-L162 — def test_correlation_power_round_trips_with_its_sample_size(self) -> None
- test_regression_power_is_zero_when_the_model_has_no_residual_df · method · L164-L172 — def test_regression_power_is_zero_when_the_model_has_no_residual_df(self) -> None: # n - k_total - 1 < 1 means nothing left to test against; report 0 # rather than raising or returning a nonsense value.
- test_two_proportions_power_round_trips · method · L174-L181 — def test_two_proportions_power_round_trips(self) -> None
- MdeTests · class · L184-L212 — class MdeTests(unittest.TestCase)
- test_the_mde_at_a_solved_n_recovers_the_original_effect · method · L185-L188 — def test_the_mde_at_a_solved_n_recovers_the_original_effect(self) -> None
- test_a_larger_sample_detects_a_smaller_effect · method · L190-L193 — def test_a_larger_sample_detects_a_smaller_effect(self) -> None
- test_correlation_mde_round_trips · method · L195-L199 — def test_correlation_mde_round_trips(self) -> None
- test_regression_mde_round_trips · method · L201-L212 — def test_regression_mde_round_trips(self) -> None
- RegressionSolverTests · class · L215-L227 — class RegressionSolverTests(unittest.TestCase)
- test_the_sample_size_search_stops_at_the_first_adequate_n · method · L216-L223 — def test_the_sample_size_search_stops_at_the_first_adequate_n(self) -> None
- test_an_undetectably_small_effect_does_not_loop_forever · method · L225-L227 — def test_an_undetectably_small_effect_does_not_loop_forever(self) -> None
- PowerCurveTests · class · L230-L252 — class PowerCurveTests(unittest.TestCase)
- test_the_curve_rises_with_sample_size_and_is_saved · method · L231-L244 — def test_the_curve_rises_with_sample_size_and_is_saved(self) -> None
- test_per_group_tests_iterate_the_per_group_n · method · L246-L252 — def test_per_group_tests_iterate_the_per_group_n(self) -> None: # For t_ind the curve must pass nobs1, so power at n=64 matches the # canonical per-group answer rather than a total-n reading.
- SimulationTests · class · L255-L327 — class SimulationTests(unittest.TestCase)
- test_wilson_intervals_bracket_the_estimate_and_stay_in_range · method · L256-L266 — def test_wilson_intervals_bracket_the_estimate_and_stay_in_range(self) -> None
- test_a_zero_success_run_still_has_a_positive_upper_bound · method · L268-L273 — def test_a_zero_success_run_still_has_a_positive_upper_bound(self) -> None: # The interval must not collapse to (0, 0): "we saw none" is not # "it cannot happen".
- test_simulation_reproduces_from_its_seed · method · L275-L279 — def test_simulation_reproduces_from_its_seed(self) -> None
- test_simulated_power_tracks_the_analytic_answer · method · L281-L287 — def test_simulated_power_tracks_the_analytic_answer(self) -> None: # The whole point of the simulator is to agree with theory where theory # applies, so it can be trusted where theory does not.
- test_a_null_effect_simulates_to_the_alpha_level · method · L289-L294 — def test_a_null_effect_simulates_to_the_alpha_level(self) -> None
- test_the_estimate_reports_its_own_uncertainty · method · L296-L301 — def test_the_estimate_reports_its_own_uncertainty(self) -> None
- test_the_sample_size_search_returns_an_n_that_meets_the_target · method · L303-L314 — def test_the_sample_size_search_returns_an_n_that_meets_the_target(self) -> None
- test_the_worked_examples_all_produce_a_usable_estimate · method · L316-L327 — def test_the_worked_examples_all_produce_a_usable_estimate(self) -> None