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

g05pz generates a random two-way table.


public static void g05pz(
	int mode,
	int nrow,
	int ncol,
	int[] totr,
	int[] totc,
	double[] r,
	G05..::.G05State g05state,
	int[,] x,
	out int ifail
Visual Basic (Declaration)
Public Shared Sub g05pz ( _
	mode As Integer, _
	nrow As Integer, _
	ncol As Integer, _
	totr As Integer(), _
	totc As Integer(), _
	r As Double(), _
	g05state As G05..::.G05State, _
	x As Integer(,), _
	<OutAttribute> ByRef ifail As Integer _
Visual C++
static void g05pz(
	int mode, 
	int nrow, 
	int ncol, 
	array<int>^ totr, 
	array<int>^ totc, 
	array<double>^ r, 
	G05..::.G05State^ g05state, 
	array<int,2>^ x, 
	[OutAttribute] int% ifail
static member g05pz : 
        mode:int * 
        nrow:int * 
        ncol:int * 
        totr:int[] * 
        totc:int[] * 
        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 two-way table using reference vector set up in a prior call to g05pz.
Set up reference vector and generate two-way table.
Constraint: mode=0, 1 or 2.
Type: System..::.Int32
On entry: m, the number of rows in the table.
Constraint: nrow2.
Type: System..::.Int32
On entry: n, the number of columns in the table.
Constraint: ncol2.
Type: array< System..::.Int32 >[]()[]
An array of size [nrow]
On entry: the m row totals, Ri, for i=1,2,,m.
  • totr[i-1]0, for i=1,2,,m;
  • i=1mtotr[i-1]=j=1ntotc[j-1];
  • i totr[i-1]>0, for i=1,2,,nrow.
Type: array< System..::.Int32 >[]()[]
An array of size [ncol]
On entry: the n column totals, Cj, for j=1,2,,n.
  • totc[j-1]0, for j=1,2,,n;
  • j=1ntotc[j-1]=i=1mtotr[i-1].
Type: array< System..::.Double >[]()[]
An array of size [lr]
Note: lr must satisfy the constraint: lri=1mtotr[i-1]+5 lri=1mtotr[i-1]+5
On entry: if mode=1, the reference vector from the previous call to g05pz.
On exit: the reference vector.
Type: NagLibrary..::.G05..::.G05State
An object of type G05.G05State.
Type: array< System..::.Int32 ,2>[,](,)[,]
An array of size [ldx, ncol]
Note: ldx must satisfy the constraint: ldxnrow
On exit: if mode=1 or 2, a pseudorandom two-way m by n table, X, with element x[i-1,j-1] containing the i,jth entry in the table such that i=1 m x[i-1,j-1]=totc[j-1] and j=1 n x[i-1,j-1]=totr[i-1]
Type: System..::.Int32 %
On exit: ifail=0 unless the method detects an error (see [Error Indicators and Warnings]).


Given m row totals Ri and n column totals Cj (with i=1m Ri=j=1n Cj=T, say), g05pz will generate a pseudorandom two-way table of integers such that the row and column totals are satisfied.
The method used is based on that described by Patefield (1981) which is most efficient when T is large relative to the number of table entries m×n (i.e., T>2mn). Entries are generated one row at a time and one entry at a time within a row. Each entry is generated using the conditional probability distribution for that entry given the entries in the previous rows and the previous entries in the same row.
A reference vector is used to store computed values that can be reused in the generation of new tables with the same row and column totals. g05pz can be called to simply set up the reference vector, or to generate a two-way table using a reference vector set up in a previous call, or it can combine both functions in a single call.


Error Indicators and Warnings


Further Comments


See Also