Z Test.
Compares the normally distributed Data elements mean value with known standard deviation Sigma, to a mean value Mean.
Example 1
In this example we'll use Z-Test to determine if data mean and variance are equal to specific values. Uses MtxExpr, Math387, Statistics;
procedure Example;
var d: Vector;
Signif : TSample;
HypRes : THypothesisResult;
MeanCI : TTwoElmReal;
begin
d.SetIt(false,[3,3.5,2,3.1,10,9]);
ZTest(d, 5, 1.29, HypRes, Signif, MeanCI);
// Signif = 0.84940087229; HypRes = hrNotReject;
// MeanCI=[4.06780398958, 6.13219601041]
// Comment : Since the SignRes is greater than Alpha (0.05), the
// null hypothesis (H0) that data mean is equal to 5.1 cannot be rejected
// the alternative (Ha) that data mean are NOT equal can therefore be
// rejected
end;
#include "MtxVecCpp.h"
#include "Math387.hpp"
#include "Statistics.hpp"
void __fastcall Example();
{
Vector data;
data->SetIt(false, OPENARRAY(TSample, (3,3.5,2,3.1,10,9)));
double signif, ZStat;
double ci[2];
THypothesisResult hres;
// don't use normal approximation
ZStat = ZTest(data, 5.0, 1.29, hres,signif,ci,htTwoTailed,0.05);
// signif = 0.84940087229; hres = hrNotReject;
// ci=[4.06780398958, 6.13219601041]
// Comment : Since the SignRes is greater than Alpha (0.05), the
// null hypothesis (H0) that data mean is equal to 5.1 cannot be rejected
// the alternative (Ha) that data mean are NOT equal can therefore be
// rejected
}
using Dew.Math;
using Dew.Stats;
using Dew.Stats.Units;
namespace Dew.Examples
{
private void Example()
{
Vector data = new Vector(0);
d1.SetIt(false, new double[] {3,3.5,2,3.1,10,9});
double signif, ZStat;
double[2] ci;
THypothesisResult hres;
// don't use normal approximation
ZStat = Statistics.ZTest(data, 5.0, 1.29,out hres,out signif,out ci,THypothesisType.htTwoTailed,0.05);
// signif = 0.84940087229; hres = hrNotReject;
// ci=[4.06780398958, 6.13219601041]
// Comment : Since the SignRes is greater than Alpha (0.05), the
// null hypothesis (H0) that data mean is equal to 5.1 cannot be rejected
// the alternative (Ha) that data mean are NOT equal can therefore be
// rejected
}
}