|
NAG[g02hmc] NAG[nag_robust_m_corr_user_fn_no_derr] - Calculates a robust estimation of a correlation matrix, user-supplied weight function
|
|
Calling Sequence
g02hmc(ucv, indm, x, cov, a, wt, theta, nitmon, tol, nit, 'n'=n, 'm'=m, 'bl'=bl, 'bd'=bd, 'maxit'=maxit, 'outfile'=outfile, 'comm'=comm, 'fail'=fail)
nag_robust_m_corr_user_fn_no_derr(. . .)
Parameters
|
ucv - procedure;
|
|
|
ucv must return the values of the functions and for a given value of its argument.
|
|
t - float;
|
|
|
On entry: the argument for which the functions and must be evaluated.
|
|
|
u - assignable;
|
|
|
Note: On exit the variable u will have a value of type float.
|
|
On exit: the value of the function at the point t.
|
|
|
w - assignable;
|
|
|
Note: On exit the variable w will have a value of type float.
|
|
On exit: the value of the function at the point t.
|
|
|
comm - table;
|
|
|
A Maple table, which should be generated using NAG[Nag_Comm], corresponding to the Nag_Comm structure.
|
|
Before calling nag_robust_m_corr_user_fn_no_derr (g02hmc) this field may be initialized for use by ucv when called from nag_robust_m_corr_user_fn_no_derr (g02hmc).
|
|
|
|
indm - integer;
|
|
|
On entry: indicates which form of the function will be used.
|
|
.
|
|
.
|
|
|
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.
|
|
|
cov - Vector(1.., datatype=float[8]);
|
|
|
Note: the dimension, dim, of the array cov must be at least .
|
|
|
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.
|
|
Constraint: , for . .
|
|
On exit: the lower triangular elements of the inverse of the matrix , stored row-wise.
|
|
|
wt - Vector(1..n, datatype=float[8]);
|
|
|
|
theta - Vector(1..m, datatype=float[8]);
|
|
|
On entry: an initial estimate of the location argument, , for .
|
|
In many cases an initial estimate of , for , will be adequate. Alternatively medians may be used as given by g07dac (nag_median_1var).
|
|
On exit: contains the robust estimate of the location argument, , for .
|
|
|
nitmon - integer;
|
|
|
On entry: indicates the amount of information on the iteration that is printed.
|
|
No iteration monitoring is printed.
|
|
|
tol - float;
|
|
|
On entry: the relative precision for the final estimate of the covariance matrix. Iteration will stop when maximum (see Section [Accuracy]) is less than tol.
|
|
Constraint: . .
|
|
|
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: . .
|
|
|
'm'=m - integer; (optional)
|
|
|
On entry: , the number of columns of the matrix , i.e., number of independent variables.
|
|
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: . .
|
|
|
'maxit'=maxit - integer; (optional)
|
|
|
On entry: the maximum number of iterations that will be used during the calculation 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_corr_user_fn_no_derr (g02hmc) computes a robust estimate of the covariance matrix for user-supplied weight functions. The derivatives of the weight functions are not required.
|
|
Description
|
|
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.
and
|
is a vector of length ,
|
|
is the identity matrix and 0 is the zero matrix.
|
|
and and are suitable functions.
|
nag_robust_m_corr_user_fn_no_derr (g02hmc) covers two situations:
|
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 (1987a)).
nag_robust_m_corr_user_fn_no_derr (g02hmc) finds using the iterative procedure as given by Huber; see Huber (1981).
and
where , for is a lower triangular matrix such that
where
|
, for
|
and and are suitable bounds.
The value of may be chosen so that is unbiased if the observations are from a given distribution.
nag_robust_m_corr_user_fn_no_derr (g02hmc) 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_CONST_COL"
Column of x has constant value.
"NE_CONVERGENCE"
Iterations to calculate weights failed to converge.
"NE_FUN_RET_VAL"
value returned by : .
value returned by : .
"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.0.
"NE_ZERO_SUM"
Sum of 's () is zero.
Sum of 's () is zero.
|
|
Accuracy
|
|
On successful exit the accuracy of the results is related to the value of tol; see Section [Parameters]. At an iteration let
|
the maximum value of
|
|
the maximum absolute change in
|
|
the maximum absolute relative change in
|
and let . Then the iterative procedure is assumed to have converged when .
|
|
|
Examples
|
|
>
|
ucv := proc(t, u::evaln, w::evaln, comm)
local t2, cu, cw:
cu := comm['p'][1]:
assign(u, 1.0):
if (t <> 0.0) then
t2 := t * t:
if (t2 > cu) then
assign(u, cu / t2):
end if:
end if:
# w function
cw := comm['p'][2]:
if (t > cw) then
assign(w, cw / t):
else
assign(w, 1.0):
end if:
end proc:
indm := 1:
n := 10:
m := 3:
bl := 0.9:
bd := 0.9:
maxit := 50:
nitmon := 0:
tol := 5e-05:
comm := NAG:-Nag_Comm():
comm['p'] := Vector([4.0, 2.0], datatype=float[8]):
x := Matrix([[3.4, 6.9, 12.2], [6.4, 2.5, 15.1], [4.9, 5.5, 14.2], [7.3, 1.9, 18.2], [8.800000000000001, 3.6, 11.7], [8.4, 1.3, 17.9], [5.3, 3.1, 15], [2.7, 8.1, 7.7], [6.1, 3, 21.9], [5.3, 2.2, 13.9]], datatype=float[8]):
cov := Vector(6, datatype=float[8]):
a := Vector([1, 0, 1, 0, 0, 1], datatype=float[8]):
wt := Vector(10, datatype=float[8]):
theta := Vector([0, 0, 0], datatype=float[8]):
NAG:-g02hmc(ucv, indm, x, cov, a, wt, theta, nitmon, tol, nit, 'n' = n, 'm' = m, 'bl' = bl, 'bd' = bd, 'maxit' = maxit, 'comm' = comm):
|
|
|
See Also
|
|
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.
|
|