stats

package
v0.3.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 10, 2026 License: MIT Imports: 2 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LinearRegression

func LinearRegression(xs, ys []float64) (slope, intercept, rSquared float64)

LinearRegression computes slope, intercept, and coefficient of determination (R²) using ordinary least squares.

Types

type RingBuffer

type RingBuffer[T any] struct {
	// contains filtered or unexported fields
}

RingBuffer is a fixed-capacity circular buffer with concurrent reads.

func NewRingBuffer

func NewRingBuffer[T any](capacity int) *RingBuffer[T]

func (*RingBuffer[T]) Add

func (rb *RingBuffer[T]) Add(item T)

func (*RingBuffer[T]) Len

func (rb *RingBuffer[T]) Len() int

func (*RingBuffer[T]) Slice

func (rb *RingBuffer[T]) Slice() []T

type Welford

type Welford struct {
	// contains filtered or unexported fields
}

Welford computes running mean, variance, and standard deviation in O(1) per update.

func NewWelford

func NewWelford() *Welford

func (*Welford) Add

func (w *Welford) Add(value float64)

func (*Welford) Count

func (w *Welford) Count() uint64

func (*Welford) IsAnomaly

func (w *Welford) IsAnomaly(value float64, nSigma float64) bool

IsAnomaly returns true if value lies more than nSigma standard deviations from the mean.

func (*Welford) Mean

func (w *Welford) Mean() float64

func (*Welford) StdDev

func (w *Welford) StdDev() float64

func (*Welford) Variance

func (w *Welford) Variance() float64

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL