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

g05th generates a vector of pseudorandom integers from the discrete negative binomial distribution with parameter m and probability p of success at a trial.


public static void g05th(
	int mode,
	int n,
	int m,
	double p,
	double[] r,
	G05..::.G05State g05state,
	int[] x,
	out int ifail
Visual Basic (Declaration)
Public Shared Sub g05th ( _
	mode As Integer, _
	n As Integer, _
	m As Integer, _
	p As Double, _
	r As Double(), _
	g05state As G05..::.G05State, _
	x As Integer(), _
	<OutAttribute> ByRef ifail As Integer _
Visual C++
static void g05th(
	int mode, 
	int n, 
	int m, 
	double p, 
	array<double>^ r, 
	G05..::.G05State^ g05state, 
	array<int>^ x, 
	[OutAttribute] int% ifail
static member g05th : 
        mode:int * 
        n:int * 
        m:int * 
        p:float * 
        r:float[] * 
        g05state:G05..::.G05State * 
        x:int[] * 
        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 g05th.
Set up reference vector and generate variates.
Generate variates without using the reference vector.
Constraint: mode=0, 1, 2 or 3.
Type: System..::.Int32
On entry: n, the number of pseudorandom numbers to be generated.
Constraint: n0.
Type: System..::.Int32
On entry: m, the number of failures of the distribution.
Constraint: m0.
Type: System..::.Double
On entry: p, the parameter of the negative binomial distribution representing the probability of success at a single trial.
Constraint: 0.0p<1.0.
Type: array< System..::.Double >[]()[]
An array of size [lr]
Note: lr must satisfy the constraint:
  • if mode=0 or 2,
    lr> int m×p+7.15 × m×p+ 20.15×p 1-p +8.5 - max 0,int m× p-7.15 × m×p 1-p +9 ;
  • if mode=1, lr must remain unchanged from the previous call to g05th.
On entry: if mode=1, the reference vector from the previous call to g05th.
If mode=3, r is not referenced by g05th.
On exit: the reference vector.
Type: NagLibrary..::.G05..::.G05State
An object of type G05.G05State.
Type: array< System..::.Int32 >[]()[]
An array of size [n]
On exit: the n pseudorandom numbers from the specified negative binomial distribution.
Type: System..::.Int32 %
On exit: ifail=0 unless the method detects an error (see [Error Indicators and Warnings]).


g05th generates n integers xi from a discrete negative binomial distribution, where the probability of xi=I (I successes before m failures) is
Pxi=I= m+I-1! I!m-1! ×pI×1-pm,  I=0,1,.
The variates can be generated with or without using a search table and index. If a search table is used then it is stored with the index in a reference vector and subsequent calls to g05th with the same parameter value can then use this reference vector to generate further variates.


Error Indicators and Warnings


Further Comments


See Also