Accord.Statistics.Testing.MultinomialTest.MultinomialTest C# (CSharp) Method

MultinomialTest() public method

Creates a new Multinomial test.
public MultinomialTest ( int sample, int categories ) : System
sample int The categories for each observation in the sample.
categories int The number of possible categories.
return System
        public MultinomialTest(int[] sample, int categories)
        {
            double[] hypothesizedProportions = new double[categories];
            for (int i = 0; i < hypothesizedProportions.Length; i++)
                hypothesizedProportions[i] = 1.0 / hypothesizedProportions.Length;

            double[] observed = new double[categories];
            for (int i = 0; i < observed.Length; i++)
                observed[sample[i]]++;

            Compute(sample.Length, observed, hypothesizedProportions);
        }

Same methods

MultinomialTest::MultinomialTest ( double sampleProportions, int sampleSize ) : System
MultinomialTest::MultinomialTest ( double sampleProportions, int sampleSize, double hypothesizedProportions ) : System
MultinomialTest::MultinomialTest ( int sampleCounts ) : System
MultinomialTest::MultinomialTest ( int sampleCounts, double hypothesizedProportions ) : System
MultinomialTest::MultinomialTest ( int sample, int categories, double hypothesizedProportions ) : System