You are here: Symbol Reference > StatTools Namespace > Classes > TMtxHypothesisTest Class
Stats Master VCL
ContentsIndex
PreviousUpNext
TMtxHypothesisTest Class

Encapsulates parametric and non-parametric hypothesis testing routines.

StatTools_TMtxHypothesisTestStatTools_TMtxHypothesisTest
Pascal
TMtxHypothesisTest = class(TMtxComponent);

Encapsulates parametric and non-parametric hypothesis testing routines. Many problems in engineering require that we decide whether to accept or reject a statement about some parameter. The statement is called a hypothesis and the decision-making procedure about the hypothesis is called hypothesis testing. 

The following hypothesis tests are supported:

  • one or two sample Sign test,
  • one or two sample Wilcoxon Signed-Rank test,
  • one or two sample (on pooled or paired data) T test,
  • one sample Z test,
  • one sample ChiSquared test,
  • two sample F test.

 

How to use TMtxHypothesisTest component?

  • Drop a TMtxHypothesisTest component on the form.
  • Define the hypothesis test you want to perform (Sign, Wilcoxon, Z, T, ChiSquared, F).
  • Define hypothesis type (the null hypothesis type) : two, left or right tailed.
  • Depending on hypothesis method define one or two sample datasets. You can do this by clicking on DataVec1 (and DataVec2) properties.
  • Depending on hypothesis method you'll also have to define test mean (and in Z, F Test case sigma) property.
  • Define the desired significance level Alpha.
  • Call the Recalc method to calculate hypothesis test results.

 

Results:

  • Result : The hypothesis result (accept, reject null hypothesis).
  • Significance : actual significance level.
  • ConfLower,ConfUpper : 100*(1-Alpha) confidence interval limits for mean (median, standard deviation).

How to setup and run two sample t-test.

Uses MtxVec, Statistics, StatTools;
var MtxHypothesis1: TMtxHypothesisTest;
begin
  MtxHypothesis1.Alpha := 0.03; // desired significance level at 3%
  MtxHypothesis1.HypothesisType := htTwoTailed; // two tailed => Ha= means are not equal
  MtxHypothesis1.DataVec1.SetIt(false,[1.0, 2.0, 3.0, 4.0]); // first dataset
  MtxHypothesis1.DataVec2.SetIt(false,[1.5, 3.1, 4.2, 4.3]); // second dataset
  MtxHypothesis1.HypothesisMethod := hmTTest2Pooled;  // comparing means of two datasets
  MtxHypothesis1.Recalc;
  //Results ==> Significance = 0.43036618314 , Result = hrNotReject
end;
#include "MtxExpr.hpp"
#include "Statistics.hpp"
#include "StatTools.hpp"
void __fastcall Example(TMtxHypothesis *hyp)
{
  hyp->Alpha = 0.03; // desired significance level at 3%
  hyp->HypothesisType = THypothesisType::htTwoTailed; // two tailed => Ha= means are not equal
  hyp->DataVec1->SetIt(false, OPENARRAY(double,(1.0, 2.0, 3.0, 4.0))); // first dataset
  hyp->DataVec2->SetIt(false, OPENARRAY(double,(1.5, 3.1, 4.2, 4.3))); // second dataset
  hyp->HypothesisMethod = THypothesisMethod::hmTTest2Pooled;  // comparing means of two datasets
  hyp->Recalc();
  //Results ==> Significance = 0.43036618314 , Result = hrNotReject
}
Examples on GitHub
Copyright (c) 1999-2025 by Dew Research. All rights reserved.
What do you think about this topic? Send feedback!