C# Class NSoft.NFramework.Numerics.Distributions.Continuous.Gamma

Implements the univariate Gamma distribution. For details about this distribution, see Wikipedia - Gamma distribution.

The Gamma distribution is parametrized by a shape and inverse scale parameter. When we want to specify a Gamma distribution which is a point distribution we set the shape parameter to be the location of the point distribution and the inverse scale as positive infinity. The distribution with shape and inverse scale both zero is undefined.

Random number generation for the Gamma distribution is based on the algorithm in: "A Simple Method for Generating Gamma Variables" - Marsaglia & Tsang ACM Transactions on Mathematical Software, Vol. 26, No. 3, September 2000, Pages 363?72.

The distribution will use the System.Random by default. Users can get/set the random number generator by using the RandomSource property.

The statistics classes will check all the incoming parameters whether they are in the allowed range. This might involve heavy computation. Optionally, by setting Control.CheckDistributionParameters to false, all parameter checks can be turned off.

Inheritance: IContinuousDistribution
显示文件 Open project: debop/NFramework

Public Methods

Method Description
CumulativeDistribution ( double x ) : double

확률 분포 계산을 위한 누적분포함수

Density ( double x ) : double

분포의 확률 밀도

Density ( double shape, double invScale, double x ) : double

감마분포의 확률밀도를 계산합니다.

DensityLn ( double x ) : double

분포의 로그 확률 밀도

DensityLn ( double shape, double invScale, double x ) : double

감마분포의 로그 확률밀도를 계산합니다.

Gamma ( double shape, double invScale, Func randomFactory = null ) : System
Sample ( ) : double

분포의 무작위 값을 제공합니다.

Sample ( Random rnd, double shape, double invScale ) : double

감마 분포의 샘플 데이타를 생성합니다.

Samples ( ) : IEnumerable

현 분포의 무작위 값을 열거합니다.

Samples ( Random rnd, double shape, double invScale ) : IEnumerable

감마 분포의 샘플 데이타를 생성합니다.

ToString ( ) : string
WithShapeInvScale ( double shape, double invScale ) : Gamma

Constructs a Gamma distribution from a shape and inverse scale parameter. The distribution will be initialized with the default System.Random random number generator.

WithShapeScale ( double shape, double scale ) : Gamma

Constructs a Gamma distribution from a shape and scale parameter. The distribution will be initialized with the default System.Random random number generator.

Private Methods

Method Description
AssertParameters ( double shape, double invScale ) : void
SampleGamma ( Random rnd, double shape, double invScale ) : double

Sampling implementation based on: "A Simple Method for Generating Gamma Variables" - Marsaglia & Tsang ACM Transactions on Mathematical Software, Vol. 26, No. 3, September 2000, Pages 363?72.

This method performs no parameter checks.

SetParameters ( double shape, double invScale ) : void

Method Details

CumulativeDistribution() public method

확률 분포 계산을 위한 누적분포함수
public CumulativeDistribution ( double x ) : double
x double The location at which to compute the cumulative distribution function.
return double

Density() public method

분포의 확률 밀도
public Density ( double x ) : double
x double
return double

Density() public static method

감마분포의 확률밀도를 계산합니다.
public static Density ( double shape, double invScale, double x ) : double
shape double
invScale double
x double
return double

DensityLn() public method

분포의 로그 확률 밀도
public DensityLn ( double x ) : double
x double
return double

DensityLn() public static method

감마분포의 로그 확률밀도를 계산합니다.
public static DensityLn ( double shape, double invScale, double x ) : double
shape double
invScale double
x double
return double

Gamma() public method

public Gamma ( double shape, double invScale, Func randomFactory = null ) : System
shape double
invScale double
randomFactory Func
return System

Sample() public method

분포의 무작위 값을 제공합니다.
public Sample ( ) : double
return double

Sample() public static method

감마 분포의 샘플 데이타를 생성합니다.
public static Sample ( Random rnd, double shape, double invScale ) : double
rnd System.Random
shape double
invScale double
return double

Samples() public method

현 분포의 무작위 값을 열거합니다.
public Samples ( ) : IEnumerable
return IEnumerable

Samples() public static method

감마 분포의 샘플 데이타를 생성합니다.
public static Samples ( Random rnd, double shape, double invScale ) : IEnumerable
rnd System.Random
shape double
invScale double
return IEnumerable

ToString() public method

public ToString ( ) : string
return string

WithShapeInvScale() public static method

Constructs a Gamma distribution from a shape and inverse scale parameter. The distribution will be initialized with the default System.Random random number generator.
public static WithShapeInvScale ( double shape, double invScale ) : Gamma
shape double The shape of the Gamma distribution.
invScale double The inverse scale of the Gamma distribution.
return Gamma

WithShapeScale() public static method

Constructs a Gamma distribution from a shape and scale parameter. The distribution will be initialized with the default System.Random random number generator.
public static WithShapeScale ( double shape, double scale ) : Gamma
shape double The shape of the Gamma distribution.
scale double The scale of the Gamma distribution.
return Gamma