CCG_WMD3x

Estimates the mean of a number of normally distributed data values, some of which may be corrupt

Description:

This routine is based on maximising the likelihood function for a statistical model in which any of the data points has a constant probability of being corrupt. A weighted mean is formed with weights chosen according to the deviation of each data point from the current estimate of the mean. The weights are derived from the relative probability of being invalid or corrupt. A sequence of these iterations converges to a stationary point in the likelihood function. The routine approximates to a k-sigma clipping algorithm for a large number of points and to a mode estimating algorithm for fewer data points. Different weighting for each data point are allowed to accomodate known different intrinsic errors in the input data.

The variance of the input population is determined from the whole population and a new variance is computed, after the rejection passes, using the order statistics of a trimmed sample with the derived weights and initial numbers. Thus the input data should be ordered (either increasing or decreasing) so that means which are outliers (due to unstabilities from overly small sigma clipping) can have their variance properly estimated.

Invocation

CALL CCG_WMD3x( EL, ORDDAT, WEIGHT, PBAD, NITER, TOLL, NSIGMA, COVEC, XMODE, FVAR, USED, NUSED, STATUS )

Arguments

EL = INTEGER (Given)
The number of data values.
ORDDAT( EL ) = REAL (Given)
An ordered (increasing or decreasing) array of data values.
WEIGHT( EL ) = REAL (Given)
An array of data weights for each data value. The weights should be the inverse variance of each data point. They are used to directly estimate the input population variance.
PBAD = REAL (Given)
An estimate of the probability that any one data point will be corrupt. (This value is not critical.)
NITER = INTEGER (Given)
The maximum number of iterations required.
TOLL = REAL (Given)
The absolute accuracy required in the estimate of the mean. Iterations cease when two successive estimates differ by less than this amount.
NSIGMA = REAL (Given)
The sigma level to reject data values at.
COVEC( ) = DOUBLE PRECISION (Given)
The packed variance-covariance matrix of the order statistics from a normal distribution of size EL, produced by CCG_ORVAR.
XMODE = DOUBLE PRECISION (Returned)
The estimate of the uncorrupted mean.
FVAR = DOUBLE PRECISION (Returned)
An estimate of the uncorrupted variance of the data points.
USED( EL ) = LOGICAL (Returned)
If a value is not rejected then its corresponding used element will be set true.
NUSED = INTEGER (Returned)
Number of the input data values which are actually used when forming the estimate of the mean. This value will be zero or less if all values are rejected.
STATUS = INTEGER (Returned)
The global status.

Notes: