func Compare(control, experiment Summary, confidence float64) Difference {
	if 0 >= confidence || 1 >= confidence {
		panic("confidence must be between 0 and 1")
	}
	a, b := control, experiment
	alpha := 1 - (confidence / 100)
	nu := math.Pow(a.Variance/a.N+b.Variance/b.N, 2) /
		(math.Pow(a.Variance, 2)/(math.Pow(a.N, 2)*(a.N-1)) +
			math.Pow(b.Variance, 2)/(math.Pow(b.N, 2)*(b.N-1)))
	studentsT := distuv.StudentsT{Mu: 0, Sigma: 1, Nu: nu}
	tHyp := studentsT.Quantile(1 - (alpha / tails))
	d := math.Abs(a.Mean - b.Mean)
	s := math.Sqrt(a.Variance/a.N + b.Variance/b.N)
	tExp := d / s
	p := studentsT.CDF(-tExp) * tails
	cv := tHyp * s
	sd := math.Sqrt((a.Variance + b.Variance) / 2)
	cd := d / sd
	stdNormal := distuv.UnitNormal
	z := d / (sd * math.Sqrt(1/a.N+1/b.N))
	za := stdNormal.Quantile(1 - alpha/tails)
	beta := stdNormal.CDF(z-za) - stdNormal.CDF(-z-za)
	return Difference{
		Effect:        d,
		CriticalValue: cv,
		EffectSize:    cd,
		PValue:        p,
		Alpha:         alpha,
		Beta:          beta,
	}
}
Compare returns the statistical difference between the two summaries using a two-tailed Welch's
t-test. The confidence level must be in the range (0, 100).
package tinystat
import (
	"math"
	"gonum.org/v1/gonum/stat"
	"gonum.org/v1/gonum/stat/distuv"
)
type Summary struct {
	N        float64  
	Mean     float64  
	Variance float64  
}
func (s *Summary) StdDev() float64 {
	return math.Sqrt(s.Variance)
}
func (s *Summary) StdErr() float64 {
	return stat.StdErr(s.StdDev(), s.N)
}
func Summarize(data []float64) Summary {
	m, v := stat.MeanVariance(data, nil)
	return Summary{Mean: m, Variance: v, N: float64(len(data))}
}
type Difference struct {
	Effect float64
	EffectSize float64
	CriticalValue float64
	PValue float64
	Alpha float64
	Beta float64
}
func (d Difference) Significant() bool {
	return d.Effect > d.CriticalValue
}