public void DrawSeriesData() { Statistic.DrawSeriesData(_processARIMASeries, _startIndex); }
public void DrawErrorData() { Statistic.DrawSeriesData(_errorARIMASeries, _startIndex); }
private void IdentifyARIMAModel(List <double> series, int startIndex, int seasonPartern, out int pRegular, out int qRegular, out int pSeason, out int qSeason) { pRegular = qRegular = pSeason = qSeason = 0; List <double> listAutocorrelation = new List <double>(); List <double> listConfidenceLimit = new List <double>(); List <double> listPartialAutocorrelation = new List <double>(); List <double> listSeasonAutocorrelation = new List <double>(); List <double> listSeasonConfidenceLimit = new List <double>(); List <double> listSeasonPartialCorrelation = new List <double>(); List <double> listRegularAutocorrelation = new List <double>(); List <double> listRegularConfidenceLimit = new List <double>(); List <double> listRegularPartialCorrelation = new List <double>(); Statistic.ComputeAutocorrelation(series, startIndex, out listAutocorrelation); Statistic.ComputePartialAutocorrelation(listAutocorrelation, out listPartialAutocorrelation); Statistic.ComputeConfidenceLimit(listAutocorrelation, series.Count - startIndex, out listConfidenceLimit); double confidenceLimit = 1.96 / Math.Sqrt(series.Count - startIndex); int regularAutocorrelationLengh = seasonPartern; if (seasonPartern == 0) { regularAutocorrelationLengh = listAutocorrelation.Count; } for (int i = 0; i < regularAutocorrelationLengh; i++) { listRegularAutocorrelation.Add(listAutocorrelation[i]); listRegularConfidenceLimit.Add(listConfidenceLimit[i]); listRegularPartialCorrelation.Add(listPartialAutocorrelation[i]); } //Algorithm.DrawAutocorrelation(listRegularAutocorrelation, listRegularConfidenceLimit); //Algorithm.DrawPartialAutocorrelation(listRegularPartialCorrelation, confidenceLimit); DecayPartern decayACF = ComputeDecayPartern(listRegularAutocorrelation, listRegularConfidenceLimit); DecayPartern decayPACF = ComputeDecayPartern(listRegularPartialCorrelation, confidenceLimit); if (decayACF == DecayPartern.ABRUPT_DECAY) { GetLastSignificant(listRegularAutocorrelation, listRegularConfidenceLimit, out qRegular); } if (decayPACF == DecayPartern.ABRUPT_DECAY) { GetLastSignificant(listRegularPartialCorrelation, confidenceLimit, out pRegular); } if (decayACF != DecayPartern.ABRUPT_DECAY && decayPACF != DecayPartern.ABRUPT_DECAY) { pRegular = qRegular = 2; } pRegular = Math.Min(pRegular, Configuration.MAX_REGULAR_ARMA_ORDER); qRegular = Math.Min(qRegular, Configuration.MAX_REGULAR_ARMA_ORDER); if (seasonPartern == 0) { return; } for (int i = 0; i < Math.Floor(1.0 * listAutocorrelation.Count / seasonPartern); i++) { listSeasonAutocorrelation.Add(listAutocorrelation[i * seasonPartern]); listSeasonConfidenceLimit.Add(listConfidenceLimit[i * seasonPartern]); listSeasonPartialCorrelation.Add(listPartialAutocorrelation[i * seasonPartern]); } //Algorithm.DrawAutocorrelation(listSeasonAutocorrelation, listSeasonConfidenceLimit); //Algorithm.DrawPartialAutocorrelation(listSeasonPartialCorrelation, confidenceLimit); DecayPartern decaySeasonACF = ComputeDecayPartern(listSeasonAutocorrelation, listSeasonConfidenceLimit); DecayPartern decaySeasonPACF = ComputeDecayPartern(listSeasonPartialCorrelation, confidenceLimit); if (decaySeasonACF == DecayPartern.ABRUPT_DECAY) { GetLastSignificant(listSeasonAutocorrelation, listSeasonConfidenceLimit, out qSeason); } if (decaySeasonPACF == DecayPartern.ABRUPT_DECAY) { GetLastSignificant(listSeasonPartialCorrelation, confidenceLimit, out pSeason); } if (decaySeasonACF != DecayPartern.ABRUPT_DECAY && decaySeasonPACF != DecayPartern.ABRUPT_DECAY) { pSeason = qSeason = 1; } pSeason = Math.Min(pSeason, Configuration.MAX_SEASON_ARMA_ORDER); qSeason = Math.Min(qSeason, Configuration.MAX_SEASON_ARMA_ORDER); }