ISeasonal.Mode

Syntax

Mode: SeasonalityType;

Description

The Mode property determines seasonality type.

Example

Sub Main;

Var

Method: SmExponentialSmoothing;

serie: Array Of Double;

status: Integer;

Params: IExponentialSmoothingParameters;

Seasonal: ISeasonal;

Sub Print(Data: Array Of Double);

Var

i: Integer;

CI: ICultureInfo;

Begin

CI := CultureInfo.Current;

Debug.WriteLine("---Begin---");

For i := 0 To Data.Length - 1 Do

If Double.IsNan(Data[i]) Then Debug.WriteLine("---empty---");

Else Debug.WriteLine(CI.FormatDoublePrec(Data[i], 4));

End If;

End For;

Debug.WriteLine("---End---");

End Sub Print;

Begin

Method := New SmExponentialSmoothing.Create;

serie := New Double[12];

serie[0] := 670.2000183;

serie[1] := 576.0680563;

serie[2] := 717.6484268;

serie[3] := 856.9105808;

serie[4] := 885.4609516;

serie[5] := 1011.846431;

serie[6] := 995.4496292;

serie[7] := 1064.74221;

serie[8] := Double.nan;

serie[9] := Double.nan;

serie[10] := Double.nan;

serie[11] := 654.5472579;

Method.Serie.Value := serie;

Method.Forecast.LastPoint := 20;

Method.MissingData.Method := MissingDataMethod.LinInterpolation;

Params := Method.Parameters;

Seasonal := Method.SeasonalComponent;

Seasonal.Mode := SeasonalityType.Additive; // determine seasonality type

Seasonal.Cycle := 4; // determine seasonality period

status := Method.Execute;

If status <> 0 Then

Debug.WriteLine(Method.Errors);

Else

Debug.WriteLine("Source series");

Print(Method.Serie.OriginalValue);

Debug.WriteLine("Obtained series");

Print(Method.Fitted);

End If;

End Sub Main;

After executing the example the console window displays the following result:

Module execution started

Source series

---Begin---

670,2000

576,0681

717,6484

856,9106

885,4610

1 011,8464

995,4496

1 064,7422

---empty---

---empty---

---empty---

654,5473

---End---

Result series

---Begin---

818,3363

810,5101

764,5690

847,8326

762,9619

774,4317

792,5532

905,8385

846,1582

867,3241

857,8295

936,7924

---End---

Module execution finished

See also:

ISeasonal