Syntax
C# |
---|
public static void g02hb( G02..::..G02HB_UCV ucv, int n, int m, double[,] x, double[] a, double[] z, double bl, double bd, double tol, int maxit, int nitmon, out int nit, out int ifail ) |
Visual Basic |
---|
Public Shared Sub g02hb ( _ ucv As G02..::..G02HB_UCV, _ n As Integer, _ m As Integer, _ x As Double(,), _ a As Double(), _ z As Double(), _ bl As Double, _ bd As Double, _ tol As Double, _ maxit As Integer, _ nitmon As Integer, _ <OutAttribute> ByRef nit As Integer, _ <OutAttribute> ByRef ifail As Integer _ ) |
Visual C++ |
---|
public: static void g02hb( G02..::..G02HB_UCV^ ucv, int n, int m, array<double,2>^ x, array<double>^ a, array<double>^ z, double bl, double bd, double tol, int maxit, int nitmon, [OutAttribute] int% nit, [OutAttribute] int% ifail ) |
F# |
---|
static member g02hb : ucv : G02..::..G02HB_UCV * n : int * m : int * x : float[,] * a : float[] * z : float[] * bl : float * bd : float * tol : float * maxit : int * nitmon : int * nit : int byref * ifail : int byref -> unit |
Parameters
- ucv
- Type: NagLibrary..::..G02..::..G02HB_UCVucv must return the value of the function for a given value of its argument. The value of must be non-negative.
A delegate of type G02HB_UCV.
- n
- Type: System..::..Int32On entry: , the number of observations.Constraint: .
- m
- Type: System..::..Int32On entry: , the number of independent variables.Constraint: .
- x
- Type: array<System..::..Double,2>[,](,)[,][,]An array of size [dim1, m]Note: dim1 must satisfy the constraint:On entry: the real matrix , i.e., the independent variables. must contain the th element of , for and .
- a
- 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 , 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.
- z
- Type: array<System..::..Double>[]()[][]An array of size [n]On exit: the value , for .
- bl
- Type: System..::..DoubleOn entry: the magnitude of the bound for the off-diagonal elements of .Suggested value: .Constraint: .
- bd
- Type: System..::..DoubleOn entry: the magnitude of the bound for the diagonal elements of .Suggested value: .Constraint: .
- tol
- Type: System..::..DoubleOn entry: the relative precision for the final value of . Iteration will stop when the maximum value of is less than tol.Constraint: .
- maxit
- Type: System..::..Int32On entry: the maximum number of iterations that will be used during the calculation of .A value of will often be adequate.Constraint: .
- nitmon
- Type: System..::..Int32On 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.
When printing occurs the output is directed to the current advisory message unit (see (X04ABF not in this release)).
- nit
- Type: System..::..Int32%On exit: the number of iterations performed.
- ifail
- Type: System..::..Int32%On exit: unless the method detects an error or a warning has been flagged (see [Error Indicators and Warnings]).
Description
In fitting the linear regression model
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
and
where | is a vector of length of the dependent variable, |
is an by matrix of independent variables, | |
is a vector of length of unknown parameters, | |
and | is a vector of length of unknown errors, |
where | is a vector of length containing the elements of the th row of , |
is an by lower triangular matrix, | |
is a vector of length , | |
and | is a suitable function. |
The weights for use with g02hd may then be computed using
for a suitable user-supplied function .
g02hb finds using the iterative procedure
where , for and , is a lower triangular matrix such that
In addition the values of , for , are calculated.
g02hb is based on routines in ROBETH; see Marazzi (1987).
References
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
Error Indicators and Warnings
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 .
- Value returned by .
- The method has failed to converge in maxit iterations.
Accuracy
On successful exit the accuracy of the results is related to the value of tol; see [Parameters].
Parallelism and Performance
None.
Further Comments
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.
Example
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.
Example program (C#): g02hbe.cs