NAG Library Routine Document
G02HBF finds, for a real matrix
of full column rank, a lower triangular matrix
is proportional to a robust estimate of the covariance of the variables. G02HBF is intended for the calculation of weights of bounded influence regression using G02HDF
|SUBROUTINE G02HBF (
||UCV, N, M, X, LDX, A, Z, BL, BD, TOL, MAXIT, NITMON, NIT, WK, IFAIL)
||N, M, LDX, MAXIT, NITMON, NIT, IFAIL
||UCV, X(LDX,M), A(M*(M+1)/2), Z(N), BL, BD, TOL, WK(M*(M+1)/2)
In fitting the linear regression model
|| is a vector of length of the dependent variable,
|| is an by 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 by lower triangular matrix,
|| is a vector of length ,
|| is a suitable function.
The weights for use with G02HDF
may then be computed using
for a suitable user-supplied function
using the iterative procedure
, is a lower triangular matrix such that
are suitable bounds.
In addition the values of , for , are calculated.
G02HBF is based on routines in ROBETH; see Marazzi (1987)
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: UCV – REAL (KIND=nag_wp) FUNCTION, supplied by the user.External Procedure
must return the value of the function
for a given value of its argument. The value of
must be non-negative.
The specification of UCV
- 1: T – REAL (KIND=nag_wp)Input
: the argument for which UCV
must be evaluated.
must either be a module subprogram USEd by, or declared as EXTERNAL in, the (sub)program from which G02HBF is called. Parameters denoted as Input
be changed by this procedure.
- 2: N – INTEGERInput
On entry: , the number of observations.
- 3: M – INTEGERInput
On entry: , the number of independent variables.
- 4: X(LDX,M) – REAL (KIND=nag_wp) arrayInput
On entry: the real matrix , i.e., the independent variables.
must contain the th element of , for and .
- 5: LDX – INTEGERInput
: the first dimension of the array X
as declared in the (sub)program from which G02HBF is called.
- 6: A() – REAL (KIND=nag_wp) arrayInput/Output
: 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.
- 7: Z(N) – REAL (KIND=nag_wp) arrayOutput
On exit: the value
, for .
- 8: BL – REAL (KIND=nag_wp)Input
On entry: the magnitude of the bound for the off-diagonal elements of .
- 9: BD – REAL (KIND=nag_wp)Input
On entry: the magnitude of the bound for the diagonal elements of .
- 10: TOL – REAL (KIND=nag_wp)Input
: the relative precision for the final value of
. Iteration will stop when the maximum value of
is less than TOL
- 11: MAXIT – INTEGERInput
: the maximum number of iterations that will be used during the calculation of
A value of will often be adequate.
- 12: NITMON – INTEGERInput
: 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.
When printing occurs the output is directed to the current advisory message unit (see X04ABF
- 13: NIT – INTEGEROutput
On exit: the number of iterations performed.
- 14: WK() – REAL (KIND=nag_wp) arrayWorkspace
- 15: IFAIL – INTEGERInput/Output
must be set to
. If you are unfamiliar with this parameter you should refer to Section 3.3
in the Essential Introduction for details.
For environments where it might be inappropriate to halt program execution when an error is detected, the value
is recommended. If the output of error messages is undesirable, then the value
is recommended. Otherwise, if you are not familiar with this parameter, the recommended value is
. When the value is used it is essential to test the value of IFAIL on exit.
unless the routine detects an error or a warning has been flagged (see Section 6
6 Error Indicators and Warnings
If on entry
, explanatory error messages are output on the current error message unit (as defined by X04AAF
Errors or warnings detected by the routine:
|or||diagonal element of ,|
Value returned by .
The routine has failed to converge in MAXIT
On successful exit the accuracy of the results is related to the value of TOL
; see Section 5
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.
9.1 Program Text
Program Text (g02hbfe.f90)
9.2 Program Data
Program Data (g02hbfe.d)
9.3 Program Results
Program Results (g02hbfe.r)