Sign test

The sign test is a non-parametric test used to compare the distribution median with a given value m. This test could be used as an alternative for one-sample Student t-test. Unlike the t-test, the sign test can work with non-normal distributions.

The sign test has only one requirement: scale of measurement[1] should be ordinal, interval or ratio (i.e. test could not be applied to nominal variables). This is the only restriction. On the one hand, this makes the test as widely applicable as possible. On the other hand, this lowers its effectiveness, because the test cannot use any assumptions about distribution properties.

Note #1
Sign test is not very powerful on small samples. This happens because the test uses only information about element positions relative to the assumed median: to the left or to the right. The test doesn't use information about their values. Fortunately, there is a more powerful test - the Wilcoxon signed-rank test. It uses information about elements' rank. Unfortunately, the scope of this test is limited by distributions which are symmetric relative to the median. With non-symmetric distributions, the test works incorrectly, so we are to use a less powerful sign test.

Subroutine OneSampleSignTest returns three p-values:

The test algorithm is simple. All elements which are equal to m are thrown out. After that we have elements of two types only: elements which are greater than m (N+ elements) and which are less than m. The more N+ differs from N/2, the more probability there is that the median doesn't equal to m. If the hypothesis is true (the median equals m), N+ distribution is binomial: B(N,0.5). This lets us define the significance level corresponding to N+.

Links

  1. 'Level of measurement', Wikipedia
  2. 'Hypothesis testing', Wikipedia
  3. 'P-value', Wikipedia

This article is licensed for personal use only.

Download ALGLIB for C++ / C# / Java / Python / ...

ALGLIB Project offers you two editions of ALGLIB:

ALGLIB Free Edition:
+delivered for free
+offers full set of numerical functionality
+extensive algorithmic optimizations
-no multithreading
-non-commercial license

ALGLIB Commercial Edition:
+flexible pricing
+offers full set of numerical functionality
+extensive algorithmic optimizations
+high performance (SMP, SIMD)
+commercial license with support plan

Links to download sections for Free and Commercial editions can be found below:

ALGLIB 4.01.0 for C++

C++ library.
Delivered with sources.
Monolithic design.
Extreme portability.
Editions:   FREE   COMMERCIAL

ALGLIB 4.01.0 for C#

C# library with native kernels.
Delivered with sources.
VB.NET and IronPython wrappers.
Extreme portability.
Editions:   FREE   COMMERCIAL

ALGLIB 4.01.0 for Java

Java wrapper around HPC core.
Delivered with sources.
Seamless integration with Java.
Editions:   FREE   COMMERCIAL

ALGLIB 4.01.0 for Delphi

Delphi wrapper around C core.
Delivered as precompiled binary.
Compatible with FreePascal.
Editions:   FREE   COMMERCIAL

ALGLIB 4.01.0 for CPython

CPython wrapper around C core.
Delivered as precompiled binary.
Editions:   FREE   COMMERCIAL