g02hm computes a robust estimate of the covariance matrix for user-supplied weight functions. The derivatives of the weight functions are not required.
public static void g02hm( G02..::.G02HM_UCV ucv, indm, n, m, [,] x,  cov,  a,  wt,  theta, bl, bd, maxit, nitmon, tol, out nit, out ifail )
|Visual Basic (Declaration)|
Public Shared Sub g02hm ( _ ucv As G02..::.G02HM_UCV, _ indm As , _ n As , _ m As , _ x As (,), _ cov As (), _ a As (), _ wt As (), _ theta As (), _ bl As , _ bd As , _ maxit As , _ nitmon As , _ tol As , _ < > ByRef nit As , _ < > ByRef ifail As _ )
public: static void g02hm( G02..::.G02HM_UCV^ ucv, indm, n, m, array< ,2>^ x, array< >^ cov, array< >^ a, array< >^ wt, array< >^ theta, bl, bd, maxit, nitmon, tol, [ ] % nit, [ ] % ifail )
static member g02hm : ucv:G02..::.G02HM_UCV * indm: * n: * m: * x: [,] * cov:  * a:  * wt:  * theta:  * bl: * bd: * maxit: * nitmon: * tol: * nit: byref * ifail: byref -> unit
- Type: NagLibrary..::.G02..::.G02HM_UCV
ucv must return the values of the functions and for a given value of its argument.
A delegate of type G02HM_UCV.
On entry: indicates which form of the function will be used.
On entry: , the number of observations.Constraint: .
On entry: , the number of columns of the matrix , i.e., number of independent variables.Constraint: .
- Type: array<
,2>[,](,)[,]An array of size [ldx, m]Note: ldx must satisfy the constraint:On entry: must contain the th observation on the th variable, for and .
- Type: array<
>()An array of size On exit: a robust estimate of the covariance matrix, . The upper triangular part of the matrix is stored packed by columns (lower triangular stored by rows), that is is returned in , .
- Type: array<
>()An array of size On entry: an initial estimate of the lower triangular real matrix . Only the lower triangular elements must be given and these should be stored row-wise in the array.The diagonal elements must be , and in practice will usually be . If the magnitudes of the columns of are of the same order, the identity matrix will often provide a suitable initial value for . If the columns of are of different magnitudes, the diagonal elements of the initial value of should be approximately inversely proportional to the magnitude of the columns of .Constraint: , for .On exit: the lower triangular elements of the inverse of the matrix , stored row-wise.
- Type: array<
>()An array of size [n]On exit: contains the weights, , for .
- Type: array<
>()An array of size [m]On entry: an initial estimate of the location parameter, , for .In many cases an initial estimate of , for , will be adequate. Alternatively medians may be used as given by (g07da not in this release).On exit: contains the robust estimate of the location parameter, , for .
On entry: the magnitude of the bound for the off-diagonal elements of , .Suggested value: .Constraint: .
On entry: the magnitude of the bound for the diagonal elements of , .Suggested value: .Constraint: .
On entry: the maximum number of iterations that will be used during the calculation of .Suggested value: .Constraint: .
On entry: the relative precision for the final estimate of the covariance matrix. Iteration will stop when maximum (see [Accuracy]) is less than tol.Constraint: .
On exit: the number of iterations performed.
On exit: unless the method detects an error (see [Error Indicators and Warnings]).
For a set of observations on variables in a matrix , a robust estimate of the covariance matrix, , and a robust estimate of location, , are given by
where is a correction factor and is a lower triangular matrix found as the solution to the following equations.
|where||is a vector of length containing the elements of the th row of ,|
|is a vector of length ,|
|is the identity matrix and is the zero matrix.|
|and||and are suitable functions.|
g02hm covers two situations:
|(i)||for all ,|
The robust covariance matrix may be calculated from a weighted sum of squares and cross-products matrix about using weights . In case (i) a divisor of is used and in case (ii) a divisor of is used. If , then the robust covariance matrix can be calculated by scaling each row of by and calculating an unweighted covariance matrix about .
In order to make the estimate asymptotically unbiased under a Normal model a correction factor, , is needed. The value of the correction factor will depend on the functions employed (see Huber (1981) and Marazzi (1987)).
g02hm finds using the iterative procedure as given by Huber; see Huber (1981).
where , for is a lower triangular matrix such that
- , for
The value of may be chosen so that is unbiased if the observations are from a given distribution.
Errors or warnings detected by the method:
Some error messages may refer to parameters that are dropped from this interface (ruser, ldx, wk, iuser) In these cases, an error in another parameter has usually caused an incorrect value to be inferred.
A column of x has a constant value.
The method has failed to converge in maxit iterations.
Either the sum or the sum is zero. This may be caused by the functions or being too strict for the current estimate of (or ). You should either try a larger initial estimate of or make the and functions less strict.
The existence of will depend upon the function (see Marazzi (1987)); also if is not of full rank a value of will not be found. If the columns of are almost linearly related, then convergence will be slow.
If derivatives of the and functions are available then the method used in g02hl will usually give much faster convergence.
A sample of observations on three variables is read in along with initial values for and and parameter values for the and functions, and . The covariance matrix computed by g02hm is printed along with the robust estimate of .
ucv computes the Huber's weight functions: