statistics

package
v0.21.0 Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultBootstrapIterations = 10000

DefaultBootstrapIterations is the number of bootstrap resamples.

Variables

This section is empty.

Functions

func IsSignificant

func IsSignificant(ci ConfidenceInterval) bool

IsSignificant returns true if the confidence interval does not contain zero, indicating statistical significance at the given confidence level.

func NormalizedGain

func NormalizedGain(pre, post float64) float64

NormalizedGain computes Hake's normalized gain (1998):

g = (post - pre) / (1 - pre)

This controls for ceiling effects — a gain from 0.9→0.95 is harder than 0.1→0.15. Returns 0 if pre >= 1.0 (already at ceiling) or pre == post (no change). Returns 1.0 if post >= 1.0 (reached maximum).

Types

type ConfidenceInterval

type ConfidenceInterval struct {
	Lower           float64 `json:"lower"`
	Upper           float64 `json:"upper"`
	Mean            float64 `json:"mean"`
	ConfidenceLevel float64 `json:"confidence_level"`
	NumBootstraps   int     `json:"num_bootstraps"`
}

ConfidenceInterval holds the result of a bootstrap confidence interval computation.

func BootstrapCI

func BootstrapCI(scores []float64, confidenceLevel float64) ConfidenceInterval

BootstrapCI computes a bootstrap confidence interval over the given scores using the percentile method. confidenceLevel should be in (0, 1), e.g. 0.95. Returns a zero-value ConfidenceInterval when fewer than 2 data points exist.

func BootstrapCIWithSeed

func BootstrapCIWithSeed(scores []float64, confidenceLevel float64, seed int64) ConfidenceInterval

BootstrapCIWithSeed is like BootstrapCI but accepts a seed for reproducibility. A negative seed uses a non-deterministic source.

Jump to

Keyboard shortcuts

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