NAG Library Function Document

nag_outlier_peirce_two_var (g07gbc)

 Contents

    1  Purpose
    7  Accuracy

1
Purpose

nag_outlier_peirce_two_var (g07gbc) returns a flag indicating whether a single data point is an outlier as defined by Peirce's criterion.

2
Specification

#include <nag.h>
#include <nagg07.h>
Nag_Boolean  nag_outlier_peirce_two_var (Integer n, double e, double var1, double var2, double *x, double *lx, double *ux, NagError *fail)

3
Description

nag_outlier_peirce_two_var (g07gbc) tests a potential outlying value using Peirce's criterion. Let
Peirce's method flags e~ as a potential outlier if e~x, where x=σ2z and z is obtained from the solution of
R = λ 1-n n-1 n-1 nn (1)
where
R = 2 exp z2 - 1 2 1- Φz (2)
and Φ is the cumulative distribution function for the standard Normal distribution.
Unlike nag_outlier_peirce (g07gac), both σ2 and σ~2 must be supplied and therefore no assumptions are made about the nature of the relationship between these two quantities. Only a single potential outlier is tested for at a time.
This function uses an algorithm described in nag_opt_one_var_no_deriv (e04abc) to refine a lower, l, and upper, u, limit for x. This refinement stops when e~<l or e~>u.

4
References

Gould B A (1855) On Peirce's criterion for the rejection of doubtful observations, with tables for facilitating its application The Astronomical Journal 45
Peirce B (1852) Criterion for the rejection of doubtful observations The Astronomical Journal 45

5
Arguments

1:     n IntegerInput
On entry: n, the number of observations.
Constraint: n3.
2:     e doubleInput
On entry: e~, the value being tested.
3:     var1 doubleInput
On entry: σ2, the residual variance on fitting model M to y.
Constraint: var1>0.0.
4:     var2 doubleInput
On entry: σ~2, the residual variance on fitting model M to y~.
Constraints:
  • var2>0.0;
  • var2<var1.
5:     x double *Output
On exit: an estimated value of x, the cutoff that indicates an outlier.
6:     lx double *Output
On exit: l, the lower limit for x.
7:     ux double *Output
On exit: u, the upper limit for x.
8:     fail NagError *Input/Output
The NAG error argument (see Section 3.7 in How to Use the NAG Library and its Documentation).

6
Error Indicators and Warnings

NE_ALLOC_FAIL
Dynamic memory allocation failed.
See Section 2.3.1.2 in How to Use the NAG Library and its Documentation for further information.
NE_BAD_PARAM
On entry, argument value had an illegal value.
NE_INT
On entry, n=value.
Constraint: n3.
NE_INTERNAL_ERROR
An internal error has occurred in this function. Check the function call and any array sizes. If the call is correct then please contact NAG for assistance.
See Section 2.7.6 in How to Use the NAG Library and its Documentation for further information.
NE_NO_LICENCE
Your licence key may have expired or may not have been installed correctly.
See Section 2.7.5 in How to Use the NAG Library and its Documentation for further information.
NE_REAL
On entry, var1=value.
Constraint: var1>0.0.
On entry, var2=value.
Constraint: var2>0.0.
NE_REAL_2
On entry, var1=value, var2=value.
Constraint: var2<var1.

7
Accuracy

Not applicable.

8
Parallelism and Performance

nag_outlier_peirce_two_var (g07gbc) is not threaded in any implementation.

9
Further Comments

None.

10
Example

This example reads in a series of values and variances and checks whether each is a potential outlier.
The dataset used is from Peirce's original paper and consists of fifteen observations on the vertical semidiameter of Venus. Each subsequent line in the dataset, after the first, is the result of dropping the observation with the highest absolute value from the previous data and recalculating the variance.

10.1
Program Text

Program Text (g07gbce.c)

10.2
Program Data

Program Data (g07gbce.d)

10.3
Program Results

Program Results (g07gbce.r)

© The Numerical Algorithms Group Ltd, Oxford, UK. 2017