naginterfaces.library.univar.robust_​1var_​mestim_​wgt

naginterfaces.library.univar.robust_1var_mestim_wgt(chi, psi, isigma, x, beta, theta, sigma, tol, maxit=50, data=None)[source]

robust_1var_mestim_wgt computes an -estimate of location with (optional) simultaneous estimation of scale, where you provide the weight functions.

For full information please refer to the NAG Library document for g07dc

https://support.nag.com/numeric/nl/nagdoc_30/flhtml/g07/g07dcf.html

Parameters
chicallable retval = chi(t, data=None)

must return the value of the weight 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 the weight function evaluated at .

psicallable retval = psi(t, data=None)

must return the value of the weight 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 weight function evaluated at .

isigmaint

The value assigned to determines whether is to be simultaneously estimated.

The estimation of is bypassed and is set equal to .

is estimated simultaneously.

xfloat, array-like, shape

The vector of observations, .

betafloat

The value of the constant of the chosen function.

thetafloat

If , must be set to the required starting value of the estimate of the location parameter . A reasonable initial value for will often be the sample mean or median.

sigmafloat

The role of depends on the value assigned to as follows.

If , must be assigned a value which determines the values of the starting points for the calculation of and .

If , robust_1var_mestim_wgt will determine the starting points of and .

Otherwise, the value assigned to will be taken as the starting point for , and must be assigned a relevant value before entry, see above.

If , must be assigned a value which determines the values of , which is held fixed during the iterations, and the starting value for the calculation of .

If , robust_1var_mestim_wgt will determine the value of as the median absolute deviation adjusted to reduce bias (see robust_1var_median()) and the starting point for .

Otherwise, the value assigned to will be taken as the value of and must be assigned a relevant value before entry, see above.

tolfloat

The relative precision for the final estimates. Convergence is assumed when the increments for , and are less than .

maxitint, optional

The maximum number of iterations that should be used during the estimation.

dataarbitrary, optional

User-communication data for callback functions.

Returns
thetafloat

The -estimate of the location parameter .

sigmafloat

The -estimate of the scale parameter , if was assigned the value on entry, otherwise will contain the initial fixed value .

rsfloat, ndarray, shape

The Winsorized residuals.

nitint

The number of iterations that were used during the estimation.

wrkfloat, ndarray, shape

If on entry, will contain the observations in ascending order.

Raises
NagValueError
(errno )

On entry, .

Constraint: or .

(errno )

On entry, .

Constraint: .

(errno )

On entry, .

Constraint: .

(errno )

On entry, .

Constraint: .

(errno )

On entry, .

Constraint: .

(errno )

All elements of are equal.

(errno )

Current estimate of is zero or negative: .

(errno )

Number of iterations required exceeds : .

(errno )

All winsorized residuals are zero.

(errno )

The function returned a negative value: .

Notes

The data consists of a sample of size , denoted by , drawn from a random variable .

The are assumed to be independent with an unknown distribution function of the form,

where is a location parameter, and is a scale parameter. -estimators of and are given by the solution to the following system of equations;

where and are user-supplied weight functions, and is a constant. Optionally the second equation can be omitted and the first equation is solved for using an assigned value of .

The constant should be chosen so that is an unbiased estimator when , for has a Normal distribution. To achieve this the value of is calculated as:

The values of are known as the Winsorized residuals.

The equations are solved by a simple iterative procedure, suggested by Huber:

and

or

if is fixed.

The initial values for and may be user-supplied or calculated within robust_1var_mestim() as the sample median and an estimate of based on the median absolute deviation respectively.

robust_1var_mestim_wgt is based upon function LYHALG within the ROBETH library, 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 estimation of location and scale in ROBETH, Cah. Rech. Doc. IUMSP, No. 3 ROB 1, Institut Universitaire de Médecine Sociale et Préventive, Lausanne