g05ry Method
関数リスト一覧   NagLibrary Namespaceへ  ライブラリイントロダクション  本ヘルプドキュメントのchm形式版

g05ry sets up a reference vector and generates an array of pseudorandom numbers from a multivariate Student's t distribution with ν degrees of freedom, mean vector a and covariance matrix ν ν-2 C .


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


Type: System..::.Int32
On entry: a code for selecting the operation to be performed by the method.
Set up reference vector only.
Generate variates using reference vector set up in a prior call to g05ry.
Set up reference vector and generate two-way table.
Constraint: mode=0, 1 or 2.
Type: System..::.Int32
On entry: n, the number of random variates required.
Constraint: n0.
Type: System..::.Int32
On entry: ν, the number of degrees of freedom of the distribution.
Constraint: df3 .
Type: System..::.Int32
On entry: m, the number of dimensions of the distribution.
Constraint: m>0.
Type: array< System..::.Double >[]()[]
An array of size [m]
On entry: a, the vector of means of the distribution.
Type: array< System..::.Double ,2>[,](,)[,]
An array of size [ldc, m]
Note: ldc must satisfy the constraint: ldcm
On entry: matrix which, along with df, defines the covariance of the distribution. Only the upper triangle need be set.
Constraint: c must be positive semi-definite to machine precision
Type: array< System..::.Double >[]()[]
An array of size [lr]
Note: lr must satisfy the constraint: lrm×m+1+2
On entry: if mode=1, the reference vector as set up by g05ry in a previous call with mode=0 or 2.
On exit: if mode=0 or 2, the reference vector that can be used in subsequent calls to g05ry with mode=1.
Type: NagLibrary..::.G05..::.G05State
An object of type G05.G05State.
Type: array< System..::.Double ,2>[,](,)[,]
An array of size [ldx, m]
Note: ldx must satisfy the constraint: ldxn
On exit: the array of pseudorandom multivariate Student's t vectors generated by the method, with x[i-1,j-1] holding the jth dimension for the ith variate.
Type: System..::.Int32 %
On exit: ifail=0 unless the method detects an error (see [Error Indicators and Warnings]).



Error Indicators and Warnings


Further Comments

The time taken by g05ry is of order nm3.
It is recommended that the diagonal elements of C should not differ too widely in order of magnitude. This may be achieved by scaling the variables if necessary. The actual matrix decomposed is C+E=LLT, where E is a diagonal matrix with small positive diagonal elements. This ensures that, even when C is singular, or nearly singular, the Cholesky factor L corresponds to a positive-definite covariance matrix that agrees with C within machine precision.


This example prints ten pseudorandom observations from a multivariate Student's t-distribution with ten degrees of freedom, means vector
1.0 2.0 -3.0 0.0
c matrix
1.69 0.39 -1.86 0.07 0.39 98.01 -7.07 -0.71 -1.86 -7.07 11.56 0.03 0.07 -0.71 0.03 0.01 ,
generated by g05ry. All ten observations are generated by a single call to g05ry with mode=2. The random number generator is initialized by the state constructor (for a repeatable sequence).

Example program (C#): g05rye.cs

Example program results: g05rye.r

See Also