Clone: IStatMethod;
Clone(): Prognoz.Platform.Interop.Stat.IStatMethod;
The Clone method clones a statistical method object.
To execute the example, add a link to the Stat system assembly.
Sub UserProc;
Sub PrintResult(Count: Integer; Method: ISmLinearRegress);
Var
i: Integer;
d0: Double;
Begin
For i := 0 To Count Do
d0 := Method.Fitted[i];
Debug.WriteLine(i.ToString + ", " + d0.ToString);
End For;
End Sub PrintResult;
Var
LR: SmLinearRegress;
LRClone: ISmLinearRegress;
can: Array Of Double;
res, Count: Integer;
Error: String;
Begin
LR := New SmLinearRegress.Create;
can := New Double[5];
can[00] := 6209;
can[01] := 6385;
can[02] := 6752;
can[03] := 6837;
can[04] := 6495;
LR.Explained.Value := can;
res := LR.Execute;
Debug.WriteLine(res);
Error := LR.Errors;
Debug.WriteLine(Error);
Count := LR.ModelPeriod.LastPoint - 1;
Debug.WriteLine("=== Model series === ");
PrintResult(Count, LR);
LRClone := LR.Clone As ISmLinearRegress;
Count := LRClone.ModelPeriod.LastPoint - 2;
Debug.WriteLine("=== Model series of the clone === ");
PrintResult(Count, LRClone);
End Sub UserProc;
After executing the example, the console window shows the results of calculating the basic method and the results of calculating method's clone.
Imports Prognoz.Platform.Interop.Stat;
…
Public Shared Sub PrintResult(Count: Integer; Method: ISmLinearRegress);
Var
i: Integer;
d0: Double;
Begin
For i := 0 To Count Do
d0 := Method.Fitted.GetValue(i) As Double;
System.Diagnostics.Debug.WriteLine(i.ToString() + ", " + d0.ToString());
End For;
End Sub;
Public Shared Sub UserProc();
Var
LR: SmLinearRegress;
LRClone: ISmLinearRegress;
can: Array Of Double;
res, Count: Integer;
Error: String;
Begin
LR := New SmLinearRegress.Create();
can := New Double[5];
can[00] := 6209;
can[01] := 6385;
can[02] := 6752;
can[03] := 6837;
can[04] := 6495;
LR.Explained.Value := can;
res := LR.Execute();
System.Diagnostics.Debug.WriteLine(res);
Error := LR.Errors;
System.Diagnostics.Debug.WriteLine(Error);
Count := LR.ModelPeriod.LastPoint - 1;
System.Diagnostics.Debug.WriteLine("=== Model series === ");
PrintResult(Count, LR);
LRClone := LR.Clone() As ISmLinearRegress;
Count := LRClone.ModelPeriod.LastPoint - 2;
System.Diagnostics.Debug.WriteLine("=== Model series of the clone === ");
PrintResult(Count, LRClone);
End Sub;
After executing the example, the console window shows the results of calculating the basic method and the results of calculating method's clone.
See also: