1 // Copyright (C) The Lightning Authors. All rights reserved.
3 // SPDX-License-Identifier: AGPL-3.0
8 "gonum.org/v1/gonum/stat/distuv"
11 var chisquared = distuv.ChiSquared{K: 1}
13 func pvalue(x, y []bool) float64 {
19 for i, yi := range y {
33 if exp[0] == 0 || exp[1] == 0 || obs[0]+obs[1] == 0 {
36 exp[0] = (obs[0] + obs[1]) * exp[0] / sz
37 exp[1] = (obs[0] + obs[1]) * exp[1] / sz
42 return chisquared.Survival(sum)