TMtxAnova Class

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

public class TMtxAnova : TMtxComponent

Visual representation of One and Two way ANOVA.

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?

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

Results:

  • If you specified ResultDest then the standard ANOVA table will be written to ResultDest string grid. If ResultDest is nil, you can still use WriteResultToGrid or WriteResultToStrings methods to output ANOVA table to a TStringGrid or TStrings.
  • Dew.Stats.TMtxAnova.P returns the significance probability of null hypothesis that means are equal. If P is less than desired significance Dew.Stats.TMtxAnova.Alpha then the result suggests, the null hypothesis (means are equal) can be rejected.

Examples

csharp
using Dew.Stats.Units;
using Dew.Stats;
using Dew.Math;
namespace Dew.Examples
{
    private void Example()
    {
        TMtxAnova an1 = new TMtxAnova(this);
        try
        {
            an1.Data.SetIt(6, 2, false, new 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.Recalc();
            double aresult = an1.Anova2Res.FCrit;
        }
        finally
        {
            an1.Free();
        }
    }
}

Properties

NameTypeDescription
AlphaDoubleDesired significance probability.
Anova1ResTANOVA1ResultResults of the one way ANOVA.
Anova2ResTANOVA2ResultResults of the two way ANOVA.
AutoUpdateBooleanIf true then changing any of the TMtxAnova properties will trigger the Dew.Stats.TMtxAnova.Recalc method.
BlockAssignBooleanBlock streaming of specific properties when storing only a "template".
DataTMtxData for ANOVA.
DirtyBooleanWhen any of the TMtxANOVA properties changes, this property is automatically set to true.
EditorActiveBooleanReturns True, if the component editor is displayed.
FmtStringStringNumeric format for ANOVA table cells.
IsAnova1BooleanOne or two-way ANOVA.
PDoubleCalculated significance probability of null hypothesis.
ReferenceTReferenceListStores a list of components that have to be notified, when this component is destroyed.
ReplicationsInt32Number of observations per data matrix "cell".

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 ANOVA 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.