Click or drag to resize
Accord.NET (logo)

MultinomialTest Class

Multinomial test (approximated).
Inheritance Hierarchy
SystemObject
  Accord.Statistics.TestingHypothesisTestChiSquareDistribution
    Accord.Statistics.TestingChiSquareTest
      Accord.Statistics.TestingMultinomialTest

Namespace:  Accord.Statistics.Testing
Assembly:  Accord.Statistics (in Accord.Statistics.dll) Version: 3.5.0
Syntax
[SerializableAttribute]
public class MultinomialTest : ChiSquareTest
Request Example View Source

The MultinomialTest type exposes the following members.

Constructors
  NameDescription
Public methodMultinomialTest(Int32)
Creates a new Multinomial test.
Public methodMultinomialTest(Double, Int32)
Creates a new Multinomial test.
Public methodMultinomialTest(Int32, Double)
Creates a new Multinomial test.
Public methodMultinomialTest(Int32, Int32)
Creates a new Multinomial test.
Public methodMultinomialTest(Double, Int32, Double)
Creates a new Multinomial test.
Public methodMultinomialTest(Int32, Int32, Double)
Creates a new Multinomial test.
Top
Properties
  NameDescription
Public propertyCriticalValue
Gets the critical value for the current significance level.
(Inherited from HypothesisTestTDistribution.)
Public propertyDegreesOfFreedom
Gets the degrees of freedom for the Chi-Square distribution.
(Inherited from ChiSquareTest.)
Public propertyHypothesizedProportions
Gets the hypothesized population proportions.
Public propertyObservedProportions
Gets the observed sample proportions.
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(Double, Int32)
Computes the Chi-Square Test.
(Inherited from ChiSquareTest.)
Protected methodCompute(Int32, Double, Double)
Computes the Multinomial test.
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 ChiSquareTest.)
Public methodStatisticToPValue
Converts a given test statistic to a p-value.
(Inherited from ChiSquareTest.)
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 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.)
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 Matrix.)
Top
Remarks

In statistics, the multinomial test is the test of the null hypothesis that the parameters of a multinomial distribution equal specified values. The test can be approximated using a chi-square distribution.

References:

Examples

The following example is based on the example available on About.com Statistics, An Example of Chi-Square Test for a Multinomial Experiment By Courtney Taylor.

In this example, we would like to test if a die is fair. For this, we will be rolling the die 600 times, annotating the result every time the die falls. In the end, we got a one 106 times, a two 90 times, a three 98 times, a four 102 times, a five 100 times and a six 104 times:

int[] sample = { 106, 90, 98, 102, 100, 104 };

// If the die was fair, we should note that we would be expecting the
// probabilities to be all equal to 1 / 6:

double[] hypothesizedProportion = 
{ 
   //   1        2           3          4          5         6
   1 / 6.0,   1 / 6.0,   1 / 6.0,   1 / 6.0,   1 / 6.0,   1 / 6.0, 
};

// Now, we create our test using the samples and the expected proportion
MultinomialTest test = new MultinomialTest(sample, hypothesizedProportion);

double chiSquare = test.Statistic; // 1.6
bool significant = test.Significant; // false

Since the test didn't come up significant, it means that we don't have enough evidence to to reject the null hypothesis that the die is fair.

See Also