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

SignTest() public method

Tests the null hypothesis that the sample median is equal to a hypothesized value.
public SignTest ( double sample, double hypothesizedMedian, OneSampleHypothesis alternate = OneSampleHypothesis.ValueIsDifferentFromHypothesis ) : System
sample double The data samples from which the test will be performed.
hypothesizedMedian double The constant to be compared with the samples.
alternate OneSampleHypothesis The alternative hypothesis (research hypothesis) to test.
return System
        public SignTest(double[] sample, double hypothesizedMedian = 0,
            OneSampleHypothesis alternate = OneSampleHypothesis.ValueIsDifferentFromHypothesis)
        {
            int positive = 0;
            int negative = 0;

            for (int i = 0; i < sample.Length; i++)
            {
                double d = sample[i] - hypothesizedMedian;

                if (d > 0)
                    positive++;
                else if (d < 0)
                    negative++;
            }


            Compute(positive, positive + negative, alternate);
        }

Same methods

SignTest::SignTest ( int positiveSamples, int totalSamples, OneSampleHypothesis alternate ) : System