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
| Name | Type | Description |
|---|---|---|
| Alpha | Double | Desired significance probability. |
| Anova1Res | TANOVA1Result | Results of the one way ANOVA. |
| Anova2Res | TANOVA2Result | Results of the two way ANOVA. |
| AutoUpdate | Boolean | If true then changing any of the TMtxAnova properties will trigger the Dew.Stats.TMtxAnova.Recalc method. |
| BlockAssign | Boolean | Block streaming of specific properties when storing only a "template". |
| Data | TMtx | Data for ANOVA. |
| Dirty | Boolean | When any of the TMtxANOVA properties changes, this property is automatically set to true. |
| EditorActive | Boolean | Returns True, if the component editor is displayed. |
| FmtString | String | Numeric format for ANOVA table cells. |
| IsAnova1 | Boolean | One or two-way ANOVA. |
| P | Double | Calculated significance probability of null hypothesis. |
| Reference | TReferenceList | Stores a list of components that have to be notified, when this component is destroyed. |
| Replications | Int32 | Number of observations per data matrix "cell". |
Methods
| Name | Description |
|---|---|
| AllowStreaming | Returns the negatated value of BlockAssign. |
| Assign | Assign values of all published properties from Source. |
| AssignTemplate | Assign values of "template-like" published properties from Source. |
| EditorClass | To be overriden in descendanr classses. |
| LoadFromStream | Load the component from Src stream. |
| LoadTemplateFromFile | Load a template from file. |
| LoadTemplateFromStream | Load a template from stream. |
| Recalc | Triggers ANOVA recalculation. |
| Reset | Reset is called after loading the data from stream or file. |
| SaveTemplateToFile | Save template to file. |
| SaveTemplateToStream | Save template to stream. |
| SaveToStream | Save the component to Dst stream. |