quantilr

package
v0.0.0-...-7636381 Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2021 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	NoWeightsError             error = errors.New("Encountered a decile with no weights (counts or frequencies were all 0)")
	NonStochasticWeights       error = errors.New("weights for decile provided did not (or could not scaled to) sum to 1")
	ValueNotFound              error = errors.New("the value provided does not appear in the calculated decile range")
	WarnDecilesNotDeduplicated error = errors.New("The decile pairs provided were not deduplicated - this was performed automatically and then resorted")
	WarnDecilesNotSorted       error = errors.New("The decile pairs provided were not deduplicated - this was performed automatically")
)

Functions

func Quantiles

func Quantiles(c CountedPairs, probs []float64) (quantiles, pointValues []float64)

Types

type CountedPairs

type CountedPairs interface {
	GetValues() []float64
	GetCounts() []float64
	Len() int
	Less(i, j int) bool
	Swap(i, j int)
}

type DecilePair

type DecilePair struct {
	Decile int8
	Weight float64
}

type Deciles

type Deciles struct {
	Pairs []DecilePair
	// contains filtered or unexported fields
}

func NewDeciles

func NewDeciles(c CountedPairs, deduplicateDeciles bool) (Deciles, error)

func (Deciles) Len

func (d Deciles) Len() int

func (Deciles) Less

func (d Deciles) Less(i, j int) bool

func (Deciles) LookupValue

func (d Deciles) LookupValue(v float64) (decileOfValue int8, errorWarning error)

func (Deciles) ScaleToOne

func (d Deciles) ScaleToOne() error

func (*Deciles) Sort

func (d *Deciles) Sort()

func (Deciles) Swap

func (d Deciles) Swap(i, j int)

Jump to

Keyboard shortcuts

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