bootstrap

package module
v0.0.0-...-bfa6657 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2017 License: MIT Imports: 3 Imported by: 0

README

bootstrap CircleCI GoDoc Coverage Status Go Report Card

This Go package provides a simple framework to bootstrap confidence intervals with bootstrap resampling.

License

MIT

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Aggregator

type Aggregator interface {
	Aggregate(values []float64) float64
}

Aggregator aggregates a slice of floats.

type AverageAggregator

type AverageAggregator struct{}

AverageAggregator generates an average.

func NewAverageAggregator

func NewAverageAggregator() AverageAggregator

NewAverageAggregator returns a new AverageAggregator.

func (AverageAggregator) Aggregate

func (a AverageAggregator) Aggregate(values []float64) float64

Aggregate returns the average of values.

type BasicResampler

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

BasicResampler is a basic bootstrap resampler.

func NewBasicResampler

func NewBasicResampler(aggregator Aggregator, iterations int) *BasicResampler

NewBasicResampler returns a BasicResampler that aggregates values using aggregator.

func (*BasicResampler) Quantile

func (r *BasicResampler) Quantile(q float64) float64

Quantile returns the q quantile of resampled aggregate values. Resample must be called before this method or NaN is returned.

func (*BasicResampler) Resample

func (r *BasicResampler) Resample(values []float64)

Resample resamples from values for the given number of iterations and saves the aggregate values.

func (*BasicResampler) Reset

func (r *BasicResampler) Reset()

Reset resets any sampled state.

type PresampledResampler

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

PresampledResampler is a bootstrap resampler that precomputes sample indexes on creation.

func NewPresampledResampler

func NewPresampledResampler(aggregator Aggregator, iterations int, numValues int) *PresampledResampler

NewPresampledResampler returns a PresampledResampler that aggregates values using aggregator.

func (*PresampledResampler) Quantile

func (r *PresampledResampler) Quantile(q float64) float64

Quantile returns the q quantile of resampled aggregate values. Resample must be called before this method or NaN is returned.

func (*PresampledResampler) Resample

func (r *PresampledResampler) Resample(values []float64)

Resample resamples from values for the given number of iterations and saves the aggregate values.

func (*PresampledResampler) Reset

func (r *PresampledResampler) Reset()

Reset resets any sampled state.

type QuantileAggregator

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

QuantileAggregator generates a quantile.

func NewQuantileAggregator

func NewQuantileAggregator(quantile float64) QuantileAggregator

NewQuantileAggregator returns a new QuantileAggregator with the given quantile.

func (QuantileAggregator) Aggregate

func (a QuantileAggregator) Aggregate(values []float64) float64

Aggregate returns the a.quantile quantile of values.

type Resampler

type Resampler interface {
	Resample(values []float64)
	Quantile(float64) float64
	Reset()
}

Resampler resamples floats with an Aggregator.

type SumAggregator

type SumAggregator struct{}

SumAggregator generates a sum.

func NewSumAggregator

func NewSumAggregator() SumAggregator

NewSumAggregator returns a new SumAggregator.

func (SumAggregator) Aggregate

func (a SumAggregator) Aggregate(values []float64) float64

Aggregate returns the sum of values.

Jump to

Keyboard shortcuts

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