distuvx

package module
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2022 License: MIT Imports: 3 Imported by: 1

README

distuvx

Provides univariate random distribution types not found in gonum/stat/distuv

GoDoc Go Report Card License Badge

Overview

distuvx provides univariate random distribution types that are not currently found in gonum/stat/distuv.

Contributing

Contributions are welcome! To contribute please:

  1. Fork the repository
  2. Create a feature branch
  3. Code
  4. Submit a pull request
Testing

Prior to submitting a pull request, please run:

$ make check

To update and view the test coverage report:

$ make cover

License

distuvx is released under the MIT license. Please see the LICENSE file for more information.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Beta4

type Beta4 struct {
	Min      float64
	Max      float64
	BetaDist distuv.Beta
}

Beta4 implements the four-parameter Beta distribution, which is like the two-parameter Beta distribution with ranges between the min and max instead of between 0 and 1.

func NewBeta4

func NewBeta4(alpha, beta, min, max float64, src rand.Source) Beta4

NewBeta4 constructs a new four-parameter Beta distribution.

func (Beta4) CDF

func (b Beta4) CDF(y float64) float64

CDF computes the value of the cumulative distribution function at y.

func (Beta4) Mean

func (b Beta4) Mean() float64

Mean returns the mean of the Beta4 probability distribution.

func (Beta4) Mode

func (b Beta4) Mode() float64

Mode returns the mode of the Beta4 distribution.

Mode returns NaN if both parameters are less than or equal to 1 as a special case, 0 if only Alpha <= 1 and 1 if only Beta <= 1.

func (Beta4) NumParameters

func (b Beta4) NumParameters() int

NumParameters returns the number of parameters in the Beta4 distribution.

func (Beta4) Prob

func (b Beta4) Prob(y float64) float64

Prob computes the value of the probability density function at y.

func (Beta4) Rand

func (b Beta4) Rand() float64

Rand implements the Rander interface for the Beta4 distribution.

func (Beta4) StdDev

func (b Beta4) StdDev() float64

StdDev returns the standard deviation of the Beta4 probability distribution.

func (Beta4) Variance

func (b Beta4) Variance() float64

Variance returns the variance of the Beta4 probability distribution.

type Fixed added in v0.2.0

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

Fixed is a fixed value regardless of the period.

func NewBeta4One added in v0.5.0

func NewBeta4One(alpha, beta, min, max float64, src rand.Source) Fixed

NewBeta4One creates a new four-parameter Beta distribution one time. Thereafter, the same fixed value is always returned.

func NewFixed added in v0.2.0

func NewFixed(num float64) Fixed

NewFixed creates a new fixed number.

func NewPERTOne added in v0.2.0

func NewPERTOne(a, b, c float64, src rand.Source) Fixed

NewPERTOne create a new PERT distribution one time. Thereafter, the same fixed value is always returned.

func NewTriangleOne added in v0.2.0

func NewTriangleOne(a, b, c float64, src rand.Source) Fixed

NewTriangleOne create a new triangle distribution one time with lower linit a, upper limit b, and mode c. Thereafter, the same fixed value is always returned.

func (Fixed) Rand added in v0.2.0

func (f Fixed) Rand() float64

Rand implements the Rander interface for Fixed.

type PERT

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

PERT represents a PERT distribution, which is a four parameter Beta distribution described by the parameters min, max, and mode, as well as the requirement that the mean = (max + 4 * mod + min) / 6. (https://en.wikipedia.org/wiki/PERT_distribution)

func NewPERT

func NewPERT(min, max, mode float64, src rand.Source) PERT

NewPERT constructs a new PERT distribution using the given min, max, and mode. Constraints are min < max and min ≤ mode ≤ max.

func (PERT) CDF

func (p PERT) CDF(y float64) float64

CDF computes the value of the cumulative distribution function at y.

func (PERT) Mean

func (p PERT) Mean() float64

Mean returns the mean of the PERT probability distribution.

func (PERT) Mode

func (p PERT) Mode() float64

Mode returns the mode of the PERT probability distribution.

func (PERT) NumParameters

func (p PERT) NumParameters() int

NumParameters returns the number of parameters in the PERT distribution.

func (PERT) Prob

func (p PERT) Prob(y float64) float64

Prob computes the value of the probability density function at y.

func (PERT) Rand

func (p PERT) Rand() float64

Rand implements the Rander interface for the PERT distribution.

func (PERT) StdDev added in v0.5.0

func (p PERT) StdDev() float64

StdDev returns the standard deviation of the PERT distribution.

func (PERT) Variance added in v0.5.0

func (p PERT) Variance() float64

Variance returns the variance of the PERT probability distribution.

Jump to

Keyboard shortcuts

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