TMtxHypothesisTest Class

Source: StatTools.cs · Assembly: Dew.Stats
ComponentTMtxComponentTMtxHypothesisTest

public class TMtxHypothesisTest : TMtxComponent

Encapsulates parametric and non-parametric hypothesis testing routines.

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 Dew.Stats.TMtxHypothesisTest.DataVec1 (and Dew.Stats.TMtxHypothesisTest.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 Dew.Stats.TMtxHypothesisTest.Alpha.
  • Call the Dew.Stats.TMtxHypothesisTest.Recalc method to calculate hypothesis test results.

Results:

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

Examples

csharp
using Dew.Stats.Units;
using Dew.Stats;
using Dew.Math;
namespace Dew.Examples
{
    private void 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, new double[] { 1.0, 2.0, 3.0, 4.0 }); // first dataset
        hyp.DataVec2.SetIt(false, new 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
    }
}

Properties

NameTypeDescription
AlphaDoubleDesired significance level.
AutoUpdateBooleanIf true then changing any of the TMtxHypothesisTest properties will trigger the Dew.Stats.TMtxHypothesisTest.Recalc method.
BlockAssignBooleanBlock streaming of specific properties when storing only a "template".
ConfLowerDoubleReturns lower confidence interval limit.
ConfUpperDoubleReturns upper confidence interval limit.
DataVec1TVecFirst sample values.
DataVec2TVecSecond sample values.
DirtyBooleanWhen any of the TMtxHypothesisTest properties changes, this property is automatically set to true.
EditorActiveBooleanReturns True, if the component editor is displayed.
HypothesisMethodTHypothesisMethodDefines which hypothesis routine will be used for data testing.
HypothesisTypeTHypothesisTypeDefines hypothesis type (left, right and two-tailed).
MeanDoubleDefines mean/median value for one-sample test.
ReferenceTReferenceListStores a list of components that have to be notified, when this component is destroyed.
ResultTHypothesisResultReturns hypothesis result.
SigmaDoubleDefines standard deviation value for single test.
SignificanceDoubleReturns calculated significance level.
TestStatisticsDoubleReturns test statistics.

Methods

NameDescription
AllowStreamingReturns the negatated value of BlockAssign.
AssignAssign values of all published properties from Source.
AssignTemplateAssign values of "template-like" published properties from Source.
EditorClassTo be overriden in descendanr classses.
LoadFromStreamLoad the component from Src stream.
LoadTemplateFromFileLoad a template from file.
LoadTemplateFromStreamLoad a template from stream.
RecalcTriggers hypothesis test recalculation.
ResetReset is called after loading the data from stream or file.
SaveTemplateToFileSave template to file.
SaveTemplateToStreamSave template to stream.
SaveToStreamSave the component to Dst stream.