Skip to content

Commit 7dc4387

Browse files
authored
Merge pull request #15 from LIVVkit/mkstratos/mvk_fdr_fix
Use the BH correction rather than BY
2 parents 8236001 + d0b4808 commit 7dc4387

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

evv4esm/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2929

3030

31-
__version_info__ = (0, 5, 1)
31+
__version_info__ = (0, 5, 2)
3232
__version__ = ".".join(str(vi) for vi in __version_info__)
3333

3434
PASS_COLOR = "#389933"

evv4esm/extensions/ks.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -222,10 +222,13 @@ def run(name, config):
222222
details, img_gal = main(args)
223223

224224
table_data = pd.DataFrame(details).T
225+
uc_rejections = (table_data["K-S test stat"] < args.alpha).sum()
226+
225227
_hdrs = [
226228
"h0",
227229
"K-S test stat",
228230
"K-S test p-val",
231+
"K-S test p-val cor",
229232
"T test stat",
230233
"T test p-val",
231234
"mean test case",
@@ -268,6 +271,7 @@ def run(name, config):
268271
if len(rejects) < critical
269272
else "statistically different"
270273
],
274+
"Un-corrected rejections": [uc_rejections],
271275
}
272276
),
273277
)
@@ -327,6 +331,7 @@ def summarize_result(results_page):
327331
summary["Rejecting"] = elem.data["Rejecting"][0]
328332
summary["Critical value"] = elem.data["Critical value"][0]
329333
summary["Ensembles"] = elem.data["Ensembles"][0]
334+
summary["Uncorrected Rejections"] = elem.data["Un-corrected rejections"][0]
330335
break
331336

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

400-
(detail_df["h0_c"], detail_df["pval_c"]) = smm.fdrcorrection(
401-
detail_df["K-S test p-val"], alpha=args.alpha, method="n", is_sorted=False
405+
(detail_df["h0_c"], detail_df["K-S test p-val cor"]) = smm.fdrcorrection(
406+
detail_df["K-S test p-val"], alpha=args.alpha, method="p", is_sorted=False
402407
)
403-
404408
if args.uncorrected:
405409
_testkey = "h0_uc"
406410
else:
407411
_testkey = "h0_c"
408412

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

412416
if details[var]["T test stat"] is None:
413417
details[var]["h0"] = "-"

0 commit comments

Comments
 (0)