approx

package module
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Jan 5, 2023 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Cdf

func Cdf(f func(float64) float64, lb float64, n int) func(float64) float64

Cdf returns a wrapper function of gonum/integrate/quad.Fixed. The returned function approximates cumulative probabilities of the probability density function.

f is the target pdf. Some pdf parameter settings where pdfs return Inf are NOT allowed (fail to approximate cumulative probabilities).

lb is lower bound of the variables given by the function. -Inf is accepted.

func Quantile

func Quantile(cdf func(float64) float64, p, a, b, eps float64) (float64, error)

Quantile approxiamtes the value of x that satisfies F(X <= x) = p.

cdf is a cumulative distribution function F(x).

p is the probability.

a, b are the lower & upper bounds of the search space (a < b).

eps controls the presicion of the approximation. The smaller gives higher presicion and longer computation. eps can be 1e-15 at minimum for formal CDF (eps smaller than 1e-15 will causes panic) Precision is not ensured depending on types of cdf. Especially, larger eps (such as 1e-10) is recommended for numerical CDF.

Types

This section is empty.

Jump to

Keyboard shortcuts

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