This example tests the null hypothesis that at least 75 percent of a population is negative. Because
, the null hypothesis at the 5-percent level of significance is rejected.
using System;
using Imsl.Stat;
public class SignTestEx2
{
public static void Main(String[] args)
{
double[] x = new double[]{ 92.0, 139.0, - 6.0,
10.0, 81.0, - 11.0,
45.0, - 25.0, - 4.0,
22.0, 2.0, 41.0,
13.0, 8.0, 33.0,
45.0, - 33.0, - 45.0,
- 12.0};
SignTest st = new SignTest(x);
st.Percentage = 0.75;
st.Percentile = 0.0;
Console.Out.WriteLine
("Probability = " + st.Compute().ToString("0.000000"));
Console.Out.WriteLine
("Number of positive deviations = " + st.NumPositiveDev);
Console.Out.WriteLine("Number of ties = " + st.NumZeroDev);
}
}
Probability = 0.922543 Number of positive deviations = 12 Number of ties = 0Link to C# source.