SpectrumStatistics: ISpectrumStatistics;
The SpectrumStatistics property returns spectral summary statistics.
Sub Main;
Var
sp: SmUnivariateSpectrumAnalysis;
d0: Double;
res, i: Integer;
s96: Array Of Double;
Begin
s96 := New Double[96];
// values s96
s96[0] := 670.2000183; s96[24] := 826.6160466; s96[48] := 785.0711692; s96[72] := 980.5658132;
s96[1] := 576.0680563; s96[25] := 762.3903317; s96[49] := 761.0719932; s96[73] := 866.2215033;
s96[2] := 717.6484268; s96[26] := 931.5707266; s96[50] := 947.4974517; s96[74] := 1126.795343;
s96[3] := 856.9105808; s96[27] := 1026.666524; s96[51] := 1051.614521; s96[75] := 922.6756188;
s96[4] := 885.4609516; s96[28] := 1114.124119; s96[52] := 1038.031434; s96[76] := 1213.484115;
s96[5] := 1011.846431; s96[29] := 1099.626392; s96[53] := 1269.669118; s96[77] := 1429.951109;
s96[6] := 995.4496292; s96[30] := 1189.16892; s96[54] := 1250.568896; s96[78] := 1393.155889;
s96[7] := 1064.74221; s96[31] := 1092.343791; s96[55] := 1242.964721; s96[79] := 1397.839534;
s96[8] := 1033.324656; s96[32] := 1087.503861; s96[56] := 1359.910672; s96[80] := 1560.629719;
s96[9] := 780.8584552; s96[33] := 971.6522721; s96[57] := 1059.43263; s96[81] := 1262.559587;
s96[10] := Double.Nan; s96[34] := 826.2502823; s96[58] := 829.5055086; s96[82] := 1106.38667;
s96[11] := Double.Nan; s96[35] := 789.6322825; s96[59] := 922.226722; s96[83] := 1220.496902;
s96[12] := Double.Nan; s96[36] := 797.0210578; s96[60] := 889.6157109; s96[84] := 1084.077822;
s96[13] := 642.4128544; s96[37] := 770.0206; s96[61] := 889.6514481; s96[85] := Double.Nan;
s96[14] := 751.9611194; s96[38] := 832.1481674; s96[62] := 1055.365032; s96[86] := 1356.982208;
s96[15] := Double.Nan; s96[39] := 1014.565844; s96[63] := 1035.479751; s96[87] := 1302.578692;
s96[16] := 884.5042879; s96[40] := 980.4343089; s96[64] := 1123.232398; s96[88] := 1261.796503;
s96[17] := 1008.308908; s96[41] := 1195.843135; s96[65] := 1080.150853; s96[89] := 1523.625843;
s96[18] := 1108.363628; s96[42] := 1117.405835; s96[66] := 1084.516221; s96[90] := 1432.15598;
s96[19] := 1072.737175; s96[43] := 1142.834834; s96[67] := 1243.115787; s96[91] := 1429.168126;
s96[20] := 1019.183752; s96[44] := 1239.704489; s96[68] := 1430.027497; s96[92] := 1631.452101;
s96[21] := 895.5601672; s96[45] := 964.1215552; s96[69] := 1104.694113; s96[93] := 1202.222633;
s96[22] := 811.0306101; s96[46] := 795.3455; s96[70] := 931.8794214; s96[94] := 1200.217811;
s96[23] := 756.601764; s96[47] := 977.5900449; s96[71] := 1122.668569; s96[95] := 1263.781915;
sp := New SmUnivariateSpectrumAnalysis.Create;
sp.Serie.Value := s96;
sp.ModelPeriod.FirstPoint := 1;
sp.ModelPeriod.LastPoint := 96;
sp.MissingData.Method := MissingDataMethod.SampleAverage;
sp.DataProportion := 0.1;
sp.LagWindow := LagWindowType.Rectangular;
sp.CutOffPoint := 96;
sp.CalculateCovariances := True;
sp.CovariancesCount := 96;
sp.FastFourierTransformOrder := 256;
sp.FrequencyDevision := 256;
sp.LoggedSpectralEstimates := True;
res := sp.Execute;
If res<>0 Then
Debug.WriteLine(sp.Errors);
Else
d0 := sp.SpectrumStatistics.LCL;
Debug.WriteLine("Lower confidence bound: " + d0.ToString);
d0 := sp.SpectrumStatistics.UCL;
Debug.WriteLine("Upper confidence bound: " + d0.ToString);
d0 := sp.SpectrumStatistics.BW;
Debug.WriteLine("Bandwidth: " + d0.ToString);
d0 := sp.SpectrumStatistics.DF;
Debug.WriteLine("Number of degrees of freedom: " + d0.ToString);
End If;
End Sub Main;
After executing the example the console window displays summary characteristics:
Module execution started
Lower confidence bound: -1.6142035050291401
Upper confidence bound: 6.9258488679797523
Bandwidth: 0.032724923474893676
The number of degrees of freedom is 1
Module execution finished
See also: