MCPcopy Create free account
hub / github.com/github/gh-aw / SampleVariance

Method SampleVariance

pkg/stats/statvar.go:92–97  ·  view source on GitHub ↗

SampleVariance returns the sample variance with Bessel's correction (divides by N−1), giving an unbiased estimator when the observations are a random sample from a larger population. Returns 0 when fewer than two observations are present.

()

Source from the content-addressed store, hash-verified

90// sample from a larger population. Returns 0 when fewer than two observations
91// are present.
92func (s *StatVar) SampleVariance() float64 {
93 if s.count < 2 {
94 return 0
95 }
96 return s.m2 / float64(s.count-1)
97}
98
99// SampleStdDev returns the sample standard deviation with Bessel's correction
100// (sqrt of SampleVariance).

Calls

no outgoing calls