|
NAG[g02hbc] NAG[nag_robust_m_regsn_wts] - Robust regression, compute weights for use with g02hdc (nag_robust_m_regsn_user_fn)
|
|
Calling Sequence
g02hbc(ucv, m, x, a, z, tol, maxit, nitmon, nit, 'n'=n, 'bl'=bl, 'bd'=bd, 'outfile'=outfile, 'comm'=comm, 'fail'=fail)
nag_robust_m_regsn_wts(. . .)
Parameters
|
ucv - procedure;
|
|
|
ucv must return the value of the function for a given value of its argument. The value of must be non-negative.
|
|
t - float;
|
|
|
On entry: the argument for which ucv must be evaluated.
|
|
|
comm - table;
|
|
|
A Maple table, which should be generated using NAG[Nag_Comm], corresponding to the Nag_Comm structure.
|
|
Before calling nag_robust_m_regsn_wts (g02hbc) this field may be initialized for use by ucv when called from nag_robust_m_regsn_wts (g02hbc).
|
|
|
|
m - integer;
|
|
|
On entry: , the number of independent variables.
|
|
Constraint: . .
|
|
|
x - Matrix(1..dim1, 1..m, datatype=float[8], order=order);
|
|
|
Note: this array may be supplied in Fortran_order or C_order , as specified by order. All array parameters must use a consistent order.
|
|
|
a - Vector(1.., datatype=float[8]);
|
|
|
Note: the dimension, dim, of the array a must be at least .
|
|
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.
|
|
On exit: the lower triangular elements of the matrix , stored row-wise.
|
|
|
z - Vector(1..n, datatype=float[8]);
|
|
|
On exit: the value , for .
|
|
|
tol - float;
|
|
|
On entry: the relative precision for the final value of . Iteration will stop when the maximum value of is less than tol.
|
|
Constraint: . .
|
|
|
maxit - integer;
|
|
|
On entry: the maximum number of iterations that will be used during the calculation of .
|
|
A value of will often be adequate.
|
|
Constraint: . .
|
|
|
nitmon - integer;
|
|
|
On entry: determines the amount of information that is printed on each iteration.
|
|
No iteration monitoring is printed.
|
|
|
nit - assignable;
|
|
|
Note: On exit the variable nit will have a value of type integer.
|
|
On exit: the number of iterations performed.
|
|
|
'n'=n - integer; (optional)
|
|
|
On entry: , the number of observations.
|
|
Constraint: . .
|
|
|
'bl'=bl - float; (optional)
|
|
|
On entry: the magnitude of the bound for the off-diagonal elements of .
|
|
Suggested value: . (default: )
|
|
Constraint: . .
|
|
|
'bd'=bd - float; (optional)
|
|
|
On entry: the magnitude of the bound for the diagonal elements of .
|
|
Suggested value: . (default: )
|
|
Constraint: . .
|
|
|
'outfile'=outfile - character; (optional)
|
|
|
On entry: The name of a file to which intermediate or diagnostic output should be appended. If a value is not provided for this parameter then the behaviour of this routine is platform dependent. Usually all output will be suppressed, however on some platforms output will be produced and will be displayed in the Maple session.
|
|
|
'comm'=comm - table; (optional)
|
|
|
A Maple table, which should be generated using NAG[Nag_Comm], corresponding to the Nag_Comm structure.
|
|
|
'fail'=fail - table; (optional)
|
|
|
The NAG error argument, see the documentation for NagError.
|
|
|
|
Description
|
|
|
Purpose
|
|
nag_robust_m_regsn_wts (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. nag_robust_m_regsn_wts (g02hbc) is intended for the calculation of weights of bounded influence regression using g02hdc (nag_robust_m_regsn_user_fn).
|
|
Description
|
|
In fitting the linear regression model
|
where is a vector of length of the dependent variable,
|
|
is a vector of length of unknown arguments,
|
|
and 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 (1987a)). 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
|
is a vector of length ,
|
|
and is a suitable function.
|
The weights for use with g02hdc (nag_robust_m_regsn_user_fn) may then be computed using
for a suitable user function .
nag_robust_m_regsn_wts (g02hbc) finds using the iterative procedure
where , for and is a lower triangular matrix such that
and and are suitable bounds.
In addition the values of , for , are calculated.
nag_robust_m_regsn_wts (g02hbc) is based on routines in ROBETH; see Marazzi (1987a).
|
|
Error Indicators and Warnings
|
|
"NE_ALLOC_FAIL"
Dynamic memory allocation failed.
"NE_BAD_PARAM"
On entry, argument had an illegal value.
"NE_CONVERGENCE"
Iterations to calculate weights failed to converge in maxit iterations: .
"NE_FUN_RET_VAL"
Value returned by ucv function : .
"NE_INT"
On entry, . Constraint: .
On entry, . Constraint: .
On entry, . Constraint: .
"NE_INT_2"
On entry, , . Constraint: .
On entry, , . Constraint: .
"NE_INTERNAL_ERROR"
An internal error has occurred in this function. Check the function call and any array sizes. If the call is correct then please consult NAG for assistance.
"NE_NOT_CLOSE_FILE"
Cannot close file .
"NE_NOT_WRITE_FILE"
Cannot open file for writing.
"NE_REAL"
On entry, . Constraint: .
On entry, . Constraint: .
On entry, . Constraint: .
"NE_ZERO_DIAGONAL"
On entry, diagonal element of a is 0.
|
|
Accuracy
|
|
On successful exit the accuracy of the results is related to the value of tol; see Section [Parameters].
|
|
|
Examples
|
|
>
|
ucv := proc(t, comm)
local pc, pd, q, q2, ret_val:
# ucv function for Krasker-Welsch weights
ret_val := 1.0:
if (t <> 0.0) then
q := 2.5 / t:
q2 := q * q:
pc := NAG:-s15abc(q):
if (q2 < -log(NAG:-x02akc()) ) then
pd := exp(-q2 / 2.0) / sqrt(Pi*2.0):
else
pd := 0.0:
end if:
ret_val := evalhf((pc * 2.0 - 1.0) * (1.0 - q2) + q2 - q * 2.0 * pd):
end if:
return ret_val:
end proc:
n := 5:
m := 3:
bl := 0.9:
bd := 0.9:
tol := 5e-05:
maxit := 50:
nitmon := 0:
comm := NAG:-Nag_Comm():
x := Matrix([[1, -1, -1], [1, -1, 1], [1, 1, -1], [1, 1, 1], [1, 0, 3]], datatype=float[8]):
a := Vector([1, 0, 1, 0, 0, 1], datatype=float[8]):
z := Vector(5, datatype=float[8]):
NAG:-g02hbc(ucv, m, x, a, z, tol, maxit, nitmon, nit, 'n' = n, 'bl' = bl, 'bd' = bd, 'comm' = comm):
|
|
|
See Also
|
|
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 (1987a) 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
g02 Chapter Introduction.
NAG Toolbox Overview.
NAG Web Site.
|
|