statistics

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2026 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package statistics contains deterministic statistical helpers used by behavioral and operational-reliability oracles.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Quantile

func Quantile(values []float64, probability float64) (float64, error)

Quantile computes the R-7 sample quantile used by common statistical packages. The input is copied so callers never observe a reorder.

Types

type Flakiness

type Flakiness struct {
	Samples       int64   `json:"samples"`
	Passes        int64   `json:"passes"`
	Failures      int64   `json:"failures"`
	Inconclusive  int64   `json:"inconclusive"`
	Disagreement  float64 `json:"disagreement"`
	FlakyDetected bool    `json:"flaky_detected"`
}

Flakiness describes whether repeated completed attempts disagree. It does not replace the verdict of any individual attempt.

func MeasureFlakiness

func MeasureFlakiness(verdicts []string) (Flakiness, error)

MeasureFlakiness counts stable public verdict labels. WARN is neither a pass nor target failure and therefore contributes to inconclusive samples.

type Interval

type Interval struct {
	SampleCount int64   `json:"sample_count"`
	Estimate    float64 `json:"estimate"`
	LowerBound  float64 `json:"lower_bound"`
	UpperBound  float64 `json:"upper_bound"`
	Method      string  `json:"method"`
}

Interval is a bounded estimate over [0,1].

func Wilson

func Wilson(successes, samples int64, z float64) (Interval, error)

Wilson returns a two-sided Wilson score interval. z=1.959963984540054 is the conventional 95% interval. Zero samples are rejected rather than being represented as an apparently meaningful 0% estimate.

Jump to

Keyboard shortcuts

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