Click or drag to resize
Accord.NET (logo)

SignTest Class

Sign test for the median.
Inheritance Hierarchy
SystemObject
  Accord.Statistics.TestingHypothesisTestBinomialDistribution
    Accord.Statistics.TestingBinomialTest
      Accord.Statistics.TestingSignTest

Namespace:  Accord.Statistics.Testing
Assembly:  Accord.Statistics (in Accord.Statistics.dll) Version: 3.8.0
Syntax
[SerializableAttribute]
public class SignTest : BinomialTest
Request Example View Source

The SignTest type exposes the following members.

Constructors
  NameDescription
Public methodSignTest(Double, Double, OneSampleHypothesis)
Tests the null hypothesis that the sample median is equal to a hypothesized value.
Public methodSignTest(Int32, Int32, OneSampleHypothesis)
Tests the null hypothesis that the sample median is equal to a hypothesized value.
Top
Properties
  NameDescription
Public propertyCriticalValue
Gets the critical value for the current significance level.
(Inherited from HypothesisTestTDistribution.)
Public propertyHypothesis
Gets the alternative hypothesis under test. If the test is Significant, the null hypothesis can be rejected in favor of this alternative hypothesis.
Public propertyPValue
Gets the P-value associated with this test.
(Inherited from HypothesisTestTDistribution.)
Public propertySignificant
Gets whether the null hypothesis should be rejected.
(Inherited from HypothesisTestTDistribution.)
Public propertySize
Gets the significance level for the test. Default value is 0.05 (5%).
(Inherited from HypothesisTestTDistribution.)
Public propertyStatistic
Gets the test statistic.
(Inherited from HypothesisTestTDistribution.)
Public propertyStatisticDistribution
Gets the distribution associated with the test statistic.
(Inherited from HypothesisTestTDistribution.)
Public propertyTail
Gets the test type.
(Inherited from HypothesisTestTDistribution.)
Top
Methods
  NameDescription
Protected methodCompute(Int32, Int32, OneSampleHypothesis)
Computes the one sample sign test.
Protected methodCompute(Double, Int32, Double, OneSampleHypothesis)
Computes the Binomial test.
(Inherited from BinomialTest.)
Public methodEquals
Determines whether the specified object is equal to the current object.
(Inherited from Object.)
Protected methodFinalize
Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
(Inherited from Object.)
Public methodGetHashCode
Serves as the default hash function.
(Inherited from Object.)
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Protected methodMemberwiseClone
Creates a shallow copy of the current Object.
(Inherited from Object.)
Protected methodOnSizeChanged
Called whenever the test significance level changes.
(Inherited from HypothesisTestTDistribution.)
Public methodPValueToStatistic
Converts a given p-value to a test statistic.
(Inherited from BinomialTest.)
Public methodStatisticToPValue
Converts a given test statistic to a p-value.
(Inherited from BinomialTest.)
Public methodToString
Converts the numeric P-Value of this test to its equivalent string representation.
(Inherited from HypothesisTestTDistribution.)
Public methodToString(String, IFormatProvider)
Converts the numeric P-Value of this test to its equivalent string representation.
(Inherited from HypothesisTestTDistribution.)
Top
Extension Methods
  NameDescription
Public Extension MethodHasMethod
Checks whether an object implements a method with the given name.
(Defined by ExtensionMethods.)
Public Extension MethodIsEqual
Compares two objects for equality, performing an elementwise comparison if the elements are vectors or matrices.
(Defined by Matrix.)
Public Extension MethodTo(Type)Overloaded.
Converts an object into another type, irrespective of whether the conversion can be done at compile time or not. This can be used to convert generic types to numeric types during runtime.
(Defined by ExtensionMethods.)
Public Extension MethodToTOverloaded.
Converts an object into another type, irrespective of whether the conversion can be done at compile time or not. This can be used to convert generic types to numeric types during runtime.
(Defined by ExtensionMethods.)
Top
Remarks

In statistics, the sign test can be used to test the hypothesis that the difference median is zero between the continuous distributions of two random variables X and Y, in the situation when we can draw paired samples from X and Y. It is a non-parametric test which makes very few assumptions about the nature of the distributions under test - this means that it has very general applicability but may lack the statistical power of other tests such as the paired-samples t-test or the Wilcoxon signed-rank test.

References:

  • Wikipedia, The Free Encyclopedia. Sign test. Available on: http://en.wikipedia.org/wiki/Sign_test

Examples
// This example has been adapted from the Wikipedia's page about
// the Z-Test, available from: http://en.wikipedia.org/wiki/Z-test

// We would like to check whether a sample of 20
// students with a median score of 96 points ...

double[] sample = 
{ 
    106, 115, 96, 88, 91, 88, 81, 104, 99, 68,
    104, 100, 77, 98, 96, 104, 82, 94, 72, 96
};

// ... could have happened just by chance inside a 
// population with an hypothesized median of 100 points.

double hypothesizedMedian = 100;

// So we start by creating the test:
SignTest test = new SignTest(sample, hypothesizedMedian,
                OneSampleHypothesis.ValueIsSmallerThanHypothesis);

// Now, we can check whether this result would be
// unlikely under a standard significance level:

bool significant = test.Significant; // false (so the event was likely)

// We can also check the test statistic and its P-Value
double statistic = test.Statistic; // 5
double pvalue = test.PValue; // 0.99039
See Also