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

g02bl computes means and standard deviations, sums of squares and cross-products about zero, and correlation-like coefficients for selected variables omitting completely any cases with a missing observation for any variable (either over all variables in the dataset or over only those variables in the selected subset).

Syntax

C#
public static void g02bl(
	int n,
	int m,
	double[,] x,
	int[] miss,
	double[] xmiss,
	int mistyp,
	int nvars,
	int[] kvar,
	double[] xbar,
	double[] std,
	double[,] sspz,
	double[,] rz,
	out int ncases,
	out int ifail
)
Visual Basic (Declaration)
Public Shared Sub g02bl ( _
	n As Integer, _
	m As Integer, _
	x As Double(,), _
	miss As Integer(), _
	xmiss As Double(), _
	mistyp As Integer, _
	nvars As Integer, _
	kvar As Integer(), _
	xbar As Double(), _
	std As Double(), _
	sspz As Double(,), _
	rz As Double(,), _
	<OutAttribute> ByRef ncases As Integer, _
	<OutAttribute> ByRef ifail As Integer _
)
Visual C++
public:
static void g02bl(
	int n, 
	int m, 
	array<double,2>^ x, 
	array<int>^ miss, 
	array<double>^ xmiss, 
	int mistyp, 
	int nvars, 
	array<int>^ kvar, 
	array<double>^ xbar, 
	array<double>^ std, 
	array<double,2>^ sspz, 
	array<double,2>^ rz, 
	[OutAttribute] int% ncases, 
	[OutAttribute] int% ifail
)
F#
static member g02bl : 
        n:int * 
        m:int * 
        x:float[,] * 
        miss:int[] * 
        xmiss:float[] * 
        mistyp:int * 
        nvars:int * 
        kvar:int[] * 
        xbar:float[] * 
        std:float[] * 
        sspz:float[,] * 
        rz:float[,] * 
        ncases:int byref * 
        ifail:int byref -> unit 

Parameters

n
Type: System..::.Int32
On entry: n, the number of observations or cases.
Constraint: n2.
m
Type: System..::.Int32
On entry: m, the number of variables.
Constraint: m2.
x
Type: array< System..::.Double ,2>[,](,)[,]
An array of size [ldx, m]
Note: ldx must satisfy the constraint: ldxn
On entry: x[i-1,j-1] must be set to xij, the value of the ith observation on the jth variable, for i=1,2,,n and j=1,2,,m.
miss
Type: array< System..::.Int32 >[]()[]
An array of size [m]
On entry: miss[j-1] must be set equal to 1 if a missing value, xmj, is to be specified for the jth variable in the array x, or set equal to 0 otherwise. Values of miss must be given for all m variables in the array x.
On exit: The array miss is overwritten by the method, and the information it contained on entry is lost.
xmiss
Type: array< System..::.Double >[]()[]
An array of size [m]
On entry: xmiss[j-1] must be set to the missing value, xmj, to be associated with the jth variable in the array x, for those variables for which missing values are specified by means of the array miss (see [Accuracy]).
On exit: The array xmiss is overwritten by the method, and the information it contained on entry is lost.
mistyp
Type: System..::.Int32
On entry: indicates the manner in which missing observations are to be treated.
mistyp=1
A case is excluded if it contains a missing value for any of the variables 1,2,,m.
mistyp=0
A case is excluded if it contains a missing value for any of the pm variables specified in the array kvar.
nvars
Type: System..::.Int32
On entry: p, the number of variables for which information is required.
Constraint: 2nvarsm.
kvar
Type: array< System..::.Int32 >[]()[]
An array of size [nvars]
On entry: kvar[j-1] must be set to the column number in x of the jth variable for which information is required, for j=1,2,,p.
Constraint: 1kvar[j-1]m, for j=1,2,,p.
xbar
Type: array< System..::.Double >[]()[]
An array of size [nvars]
On exit: the mean value, x-j, of the variable specified in kvar[j-1], for j=1,2,,p.
std
Type: array< System..::.Double >[]()[]
An array of size [nvars]
On exit: the standard deviation, sj, of the variable specified in kvar[j-1], for j=1,2,,p.
sspz
Type: array< System..::.Double ,2>[,](,)[,]
An array of size [ldsspz, nvars]
Note: ldsspz must satisfy the constraint: ldsspznvars
On exit: sspz[j-1,k-1] is the cross-product about zero, S~jk, for the variables specified in kvar[j-1] and kvar[k-1], for j,k=1,2,,p.
rz
Type: array< System..::.Double ,2>[,](,)[,]
An array of size [ldrz, nvars]
Note: ldrz must satisfy the constraint: ldrznvars
On exit: rz[j-1,k-1] is the correlation-like coefficient, R~jk, between the variables specified in kvar[j-1] and kvar[k-1], for j,k=1,2,,p.
ncases
Type: System..::.Int32 %
On exit: the number of cases actually used in the calculations (when cases involving missing values have been eliminated).
ifail
Type: System..::.Int32 %
On exit: ifail=0 unless the method detects an error (see [Error Indicators and Warnings]).

Description

The input data consist of n observations for each of m variables, given as an array
xij ,   i=1,2,,nn2 ​ and ​ j=1,2,,mm2 ,
where xij is the ith observation on the jth variable, together with the subset of these variables, v1,v2,,vp, for which information is required.
In addition, each of the m variables may optionally have associated with it a value which is to be considered as representing a missing observation for that variable; the missing value for the jth variable is denoted by xmj. Missing values need not be specified for all variables.
The missing values can be utilized in two slightly different ways, you can indicate which scheme is required.
Secondly, let wi=0 if observation i contains a missing value for any of those variables in the selected subset v1,v2,,vp for which missing values have been declared, i.e., if xij=xmj for any jj=v1,v2,,vp for which an xmj has been assigned (see also [Accuracy]); and wi=1 otherwise, for i=1,2,,n.
The quantities calculated are:
(a) Means:
x-j=i=1nwixij i=1nwi ,  j=v1,v2,,vp.
(b) Standard deviations:
Sj=i= 1nwi xij-x-j 2 i= 1nwi- 1 ,   j=v1,v2,,vp.
(c) Sums of squares and cross-products about zero:
S~jk=i=1nwixijxik,  j,k=v1,v2,,vp.
(d) Correlation-like coefficients:
R~jk=S~jkS~jjS~kk ,   j,k=v1,v2,,vp.
If S~jj or S~kk is zero, R~jk is set to zero.

References

Error Indicators and Warnings

Accuracy

g02bl does not use additional precision arithmetic for the accumulation of scalar products, so there may be a loss of significant figures for large n.
You are warned of the need to exercise extreme care in your selection of missing values. g02bl treats all values in the inclusive range 1±0.1x02be-2×xmj, where xmj is the missing value for variable j specified in xmiss.
You must therefore ensure that the missing value chosen for each variable is sufficiently different from all valid values for that variable so that none of the valid values fall within the range indicated above.

Further Comments

The time taken by g02bl depends on n and p, and the occurrence of missing values.
The method uses a two-pass algorithm.

Example

See Also