1 // Copyright (C) The Lightning Authors. All rights reserved.
3 // SPDX-License-Identifier: AGPL-3.0
8 "golang.org/x/exp/rand"
9 "gonum.org/v1/gonum/stat/distuv"
12 var chisquared = distuv.ChiSquared{K: 1, Src: rand.NewSource(rand.Uint64())}
14 func pvalue(x, y []bool) float64 {
20 for i, yi := range y {
34 if exp[0] == 0 || exp[1] == 0 || obs[0]+obs[1] == 0 {
37 exp[0] = (obs[0] + obs[1]) * exp[0] / sz
38 exp[1] = (obs[0] + obs[1]) * exp[1] / sz
43 return chisquared.Survival(sum)