g02hl calculates a robust estimate of the covariance matrix for user-supplied weight functions and their derivatives.
Public Shared Sub g02hl ( _ ucv As G02..::..G02HL_UCV, _ indm As Integer, _ n As Integer, _ m As Integer, _ x As Double(,), _ cov As Double(), _ a As Double(), _ wt As Double(), _ theta As Double(), _ bl As Double, _ bd As Double, _ maxit As Integer, _ nitmon As Integer, _ tol As Double, _ <OutAttribute> ByRef nit As Integer, _ <OutAttribute> ByRef ifail As Integer _ )
- Type: NagLibrary..::..G02..::..G02HL_UCVucv must return the values of the functions and and their derivatives for a given value of its argument.
A delegate of type G02HL_UCV.
- Type: System..::..Int32On entry: indicates which form of the function will be used.
- Type: System..::..Int32On entry: , the number of observations.Constraint: .
- Type: System..::..Int32On entry: , the number of columns of the matrix , i.e., number of independent variables.Constraint: .
- Type: array<System..::..Double,2>[,](,)[,][,]An array of size [dim1, m]Note: dim1 must satisfy the constraint:On entry: must contain the th observation on the th variable, for and .
- Type: array<System..::..Double>()An array of size On exit: contains a robust estimate of the covariance matrix, . The upper triangular part of the matrix is stored packed by columns (lower triangular stored by rows), is returned in , .
- Type: array<System..::..Double>()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<System..::..Double>()An array of size [n]On exit: contains the weights, , for .
- Type: array<System..::..Double>()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 (G07DAF not in this release).On exit: contains the robust estimate of the location parameter, , for .
- Type: System..::..DoubleOn entry: the magnitude of the bound for the off-diagonal elements of , .Suggested value: .Constraint: .
- Type: System..::..DoubleOn entry: the magnitude of the bound for the diagonal elements of , .Suggested value: .Constraint: .
- Type: System..::..Int32On entry: the maximum number of iterations that will be used during the calculation of .Suggested value: .Constraint: .
- Type: System..::..Int32On entry: indicates the amount of information on the iteration that is printed.
When printing occurs the output is directed to the current advisory message unit (see (X04ABF not in this release)).
- The value of , and (see [Accuracy]) will be printed at the first and every nitmon iterations.
- No iteration monitoring is printed.
- Type: System..::..DoubleOn entry: the relative precision for the final estimates of the covariance matrix. Iteration will stop when maximum (see [Accuracy]) is less than tol.Constraint: .
- Type: System..::..Int32%On exit: the number of iterations performed.
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.|
g02hl 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)).
Huber P J (1981) Robust Statistics Wiley
Marazzi A (1987) Weights for bounded influence regression in ROBETH Cah. Rech. Doc. IUMSP, No. 3 ROB 3 Institut Universitaire de Médecine Sociale et Préventive, Lausanne
Errors or warnings detected by the method:
Some error messages may refer to parameters that are dropped from this interface (LDX) In these cases, an error in another parameter has usually caused an incorrect value to be inferred.
On entry, , or , or , On entry, , or , or diagonal element of , or , or .
- A column of x has a constant value.
- The method has failed to converge in maxit iterations.
- One of the following is zero: , or .This may be caused by the functions or being too strict for the current estimate of (or ). You should try either a larger initial estimate of or make and 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.
A sample of observations on three variables is read in along with initial values for and theta and parameter values for the and functions, and . The covariance matrix computed by g02hl is printed along with the robust estimate of . ucv computes the Huber's weight functions:
and their derivatives.