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

Visual representation of One and Two way ANOVA.

StatTools_TMtxAnovaStatTools_TMtxAnova
Pascal
TMtxAnova = class(TMtxComponent);

Encapsulates one and two way analysis of variance (ANOVA) routines. The assumptions of the one and two-way analysis of variance are:

  • The data are continuous (not discrete).
  • The data follow the normal probability distribution. Each group is normally distributed about the group mean.
  • The variances of the populations are equal.
  • The groups are independent. There is no relationship among the individuals in one group as compared to another.
  • Each group is a simple random sample from its population. Each individual in the population has an equal probability of being selected in the sample.

How to use TMtxAnova component?

  1. Drop a TMtxAnova component on the form.
  2. Define if you'll do a one-way or two-way ANOVA (the IsAnova1 property).
  3. If you'll be doing the two-way ANOVA, define the number of replications per "cell" (the crefReplications property).
  4. Define the data you wish to analyze. Depending on IsAnova1 and Replications properties Data matrix can be interpreted in different ways.
  5. Define the default number format for ANOVA table - the crefFmtString property. Default value is '0.0000'.
  6. Define (optional) the ResultDest TStringGrid. TMtxAnova results will be outputted to a crefResultDest string grid.
  7. Perform ANOVA by calling the crefRecalc method.

Results:

  1. If you specified crefResultDest then the standard ANOVA table will be written to ResultDest string grid. If ResultDest is nil, you can still use crefWriteResultToGrid or crefWriteResultToStrings methods to output ANOVA table to a TStringGrid or TStrings.
  2. crefP returns the significance probability of null hypothesis that means are equal. If P is less than desired significance crefAlpha then the result suggests, the null hypothesis (means are equal) can be rejected.

How to setup, run and output to table two way ANOVA: 

 

var MtxANOVA1: TMtxAnova;
begin
  MTxANOVA1 := TMtxANOVA.Create;
  try
    // setup data
    MtxANOVA1.Data.SetIt(6,2,false,[1,2,
                                  2,3,
                                  5,7,
                                  12,1,
                                  5,8,
                                  3,8]);
    MtxANOVA1.IsAnova1 := false; // do two-way ANOVA
    MtxANOVA1.Replications := 3; // three rows per "group"
    // output ANOVA table to StringGrid1
    MtxANOVA1.ResultDest := StringGrid1;
    MtxANOVA1.Recalc;
  finally
    MtxANOVA.Free;
  end;
end;
#include "MtxExpr.hpp"
#include "StatTools.hpp"
void __fastcall Example(TStringGrid *grid1)
{
  TMtxAnova *an1 = new TMtxAnova(this);
  try
  {
    an1->Data->SetIt(6,2,false,OPENARRAY(double,(1,2,
                                  2,3,
                                  5,7,
                                  12,1,
                                  5,8,
                                  3,8)));
    an1->IsAnova1 = false; // do two-way ANOVA
    an1->Replications = 3; // three rows per "group"
    // output ANOVA table to grid1
    an1->ResultDest = grid1;
    an1->Recalc();
  }
  __finally
  {
    an1->Free();
  }
}
Examples on GitHub
Copyright (c) 1999-2024 by Dew Research. All rights reserved.
What do you think about this topic? Send feedback!