g02hbc finds, for a real matrix of full column rank, a lower triangular matrix such that is proportional to a robust estimate of the covariance of the variables. g02hbc is intended for the calculation of weights of bounded influence regression using g02hdc.
The function may be called by the names: g02hbc, nag_correg_robustm_wts or nag_robust_m_regsn_wts.
In fitting the linear regression model
is a vector of length of the dependent variable,
is an matrix of independent variables,
is a vector of length of unknown parameters,
is a vector of length of unknown errors,
it may be desirable to bound the influence of rows of the matrix. This can be achieved by calculating a weight for each observation. Several schemes for calculating weights have been proposed (see Hampel et al. (1986) and Marazzi (1987)). As the different independent variables may be measured on different scales one group of proposed weights aims to bound a standardized measure of influence. To obtain such weights the matrix has to be found such that
is a vector of length containing the elements of the th row of ,
is an lower triangular matrix,
is a vector of length ,
is a suitable function.
The weights for use with g02hdc may then be computed using
for a suitable user-supplied function .
g02hbc finds using the iterative procedure
where , for and , is a lower triangular matrix such that
Hampel F R, Ronchetti E M, Rousseeuw P J and Stahel W A (1986) Robust Statistics. The Approach Based on Influence Functions Wiley
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
1: – Nag_OrderTypeInput
On entry: the order argument specifies the two-dimensional storage scheme being used, i.e., row-major ordering or column-major ordering. C language defined storage is specified by . See Section 3.1.3 in the Introduction to the NAG Library CL Interface for a more detailed explanation of the use of this argument.
2: – function, supplied by the userExternal Function
ucv must return the value of the function for a given value of its argument. The value of must be non-negative.
On entry: the argument for which ucv must be evaluated.
2: – Nag_Comm *
Pointer to structure of type Nag_Comm; the following members are relevant to ucv.
user – double *
iuser – Integer *
p – Pointer
The type Pointer will be void *. Before calling g02hbc you may allocate memory and initialize these pointers with various quantities for use by ucv when called from g02hbc (see Section 3.1.1 in the Introduction to the NAG Library CL Interface).
Note:ucv should not return floating-point NaN (Not a Number) or infinity values, since these are not handled by g02hbc. If your code inadvertently does return any NaNs or infinities, g02hbc is likely to produce unexpected results.
3: – IntegerInput
On entry: , the number of observations.
4: – IntegerInput
On entry: , the number of independent variables.
5: – const doubleInput
Note: the dimension, dim, of the array
must be at least
where appears in this document, it refers to the array element
On entry: the real matrix , i.e., the independent variables.
must contain the th element of , for and .
6: – IntegerInput
On entry: the stride separating row or column elements (depending on the value of order) in the array x.
if , .
7: – doubleInput/Output
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 , although 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 .
On exit: the lower triangular elements of the matrix , stored row-wise.
8: – doubleOutput
On exit: the value
, for .
9: – doubleInput
On entry: the magnitude of the bound for the off-diagonal elements of .
10: – doubleInput
On entry: the magnitude of the bound for the diagonal elements of .
11: – doubleInput
On entry: the relative precision for the final value of . Iteration will stop when the maximum value of is less than tol.
12: – IntegerInput
On entry: the maximum number of iterations that will be used during the calculation of .
A value of will often be adequate.
13: – IntegerInput
On entry: determines the amount of information that is printed on each iteration.
The value of and the maximum value of will be printed at the first and every nitmon iterations.
No iteration monitoring is printed.
14: – const char *Input
On entry: a null terminated character string giving the name of the file to which results should be printed. If or an empty string then the stdout stream is used. Note that the file will be opened in the append mode.
15: – Integer *Output
On exit: the number of iterations performed.
16: – Nag_Comm *
The NAG communication argument (see Section 3.1.1 in the Introduction to the NAG Library CL Interface).
17: – NagError *Input/Output
The NAG error argument (see Section 7 in the Introduction to the NAG Library CL Interface).
6Error Indicators and Warnings
Dynamic memory allocation failed.
See Section 3.1.2 in the Introduction to the NAG Library CL Interface for further information.
On entry, argument had an illegal value.
Iterations to calculate weights failed to converge in maxit iterations: .
Value returned by ucv function : . The value of must be non-negative.
On entry, .
On entry, .
On entry, . Constraint: .
On entry, and .
On entry, and .
An internal error has occurred in this function. Check the function call and any array sizes. If the call is correct then please contact NAG for assistance.
See Section 7.5 in the Introduction to the NAG Library CL Interface for further information.
Your licence key may have expired or may not have been installed correctly.
See Section 8 in the Introduction to the NAG Library CL Interface for further information.
Cannot close file .
Cannot open file for writing.
On entry, .
On entry, .
On entry, .
On entry, and the th diagonal element of is .
Constraint: all diagonal elements of must be non-zero.
On successful exit the accuracy of the results is related to the value of tol; see Section 5.
8Parallelism and Performance
Background information to multithreading can be found in the Multithreading documentation.
g02hbc makes calls to BLAS and/or LAPACK routines, which may be threaded within the vendor library used by this implementation. Consult the documentation for the vendor library for further information.
Please consult the X06 Chapter Introduction for information on how to control and interrogate the OpenMP environment used within this function. Please also consult the Users' Note for your implementation for any additional implementation-specific information.
The existence of will depend upon the function ; (see Hampel et al. (1986) and 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.
This example reads in a matrix of real numbers and computes the Krasker–Welsch weights (see Marazzi (1987)). The matrix and the weights are then printed.