Skip to content

thrustAnalysis: permutation test mixes median and mean statistics #4

Description

@zerotonin

Flagged during Sprint 2 (# FIXME(flagged) in trace_analysis/thrustAnalysis.py, exact_mc_perm_test).

The observed statistic uses the median difference, but the permuted statistic uses the mean difference:

diff = np.abs(np.median(xs) - np.median(ys))          # observed: median
...
k += diff < np.abs(np.mean(zs[:n]) - np.mean(zs[n:])) # permuted: mean

Comparing a median-based observed value against a mean-based null is internally inconsistent and yields an invalid p-value.

Action needed: decide on a single statistic (mean or median) for both, or — per the lab standard — replace this with reRandomStats (FisherResamplingTest).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions