|
NAG[g03dbc] NAG[nag_mv_discrim_mahaldist] - Mahalanobis squared distances, following g03dac (nag_mv_discrim)
|
|
Calling Sequence
g03dbc(equal, mode, gmean, gcov, isx, x, d, 'nvar'=nvar, 'ng'=ng, 'tdg'=tdg, 'nobs'=nobs, 'm'=m, 'tdx'=tdx, 'tdd'=tdd, 'fail'=fail)
nag_mv_discrim_mahaldist(. . .)
Parameters
|
equal - String;
|
|
|
On entry: indicates whether or not the within-group variance-covariance matrices are assumed to be equal and the pooled variance-covariance matrix used.
|
|
Constraint: "Nag_EqualCovar" or "Nag_NotEqualCovar". .
|
|
|
mode - String;
|
|
|
On entry: indicates whether distances from sample points are to be calculated or distances between the group means.
|
|
The distances between the sample points given in x and the group means are calculated.
|
|
The distances between the group means will be calculated.
|
|
Constraint: "Nag_SamplePoints" or "Nag_GroupMeans". .
|
|
|
gmean - Matrix(1..ng, 1..tdg, datatype=float[8], order=C_order);
|
|
|
|
gcov - Vector(1.., datatype=float[8]);
|
|
|
Note: the dimension, dim, of the array gcov must be at least .
|
|
If only the first elements are referenced.
|
|
if , the diagonal elements of ;
|
|
|
isx - Vector(1..m, datatype=integer[kernelopts('wordsize')/8]);
|
|
|
If , then isx is not referenced and may be set to the NULL pointer (Integer *)0.
|
|
|
x - Matrix(1..nobs, 1..tdx, datatype=float[8], order=C_order);
|
|
|
|
d - Matrix(1.., 1..tdd, datatype=float[8], order=C_order);
|
|
|
On exit: the squared distances.
|
|
|
'nvar'=nvar - integer; (optional)
|
|
|
Default value: the second dimension of the array gmean.
|
|
Constraint: . .
|
|
|
'ng'=ng - integer; (optional)
|
|
|
Default value: the first dimension of the array gmean and the second dimension of the array gmeanthe array d.
|
|
On entry: the number of groups, .
|
|
Constraint: . .
|
|
|
'tdg'=tdg - integer; (optional)
|
|
|
On entry: the second dimension of the array gmean as declared in the function from which nag_mv_discrim_mahaldist (g03dbc) is called.
|
|
Constraint: . .
|
|
|
'nobs'=nobs - integer; (optional)
|
|
|
Default value: the first dimension of the array x.
|
|
On entry: if the number of sample points in x for which distances are to be calculated.
|
|
If , nobs is not referenced.
|
|
Constraint: if , . .
|
|
|
'm'=m - integer; (optional)
|
|
|
Default value: the first dimension of the array isx and the second dimension of the array isxthe array x.
|
|
On entry: if the number of variables in the data array x.
|
|
If , then m is not referenced.
|
|
Constraint: if , . .
|
|
|
'tdx'=tdx - integer; (optional)
|
|
|
On entry: the second dimension of the array x as declared in the function from which nag_mv_discrim_mahaldist (g03dbc) is called.
|
|
Constraint: . .
|
|
|
'tdd'=tdd - integer; (optional)
|
|
|
On entry: the second dimension of the array d as declared in the function from which nag_mv_discrim_mahaldist (g03dbc) is called.
|
|
Constraint: . .
|
|
|
'fail'=fail - table; (optional)
|
|
|
The NAG error argument, see the documentation for NagError.
|
|
|
|
Description
|
|
|
Purpose
|
|
nag_mv_discrim_mahaldist (g03dbc) computes Mahalanobis squared distances for group or pooled variance-covariance matrices. It is intended for use after g03dac (nag_mv_discrim).
|
|
Error Indicators and Warnings
|
|
"NE_2_INT_ARG_ENUM_CONS"
On entry, while and . These arguments must satisfy when .
"NE_ALLOC_FAIL"
Dynamic memory allocation failed.
"NE_BAD_PARAM"
On entry, argument equal had an illegal value.
"NE_DIAG_0_COND"
A diagonal element of is zero when .
"NE_DIAG_0_J_COND"
A diagonal element of is zero for some , when .
"NE_INT_ARG_ENUM_CONS"
On entry, while . These arguments must satisfy when .
"NE_INT_ARG_LT"
On entry, nvar must not be less than 1: .
"NE_INTERNAL_ERROR"
An internal error has occurred in this function. Check the function call and any array sizes. If the call is correct then please consult NAG for assistance.
"NE_VAR_INCL_COND"
The number of variables, nvar in the analysis , while number of variables included in the analysis via array . Constraint: These two numbers must be the same when .
|
|
Accuracy
|
|
The accuracy will depend upon the accuracy of the input or matrices.
|
|
|
Examples
|
|
>
|
equal := "Nag_NotEqualCovar":
mode := "Nag_SamplePoints":
nvar := 2:
ng := 3:
tdg := 2:
nobs := 6:
m := 2:
tdx := 2:
tdd := 3:
gmean := Matrix([[1.0433, -0.6034166666666667], [2.00727, -0.20604], [2.70974, 1.5998]], datatype=float[8], order='C_order'):
gcov := Vector([-0.5099642881287538, -0.2797054723861329, -1.217327847040481, -0.3326727521153483, -0.3723518779712079, -1.987589395382754, -0.4603014906920608, -0.7041634974247671, 0.4737334252803499, 0.7451327720614629, -0.3251057349548681, -0.4275545007358186], datatype=float[8]):
isx := Vector([1, 1], datatype=integer[kernelopts('wordsize')/8]):
x := Matrix([[1.6292, -0.9163], [2.5572, 1.6094], [2.5649, -0.2231], [0.9555, -2.3026], [3.4012, -2.3026], [3.0204, -0.2231]], datatype=float[8], order='C_order'):
d := Matrix(6, 3, datatype=float[8], order='C_order'):
NAG:-g03dbc(equal, mode, gmean, gcov, isx, x, d, 'nvar' = nvar, 'ng' = ng, 'tdg' = tdg, 'nobs' = nobs, 'm' = m, 'tdx' = tdx, 'tdd' = tdd):
|
|
|
See Also
|
|
Aitchison J and Dunsmore I R (1975) Statistical Prediction Analysis Cambridge
Kendall M G and Stuart A (1976) The Advanced Theory of Statistics (Volume 3) (3rd Edition) Griffin
Krzanowski W J (1990) Principles of Multivariate Analysis Oxford University Press
g03 Chapter Introduction.
NAG Toolbox Overview.
NAG Web Site.
|
|