One or two-sample Sign test.
Performs one-sample Sign test by comparing Data median value with given Median. The null hypothesis is that Data median is equal to Median. Additional assumption is that underlying population is
Performs paired Sign test. The routine tests the null hypothesis that Data1 and Data2 have equal median value.
Example 1
In this example we'll use paired sign test to verify if both sample medians are equal. Uses MtxExpr, Math387, Statistics;
procedure Example;
var d1,d2: Vector;
SignRes : TSample;
HypRes : THypothesisResult;
begin
d1.SetIt(false,[1,4,5,6,7,12]);
d2.SetIt(false,[3,3.5,2,3.1,10,9]);
SignTest(d1, d2, SignRes, HypRes); // SignRes = 0.6875; HypRes = hrNotReject
// Since the SignRes is greater than Alpha (0.05), the
// null hypothesis that two medians are equal is not rejected
end;
#include "MtxVecCpp.h"
#include "Math387.hpp"
#include "Statistics.hpp"
void __fastcall Example();
{
Vector d1,d2;
d1->SetIt(false, OPENARRAY(TSample, (1,4,5,6,7,12)));
d2->SetIt(false, OPENARRAY(TSample,(3,3.5,2,3.1,10,9)));
double signif, SStat;
double ci[2];
THypothesisResult hres;
// don't use normal approximation
SStat = SignTest(d1,d2,hres,signif,ci,htTwoTailed,0.05);
}
using Dew.Math;
using Dew.Stats;
using Dew.Stats.Units;
namespace Dew.Examples
{
private void Example()
{
Vector d1 = new Vector(0);
Vector d2 = new Vector(0);
d1.SetIt(false, new double[] {1,4,5,6,7,12});
d2.SetIt(false, new double[] {3,3.5,2,3.1,10,9});
double signif, SStat;
double[2] ci;
THypothesisResult hres;
// don't use normal approximation
SStat = Statistics.SignTest(d1,d2,out hres,out signif,out ci,THypothesisType.htTwoTailed,0.05);
}
}