aboutsummaryrefslogtreecommitdiffstats
path: root/pkg/stats/pvalue.go
blob: cb8c3bada4cd28fe70ae1ee509ec842f47803ba5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
// Copyright 2021 syzkaller project authors. All rights reserved.
// Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file.

package stats

import "golang.org/x/perf/benchstat"

// Mann-Whitney U test.
func UTest(old, new *Sample) (pval float64, err error) {
	// Unfortunately we cannot just invoke MannWhitneyUTest from x/perf/benchstat/internal/stats,
	// so we first wrap the data in Metrics.
	mOld := benchstat.Metrics{
		RValues: old.Xs,
	}
	mNew := benchstat.Metrics{
		RValues: new.Xs,
	}
	return benchstat.UTest(&mOld, &mNew)
}