truncated

package
v0.1.13 Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2021 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package truncted provides a probability distribution truncater.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type TruncatableDistribution

type TruncatableDistribution interface {
	distuv.Rander
	distuv.Quantiler

	CDF(x float64) float64
}

type Truncated

type Truncated struct {
	Distribution TruncatableDistribution

	Min float64
	Max float64

	Src rand.Source
	// contains filtered or unexported fields
}

Truncated transforms a distribution by truncating the output between minimum and maximum values.

Truncated follows the method described in https://www.jstatsoft.org/article/view/v016c02/v16c02.pdf

func New

func New(dist TruncatableDistribution, min, max float64, src rand.Source) (t Truncated)

New constructs a new truncted distribution with a minimum and maximum range.

func (Truncated) CDF

func (t Truncated) CDF(x float64) float64

CDF computes the value of the cumulative density function at x.

func (Truncated) Quantile

func (t Truncated) Quantile(p float64) float64

Quantile returns the inverse of the cumulative probability distribution.

func (Truncated) Rand

func (t Truncated) Rand() float64

Rand returns a random sample drawn from the embedded distribution truncated to minimum and maximum values.

Jump to

Keyboard shortcuts

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