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

Use the BH correction rather than BY #15

Merged
merged 1 commit into from
Sep 12, 2024
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion evv4esm/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.


__version_info__ = (0, 5, 1)
__version_info__ = (0, 5, 2)
__version__ = ".".join(str(vi) for vi in __version_info__)

PASS_COLOR = "#389933"
Expand Down
12 changes: 8 additions & 4 deletions evv4esm/extensions/ks.py
Original file line number Diff line number Diff line change
Expand Up @@ -222,10 +222,13 @@ def run(name, config):
details, img_gal = main(args)

table_data = pd.DataFrame(details).T
uc_rejections = (table_data["K-S test stat"] < args.alpha).sum()

_hdrs = [
"h0",
"K-S test stat",
"K-S test p-val",
"K-S test p-val cor",
"T test stat",
"T test p-val",
"mean test case",
Expand Down Expand Up @@ -268,6 +271,7 @@ def run(name, config):
if len(rejects) < critical
else "statistically different"
],
"Un-corrected rejections": [uc_rejections],
}
),
)
Expand Down Expand Up @@ -327,6 +331,7 @@ def summarize_result(results_page):
summary["Rejecting"] = elem.data["Rejecting"][0]
summary["Critical value"] = elem.data["Critical value"][0]
summary["Ensembles"] = elem.data["Ensembles"][0]
summary["Uncorrected Rejections"] = elem.data["Un-corrected rejections"][0]
break

return {"": summary}
Expand Down Expand Up @@ -397,17 +402,16 @@ def compute_details(annual_avgs, common_vars, args):
# Create a null hypothesis rejection column for un-corrected p-values
detail_df["h0_uc"] = detail_df["K-S test p-val"] < args.alpha

(detail_df["h0_c"], detail_df["pval_c"]) = smm.fdrcorrection(
detail_df["K-S test p-val"], alpha=args.alpha, method="n", is_sorted=False
(detail_df["h0_c"], detail_df["K-S test p-val cor"]) = smm.fdrcorrection(
detail_df["K-S test p-val"], alpha=args.alpha, method="p", is_sorted=False
)

if args.uncorrected:
_testkey = "h0_uc"
else:
_testkey = "h0_c"

for var in common_vars:
details[var]["K-S test p-val"] = detail_df.loc[var, "pval_c"]
details[var]["K-S test p-val cor"] = detail_df.loc[var, "K-S test p-val cor"]

if details[var]["T test stat"] is None:
details[var]["h0"] = "-"
Expand Down