Regress.ANOVA2 Method

function ANOVA2(const Data: TMtx; out pRows: Double; out pCols: Double; out pInt: Double; Replications: Integer; Alpha: Double): TANOVA2Result;

Performs balanced two-way analysis of variance (ANOVA).

#NameDescription
1DataStores the data to me analyzed.
2ReplicationsDefines the number of rows/cols replications.
3AlphaDesired significance level.
4pRowsReturn the significance probability for the null hypothesis that rows, cols or interacted terms means are equal. These values have some meaning if Replications is more than 1. If any p is less than desired significance alpha then the result suggests the null hypothesis (rows mean, columns mean or interaction mean is not equal) can be rejected.
5pColsReturn the significance probability for the null hypothesis that rows, cols or interacted terms means are equal. These values have some meaning if Replications is more than 1. If any p is less than desired significance alpha then the result suggests the null hypothesis (rows mean, columns mean or interaction mean is not equal) can be rejected.
6pIntReturn the significance probability for the null hypothesis that rows, cols or interacted terms means are equal. These values have some meaning if Replications is more than 1. If any p is less than desired significance alpha then the result suggests the null hypothesis (rows mean, columns mean or interaction mean is not equal) can be rejected.

Returns: TANOVA2Result

Remarks:

Performs balanced two-way analysis of variance on ranks of data contained in Data matrix. The two-way analysis of variance compares the means of two or more rows and two or more columns. The data in different columns can be interpreted as change of one factor and data in different rows can be interpreted as changes in other factor. If there is more than one observation per row/column then you can set the number of row/column replications by changing Replications value to appropriate factor. An exception will be raised if (Data.Rows mod Replications) is not zero. Example layout for replication factor 2:

        Group1      Group2        Group3       Group4
Trial1  xx          xx            xx           xx
        xx          xx            xx           xx
        xx          xx            xx           xx
Trial2  xx          xx            xx           xx
        xx          xx            xx           xx
        xx          xx            xx           xx

Both trials have 3 samples and data is in 4 groups.

Examples
Uses MtxExpr, Regress, Math387;
procedure Example;
var Data: Matrix;
ANOVARes : TANOVA2Result;
pRows, pCols, pInteract : double;
begin
    Data.SetIt(4,4,false,
    [2.5, 3.2, 4.2, 3.9,
    1.9, 3.5, 3.6, 3.7,
    3.4, 3.5, 3.3, 3.4,
    4.2, 5.0, 3.1, 2.4]);
    ANOVARes := ANOVA2(Data,pRows,pCols,pInteract,1); // no interaction !!
    // ANOVARes =(SS1:0.505; SS2:1.37; SS3:NAN; SS4:6.555; SSTotal:8.43 ;
    // Deg1: 3; Deg2:3 ; Deg3:+NAN; Deg4:9 ; DegTotal:15 ;
    // MS1:0.16833333333 ; MS2:0.45666666667 ; MS3:+NAN ; MS4:0.72833333333 ;
    //FDist1:0.12260277778 ; FDist2:0.33260555556 ; FDist3:+NAN ;
    // FCrit1:3.8625483576 ; FCrit2:3.8625483576 ; FCrit3:+NAN ;
    // pRows: 0.94442876898
    // pCols: 0.80219818603
    // pInteract: 2.0820886898e-307
end;
See Also: Regress.ANOVA1