naginterfaces.library.correg.robustm_user_varmat¶
- naginterfaces.library.correg.robustm_user_varmat(psi, psp, indw, indc, sigma, x, rs, wgt, data=None)[source]¶
robustm_user_varmat
calculates an estimate of the asymptotic variance-covariance matrix for the bounded influence regression estimates (M-estimates). It is intended for use withrobustm_user()
.For full information please refer to the NAG Library document for g02hf
https://support.nag.com/numeric/nl/nagdoc_30.2/flhtml/g02/g02hff.html
- Parameters
- psicallable retval = psi(t, data=None)
must return the value of the function for a given value of its argument.
- 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 the function evaluated at .
- pspcallable retval = psp(t, data=None)
must return the value of for a given value of its argument.
- 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 .
- indwint
The type of regression for which the asymptotic variance-covariance matrix is to be calculated.
Mallows type regression.
Huber type regression.
Schweppe type regression.
- indcint
If , must specify the approximation to be used.
If , averaging over residuals.
If , replacing expected by observed.
If , is not referenced.
- sigmafloat
The value of , as given by
robustm_user()
.- xfloat, array-like, shape
The values of the matrix, i.e., the independent variables. must contain the th element of , for , for .
- rsfloat, array-like, shape
The residuals from the bounded influence regression. These are given by
robustm_user()
.- wgtfloat, array-like, shape
If , must contain the vector of weights used by the bounded influence regression. These should be used with
robustm_user()
.If , is not referenced.
- dataarbitrary, optional
User-communication data for callback functions.
- Returns
- cfloat, ndarray, shape
The estimate of the variance-covariance matrix.
- wkfloat, ndarray, shape
If , , for , will contain the diagonal elements of the matrix and , for , will contain the diagonal elements of matrix .
The rest of the array is used as workspace.
- Raises
- NagValueError
- (errno )
On entry, and .
Constraint: .
- (errno )
On entry, and .
Constraint: .
- (errno )
On entry, and .
Constraint: .
- (errno )
On entry, .
Constraint: .
- (errno )
On entry, .
Constraint: .
- (errno )
On entry, .
Constraint: .
- (errno )
matrix is singular or almost singular.
- (errno )
matrix not positive definite.
- (errno )
Correction factor (Huber type regression).
- Notes
For a description of bounded influence regression see
robustm_user()
. Let be the regression parameters and let be the asymptotic variance-covariance matrix of . Then for Huber type regressionwhere
see Huber (1981) and Marazzi (1987).
For Mallows and Schweppe type regressions, is of the form
where and .
is a diagonal matrix such that the th element approximates in the Schweppe case and in the Mallows case.
is a diagonal matrix such that the th element approximates in the Schweppe case and in the Mallows case.
Two approximations are available in
robustm_user_varmat
:Average over the
Replace expected value by observed
See Hampel et al. (1986) and Marazzi (1987).
In all cases is a robust estimate of .
robustm_user_varmat
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, Subroutines for robust and bounded influence regression in ROBETH, Cah. Rech. Doc. IUMSP, No. 3 ROB 2, Institut Universitaire de Médecine Sociale et Préventive, Lausanne