naginterfaces.library.correg.robustm_wts¶
- naginterfaces.library.correg.robustm_wts(ucv, x, a, bl=0.9, bd=0.9, tol=5e-05, maxit=50, nitmon=0, data=None, io_manager=None)[source]¶
robustm_wts
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.robustm_wts
is intended for the calculation of weights of bounded influence regression usingrobustm_user()
.For full information please refer to the NAG Library document for g02hb
https://support.nag.com/numeric/nl/nagdoc_30.3/flhtml/g02/g02hbf.html
- Parameters
- ucvcallable retval = ucv(t, data=None)
must return the value of the function for a given value of its argument.
The value of must be non-negative.
- Parameters
- tfloat
The argument for which must be evaluated.
- dataarbitrary, optional, modifiable in place
User-communication data for callback functions.
- Returns
- retvalfloat
The value of evaluated at .
- xfloat, array-like, shape
The real matrix , i.e., the independent variables. must contain the th element of , for , for .
- afloat, array-like, shape
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 .
- blfloat, optional
The magnitude of the bound for the off-diagonal elements of .
- bdfloat, optional
The magnitude of the bound for the diagonal elements of .
- tolfloat, optional
The relative precision for the final value of . Iteration will stop when the maximum value of is less than .
- maxitint, optional
The maximum number of iterations that will be used during the calculation of .
A value of will often be adequate.
- nitmonint, optional
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 iterations.
No iteration monitoring is printed.
When printing occurs the output is directed to the file object associated with the advisory I/O unit (see
FileObjManager
).- dataarbitrary, optional
User-communication data for callback functions.
- io_managerFileObjManager, optional
Manager for I/O in this routine.
- Returns
- afloat, ndarray, shape
The lower triangular elements of the matrix , stored row-wise.
- zfloat, ndarray, shape
The value , for .
- nitint
The number of iterations performed.
- Raises
- NagValueError
- (errno )
On entry, and .
Constraint: .
- (errno )
On entry, and .
Constraint: .
- (errno )
On entry, .
Constraint: .
- (errno )
On entry, .
Constraint: .
- (errno )
On entry, .
Constraint: .
- (errno )
On entry, .
Constraint: .
- (errno )
On entry, .
Constraint: .
- (errno )
On entry, .
Constraint: .
- (errno )
On entry, and the th diagonal element of is .
Constraint: all diagonal elements of must be non-zero.
- (errno )
Value returned by function : .
The value of must be non-negative.
- (errno )
Iterations to calculate weights failed to converge in iterations: .
- Notes
In fitting the linear regression model
where
is a vector of length of the dependent variable,
is an matrix of independent variables,
is a vector of length of unknown parameters,
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 (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 containing the elements of the th row of ,
is an lower triangular matrix,
is a vector of length ,
and
is a suitable function.
The weights for use with
robustm_user()
may then be computed usingfor a suitable user-supplied function .
robustm_wts
finds using the iterative procedurewhere , for , for , is a lower triangular matrix such that
and and are suitable bounds.
In addition the values of , for , are calculated.
robustm_wts
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