KPG_IMMMx

Finds the mean, median and mode iteratively using the Chauvenet rejection criterion

Description:

This finds the mean, median, and mode (mmm) of a sample of data taken from a background region of an astronomical image of the sky. It should not be used as a general statistical routine as there are special features that are peculiar to the problem of contamination by stars. The routine also returns the standard deviation and the skew of the sample.

It makes a first estimate of the statistics, and then refines these by including or excluding values at either end of the sorted values, deciding which values to reject using the Chauvanet criterion. Iterations stop once no more values are rejected; or the statistics stabilise; or there is an oscillation between two states, in which case the returned statistics are the averages found in these two states; or there are too few values remaining.

Invocation

CALL KPG_IMMMx( EL, ARRAY, MEAN, MEDIAN, MODE, SIGMA, SKEW, NSAMP, NINVAL, STATUS )

Arguments

EL = INTEGER (Given)
The number of data in the sample.
ARRAY( EL ) = REAL (Given)
Vector of data samples.
MEAN = REAL (Write)
The mean of the sample.
MEDIAN = REAL (Write)
The median of the sample.
MODE = REAL (Write)
The mode of the sample from the 3 median - 2 mean formula.
SIGMA = REAL (Write)
The standard deviation of the sample.
SKEW = REAL (Write)
The skewness of the sample from the formula MEAN - MODE / SIGMA.
NSAMP = INTEGER (Write)
The population of the sample after the iterative procedure.
NINVAL = INTEGER (Write)
The number of bad pixels in the sample.
STATUS = INTEGER(Given and Returned)
Global status value.

Notes:

In the iterations the new symmetric value range is about the mode, the half width being the Chauvenet number of standard deviations plus half the average separation of mean and mode. The median averages the central nine values to derive a more robust estimate.