BinomialTest Class |
Namespace: Accord.Statistics.Testing
The BinomialTest type exposes the following members.
Name | Description | |
---|---|---|
BinomialTest |
Creates a Binomial test.
| |
BinomialTest(Boolean, Double, OneSampleHypothesis) |
Tests the probability of two outcomes in a series of experiments.
| |
BinomialTest(Int32, Int32, Double, OneSampleHypothesis) |
Tests the probability of two outcomes in a series of experiments.
|
Name | Description | |
---|---|---|
CriticalValue |
Gets the critical value for the current significance level.
(Inherited from HypothesisTestTDistribution.) | |
Hypothesis |
Gets the alternative hypothesis under test. If the test is
Significant, the null hypothesis can be rejected
in favor of this alternative hypothesis.
| |
PValue |
Gets the P-value associated with this test.
(Inherited from HypothesisTestTDistribution.) | |
Significant |
Gets whether the null hypothesis should be rejected.
(Inherited from HypothesisTestTDistribution.) | |
Size |
Gets the significance level for the
test. Default value is 0.05 (5%).
(Inherited from HypothesisTestTDistribution.) | |
Statistic |
Gets the test statistic.
(Inherited from HypothesisTestTDistribution.) | |
StatisticDistribution |
Gets the distribution associated
with the test statistic.
(Inherited from HypothesisTestTDistribution.) | |
Tail |
Gets the test type.
(Inherited from HypothesisTestTDistribution.) |
Name | Description | |
---|---|---|
Compute |
Computes the Binomial test.
| |
Equals | Determines whether the specified object is equal to the current object. (Inherited from Object.) | |
Finalize | Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.) | |
GetHashCode | Serves as the default hash function. (Inherited from Object.) | |
GetType | Gets the Type of the current instance. (Inherited from Object.) | |
MemberwiseClone | Creates a shallow copy of the current Object. (Inherited from Object.) | |
OnSizeChanged |
Called whenever the test significance level changes.
(Inherited from HypothesisTestTDistribution.) | |
PValueToStatistic |
Converts a given p-value to a test statistic.
(Overrides HypothesisTestTDistributionPValueToStatistic(Double).) | |
StatisticToPValue |
Converts a given test statistic to a p-value.
(Overrides HypothesisTestTDistributionStatisticToPValue(Double).) | |
ToString |
Converts the numeric P-Value of this test to its equivalent string representation.
(Inherited from HypothesisTestTDistribution.) | |
ToString(String, IFormatProvider) |
Converts the numeric P-Value of this test to its equivalent string representation.
(Inherited from HypothesisTestTDistribution.) |
Name | Description | |
---|---|---|
HasMethod |
Checks whether an object implements a method with the given name.
(Defined by ExtensionMethods.) | |
IsEqual |
Compares two objects for equality, performing an elementwise
comparison if the elements are vectors or matrices.
(Defined by Matrix.) | |
To(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.) | |
ToT | 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.) |
In statistics, the binomial test is an exact test of the statistical significance of deviations from a theoretically expected distribution of observations into two categories. The most common use of the binomial test is in the case where the null hypothesis is that two categories are equally likely to occur (such as a coin toss).
When there are more than two categories, and an exact test is required, the multinomial test, based on the multinomial distribution, must be used instead of the binomial test.
References:
This is the second example from Wikipedia's page on hypothesis testing. In this example, a person is tested for clairvoyance (ability of gaining information about something through extra sensory perception; detecting something without using the known human senses.
// A person is shown the reverse of a playing card 25 times and is // asked which of the four suits the card belongs to. Every time // the person correctly guesses the suit of the card, we count this // result as a correct answer. Let's suppose the person obtained 13 // correctly answers out of the 25 cards. // Since each suit appears 1/4 of the time in the card deck, we // would assume the probability of producing a correct answer by // chance alone would be of 1/4. // And finally, we must consider we are interested in which the // subject performs better than what would expected by chance. // In other words, that the person's probability of predicting // a card is higher than the chance hypothesized value of 1/4. BinomialTest test = new BinomialTest( successes: 13, trials: 25, hypothesizedProbability: 1.0 / 4.0, alternate: OneSampleHypothesis.ValueIsGreaterThanHypothesis); Console.WriteLine("Test p-Value: " + test.PValue); // ~ 0.003 Console.WriteLine("Significant? " + test.Significant); // True.