-
Notifications
You must be signed in to change notification settings - Fork 15
Open
Description
Two tailed p-values from pvalue are often larger than 1. This is easily tested by using the function with y_pred1=y_pred2, or by setting the scale of y_pred1 to a larger value than that of y_pred2 in the example notebook.
The issue arises here:
p = percentileofscore(z, 0.0, kind="weak") / 100.0
if two_tailed:
p *= 2.0
I think the fix is in the replacement:
p = percentileofscore(z, 0.0, kind="weak") / 100.0
if two_tailed:
p = 2*min(p, 1-p)
This will provide also restore that p-values for two-tailed tests are the same regardless of the order of y_pred1 and y_pred2.
However, this will still give undesired p values of 0.0 if y_pred1=y_pred2, because the percentileofscore argument kind = "weak". To remedy this, one could do
p = percentileofscore(z, 0.0, kind="mean") / 100.0
if two_tailed:
p = 2*min(p, 1-p)
Which will result in p values of 1.0 again, but slightly changes the p values compared to the old calculation, even when p<1-p.
Metadata
Metadata
Assignees
Labels
No labels