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 }
Copyright (c) 1999-2025 by Dew Research. All rights reserved.
|