SumSquared: IVarianceAnalysisSumSquared
The SumSquared property returns the sum of deviation squares.
Sub Main;
Var
VA: SmVarianceAnalysis;
res: Integer;
m: Array Of Double;
SS: IVarianceAnalysisSumSquared;
Begin
VA := New SmVarianceAnalysis.Create;
m := New Double[5, 3];
m[0, 0] := 1; m[0, 1] := 4; m[0, 2] := 1;
m[1, 0] := 2; m[1, 1] := 3; m[1, 2] := 2;
m[2, 0] := 3; m[2, 1] := 3; m[2, 2] := 1;
m[3, 0] := 4; m[3, 1] := 1; m[3, 2] := 2;
m[4, 0] := 5; m[4, 1] := 1; m[4, 2] := 1;
VA.Data := m;
VA.AnalysisType := VarianceAnalysisType.TwoFactor; // two-factor analysis
VA.ConfidenceLevel := 0.05;
res := VA.Execute;
If res <> 0 Then
Debug.WriteLine(VA.Errors);
Else
Debug.AssertMsg(False,"Results: ");
Debug.WriteLine("Sum of deviation squares");
SS := VA.SumSquared;
Debug.WriteLine("rows : " + SS.Rows.ToString);
Debug.WriteLine("columns : " + SS.Columns.ToString);
Debug.WriteLine("accuracy : " + SS.Accuracy.ToString);
Debug.WriteLine("Total: " + SS.Total.ToString);
End If;
End Sub Main;
Executing the example displays the results of the variance analysis in the console window:
Module execution started
Results:
Sum of deviation squares
Rows: 0.26666666666666694
Columns: 6.5333333333333341
Error: 18.133333333333297
Total: 24.933333333333326
Module execution finished
See also: