Sidak and Bonferroni Corrected Alpha Thresholds From statsmodels multipletests

Quick Overview

Use statsmodels multipletests to return the Sidak and Bonferroni corrected per-test alpha thresholds for a list of p-values. It tests knowing the two multiple-testing correction formulas, reading a library's return value correctly, and handling edge cases such as an empty input.

Sidak and Bonferroni Corrected Alpha Thresholds From statsmodels multipletests

Role: Data Scientist

Category: Analytics & Experimentation

Difficulty: easy

Interview Round: Other

Implement `def corrected_alpha_thresholds(pvals: list[float], alpha: float = 0.05) -> tuple[float, float]`. Call `statsmodels.stats.multitest.multipletests(pvals, alpha=alpha, method='bonferroni')`, which returns `(reject, pvals_corrected, alphacSidak, alphacBonf)`, and return `(alphacSidak, alphacBonf)`. Requirements: - Return only elements `[2]` and `[3]`, in that order. The reject flags and corrected p-values are not part of the output. - Both values must be native Python `float`. Example: ```python corrected_alpha_thresholds([0.01, 0.02, 0.03, 0.04, 0.05], alpha=0.05) # -> (0.010206218313011495, 0.01) # m = 5 ``` ```hint Check by hand Work out the number of tests $m$ in the example and compute both thresholds yourself. Which of the inputs do they actually depend on? ``` ### What a Strong Answer Covers - Calls `multipletests` with the given `alpha` and `method='bonferroni'`, then returns elements `[2]` and `[3]` in that order. - Casts both values to native Python `float`. - States the Sidak and Bonferroni threshold formulas and checks the example against them. - Says which inputs the two thresholds depend on, and how an empty list should be handled. ### Follow-up Questions - Why is `alphacSidak` slightly larger than `alphacBonf`? - How would you handle an empty `pvals` list? - Would passing `method='holm'` change the two values you return?

Overview: Use statsmodels multipletests to return the Sidak and Bonferroni corrected per-test alpha thresholds for a list of p-values. It tests knowing the two multiple-testing correction formulas, reading a library's return value correctly, and handling edge cases such as an empty input.

General logo
General
Nov 25, 2026
easyData ScientistOtherAnalytics & Experimentation
0
0

Implement def corrected_alpha_thresholds(pvals: list[float], alpha: float = 0.05) -> tuple[float, float]. Call statsmodels.stats.multitest.multipletests(pvals, alpha=alpha, method='bonferroni'), which returns (reject, pvals_corrected, alphacSidak, alphacBonf), and return (alphacSidak, alphacBonf).

Requirements:

  • Return only elements [2] and [3] , in that order. The reject flags and corrected p-values are not part of the output.
  • Both values must be native Python float .

Example:

corrected_alpha_thresholds([0.01, 0.02, 0.03, 0.04, 0.05], alpha=0.05)
# -> (0.010206218313011495, 0.01)   # m = 5

What a Strong Answer Covers Guidance

  • Calls multipletests with the given alpha and method='bonferroni' , then returns elements [2] and [3] in that order.
  • Casts both values to native Python float .
  • States the Sidak and Bonferroni threshold formulas and checks the example against them.
  • Says which inputs the two thresholds depend on, and how an empty list should be handled.

Follow-up Questions Guidance

  • Why is alphacSidak slightly larger than alphacBonf ?
  • How would you handle an empty pvals list?
  • Would passing method='holm' change the two values you return?