====================
Dixon Type (Q) Tests
====================
:doc:`/WorkProcessClassifiers/LocalAlgorithm/index` - :doc:`/WorkProcessClassifiers/OneDimensionalAlgorithm/index`

*Dixon Q-test* algorithm uses the ratio of the gap between the possible a value outside the region of interest and the next closest value to it to the total range of the data set. This value is compared to a set of statistically determined values for a variety of confidence intervals. The basic formula is as follows:

.. math::

   (1) \quad Q^{\text{test}} = \frac{Y_N - Y_{N-1}}{Y_N - Y_1} \, \text{,} 

and

.. math::

   (2) \quad Q^{\text{test}} = \frac{Y_2 - Y_1}{Y_N - Y_1} \, \text{,}

where (1) is used to test whether the largest value is a value outside the region of interest, and (2) is used to test whether the smallest value in the data set of length :math:`N` is a value outside the region of interest. If :math:`Q^{\text{test}} > Q^{\text{table}}`\ , the value in question is a value outside the region of interest.

.. rubric:: Input Parameters

+----------------------------------------+--------------------------------------------+----------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------+
| Parameter                              | Type                                       | Constraint                             | Description                                                                                                                                                                                                         | Remarks |
+========================================+============================================+========================================+=====================================================================================================================================================================================================================+=========+
| :math:`Y`                              | :math:`Y \in \mathbb R^N`                  | :math:`N \in \mathbb{N}`               | Input data sequenceof length :math:`N`                                                                                                                                                                              |         |
+----------------------------------------+--------------------------------------------+----------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------+
| :math:`Q^{\text{table}}`               |                                            |                                        | A table of calculated :math:`Q^{\text{table}}`               values for a specific confidence level, e.g. :math:`90`            \         %, :math:`95`            \         % or :math:`99`            \         % |         |
+----------------------------------------+--------------------------------------------+----------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------+

.. rubric:: Output Parameters

+----------------------------+----------------------------------------------------+------------+-------------------------------------------------------------------------------------------+---------+
| Parameter                  | Type                                               | Constraint | Description                                                                               | Remarks |
+============================+====================================================+============+===========================================================================================+=========+
| :math:`\hat{Y}`            | :math:`\hat{Y} \in \mathbb R^N`                    |            | Values in the :math:`Y`          list which are outside the region of interest are marked |         |
+----------------------------+----------------------------------------------------+------------+-------------------------------------------------------------------------------------------+---------+

.. rubric:: Single Steps using the Algorithm

* :doc:`/DataPreprocessing/DataCleaning/OutlierDetection/OutlierDetectionWithDixonTypeQTests/index`

.. rubric:: References

- D.B.\  Rorabacher, Statistical Treatment for Rejection of Deviant Values: Critical Values of Dixon Q Parameter and Related Subrange Ratios at the 95 percent Confidence Level, Anal. Chem., vol. 63(2), pp. 139-146, 1991.

  `http://pubs.acs.org/doi/pdf/10.1021/ac00002a010 <http://pubs.acs.org/doi/pdf/10.1021/ac00002a010>`__

- S.\  Walfish, A review of statistical outlier methods. Pharmaceutical Technology, 2006. Retrieved from www.pharmtech.com.