public TwoSampleWilcoxonSignedRankTest(double[] sample1, double[] sample2,
TwoSampleHypothesis alternate = TwoSampleHypothesis.ValuesAreDifferent)
{
if (sample1.Length != sample2.Length)
throw new DimensionMismatchException("sample2", "Both samples should be of the same size.");
int[] signs = new int[sample1.Length];
double[] diffs = new double[sample1.Length];
// 1. Compute absolute difference and sign function
for (int i = 0; i < sample1.Length; i++)
{
double d = sample1[i] - sample2[i];
signs[i] = Math.Sign(d);
diffs[i] = Math.Abs(d);
}
this.Hypothesis = alternate;
Compute(signs, diffs, (DistributionTail)alternate);
}