g05se generates a vector of pseudorandom numbers taken from a Dirichlet distribution.

Syntax

C#
public static void g05se(
	int n,
	int m,
	double[] a,
	G05..::..G05State g05state,
	double[,] x,
	out int ifail
)
Visual Basic
Public Shared Sub g05se ( _
	n As Integer, _
	m As Integer, _
	a As Double(), _
	g05state As G05..::..G05State, _
	x As Double(,), _
	<OutAttribute> ByRef ifail As Integer _
)
Visual C++
public:
static void g05se(
	int n, 
	int m, 
	array<double>^ a, 
	G05..::..G05State^ g05state, 
	array<double,2>^ x, 
	[OutAttribute] int% ifail
)
F#
static member g05se : 
        n : int * 
        m : int * 
        a : float[] * 
        g05state : G05..::..G05State * 
        x : float[,] * 
        ifail : int byref -> unit 

Parameters

n
Type: System..::..Int32
On entry: n, the number of pseudorandom numbers to be generated.
Constraint: n0.
m
Type: System..::..Int32
On entry: m, the number of dimensions of the distribution.
Constraint: m>0.
a
Type: array<System..::..Double>[]()[][]
An array of size [m]
On entry: the parameter vector for the distribution.
Constraint: a[i-1]>0.0, for i=1,2,,m.
g05state
Type: NagLibrary..::..G05..::..G05State
An Object of type G05.G05State.
x
Type: array<System..::..Double,2>[,](,)[,][,]
An array of size [dim1, _tdx]
Note: dim1 must satisfy the constraint: dim1n
On exit: the n pseudorandom numbers from the specified Dirichlet distribution, with x[i-1,j-1] holding the jth dimension for the ith variate.
ifail
Type: System..::..Int32%
On exit: ifail=0 unless the method detects an error or a warning has been flagged (see [Error Indicators and Warnings]).

Description

The distribution has PDF (probability density function)
fx=1Bα i=1 m xiαi-1andBα= i=1 m ΓαiΓ i=1 m αi
where x=x1,x2,,xm is a vector of dimension m, such that xi>0 for all i and i=1 m xi=1.
g05se generates a draw from a Dirichlet distribution by first drawing m independent samples, yigammaαi,1, i.e., independent draws from a gamma distribution with parameters αi>0 and one, and then setting xi=yi/ j=1 m yj.
One of the initialization methods (G05KFF not in this release) (for a repeatable sequence if computed sequentially) or (G05KGF not in this release) (for a non-repeatable sequence) must be called prior to the first call to g05se.

References

Dagpunar J (1988) Principles of Random Variate Generation Oxford University Press
Hastings N A J and Peacock J B (1975) Statistical Distributions Butterworth

Error Indicators and Warnings

Errors or warnings detected by the method:
Some error messages may refer to parameters that are dropped from this interface (LDX) In these cases, an error in another parameter has usually caused an incorrect value to be inferred.
ifail=1
On entry, n<0.
ifail=2
On entry, m<1.
ifail=3
On entry, at least one a[i-1]0.0.
ifail=4
On entry,state vector was not initialized or has been corrupted.
ifail=6
On entry, ldx<n.
ifail=-9000
An error occured, see message report.
ifail=-6000
Invalid Parameters value
ifail=-4000
Invalid dimension for array value
ifail=-8000
Negative dimension for array value
ifail=-6000
Invalid Parameters value

Accuracy

Not applicable.

Parallelism and Performance

None.

Further Comments

None.

Example

See Also