Serie: IEmSerie;
Serie: Prognoz.Platform.Interop.Modeller.IEmSerie;
The Serie property determines the source series.
If the source series is not specified, the correct calculation of the Spectrum Analysis method is not possible.
Executing the example requires a form that contains the CheckBox component with the CheckBox1 identifier. Add links to the Modeller, Stat system assemblies.
Sub UnivariateSpectrumAnalysis;
Var
ExprMod: IExpressModeller;
Ar, Cov: Array[14] Of Double;
Serie: IEmSerie;
Sett: IEmUnivariateSpectrumAnalysisSettings;
Period: IEmPeriodSettings;
Begin
ExprMod := New ExpressModeller.Create;
Sett := ExprMod.CreateUnivariateSpectrumAnalysisSettings;
// Setting initial data series
Ar[0] := 5.8; Ar[1] := 5.0; Ar[2] := 2.6; Ar[4] := 7.2;
Ar[5] := 2.8; Ar[6] := 6.2; Ar[7] := 9.5; Ar[8] := 7.4;
Ar[10] := 9.4; Ar[11] := 10; Ar[12] := 5.4; Ar[13] := 8.1;
Ar[3] := Double.Nan; Ar[9] := Double.Nan;
Serie := ExprMod.Series.Add(Ar, "X1", "Data series 1");
Sett.Serie := Serie;
// Setting initial correction type
Sett.InitCorrection := InitCorrectionType.TrendCorrection;
// Setting lag window type
Sett.LagWindow := LagWindowType.Trapezoidal;
// Setting shape parameter
Sett.ShapeParameter := 0.5;
// Setting boundary data share
Sett.DataProportion := 0.1;
// Setting cutoff point
Sett.CutOffPoint := 13;
// Setting covariances number
Sett.CovariancesCount := 14;
// Determining covariances setting mode
If CheckBox1.Checked Then
// Covariances are calculated
Sett.CalculateCovariances := True;
Else
// Covariances are set by the values array
Cov[0] := 0.4; Cov[1] := 1.8; Cov[2] := 3.2;
Cov[3] := 4.6; Cov[4] := 6; Cov[5] := 7.4;
Cov[6] := 8.8; Cov[7] := 10.2; Cov[8] := 11.6;
Cov[9] := 13; Cov[10] := 14.4; Cov[11] := 15.8;
Cov[12] := 17.2; Cov[13] := 18.6;
Sett.Covariances := Cov;
End If;
// Setting fast Fourier transformation order
Sett.FastFourierTransformOrder := 64;
// Setting frequency divider
Sett.FrequencyDevision := 64;
// Not applying spectral estimations shift
Sett.LoggedSpectralEstimates := False;
// Setting calculation periods
Period := Sett.Period;
Period.BeginPeriod := 1;
Period.EndPeriod := 13;
// Performing calculation
ExprMod.EvaluateMethod("C:\UnivariateSpectrumAnalysis.html", Sett, True);
End Sub UnivariateSpectrumAnalysis;
Example execution result: the Spectrum Analysis method is calculated with set parameters. If the CheckBox1 checkbox is deselected, specified covariance values are used; if it is selected, covariances are calculated. Method calculation report is saved to the file C:\UnivariateSpectrumAnalysis.html.
Executing the example requires a form that contains the CheckBox component with the checkBox1 identifier.
Imports Prognoz.Platform.Interop.Modeller;
Imports Prognoz.Platform.Interop.Stat;
…
Public Sub UnivariateSpectrumAnalysis();
Var
ExprMod: IExpressModeller;
Ar, Cov: Array[14] Of Double;
Serie: IEmSerie;
Sett: IEmUnivariateSpectrumAnalysisSettings;
Period: IEmPeriodSettings;
Begin
ExprMod := New ExpressModeller.Create();
Sett := ExprMod.CreateUnivariateSpectrumAnalysisSettings();
// Setting initial data series
Ar[0] := 5.8; Ar[1] := 5.0; Ar[2] := 2.6; Ar[4] := 7.2;
Ar[5] := 2.8; Ar[6] := 6.2; Ar[7] := 9.5; Ar[8] := 7.4;
Ar[10] := 9.4; Ar[11] := 10; Ar[12] := 5.4; Ar[13] := 8.1;
Ar[3] := Double.Nan; Ar[9] := Double.Nan;
Serie := ExprMod.Series.Add(Ar, "X1", "Data series 1");
Sett.Serie := Serie;
// Setting initial correction type
Sett.InitCorrection := InitCorrectionType.icTrendCorrection;
// Setting lag window type
Sett.LagWindow := LagWindowType.lwtTrapezoidal;
// Setting shape parameter
Sett.ShapeParameter := 0.5;
// Setting boundary data share
Sett.DataProportion := 0.1;
// Setting cutoff point
Sett.CutOffPoint := 13;
// Setting covariances number
Sett.CovariancesCount := 14;
// Determining covariances setting mode
If checkBox1.Checked Then
// Covariances are calculated
Sett.CalculateCovariances := True;
Else
// Covariances are set by the values array
Cov[0] := 0.4; Cov[1] := 1.8; Cov[2] := 3.2;
Cov[3] := 4.6; Cov[4] := 6; Cov[5] := 7.4;
Cov[6] := 8.8; Cov[7] := 10.2; Cov[8] := 11.6;
Cov[9] := 13; Cov[10] := 14.4; Cov[11] := 15.8;
Cov[12] := 17.2; Cov[13] := 18.6;
Sett.Covariances := Cov;
End If;
// Setting fast Fourier transformation order
Sett.FastFourierTransformOrder := 64;
// Setting frequency divider
Sett.FrequencyDevision := 64;
// Not applying spectral estimations shift
Sett.LoggedSpectralEstimates := False;
// Setting calculation periods
Period := Sett.Period;
Period.BeginPeriod := 1;
Period.EndPeriod := 13;
// Performing calculation
ExprMod.EvaluateMethod("C:\UnivariateSpectrumAnalysis.html", Sett, True);
End Sub UnivariateSpectrumAnalysis;
Example execution result: the Spectrum Analysis method is calculated with set parameters. If the checkBox1 checkbox is deselected, specified covariance values are used; if it is selected, covariances are calculated. Method calculation report is saved to the file C:\UnivariateSpectrumAnalysis.html.
See also: