test_class.declarator: EPS = 1e-5
test_class.modifier: private static final
test_class.original_string: private static final double EPS = 1e-5;
test_class.type: double
test_class.var_name: EPS
test_class.file: jtstoolkit/src/test/java/ec/satoolkit/seats/WienerKolmogorovEstimatorTest.java
test_class.identifier: WienerKolmogorovEstimatorTest
test_case.body: @Test
      public void testAirline() {
          DefaultModelDecomposer decomposer = new DefaultModelDecomposer(false);
          DescriptiveStatistics tstats = new DescriptiveStatistics(Data.X);
          double range = tstats.getMax() - tstats.getMin();
          for (int i = 1; i <= 19; i+=2) {
              for (int j = 1; j <= 19; j+=2) {
                  SarimaModel arima = new SarimaModelBuilder().createAirlineModel(12, i * .1 - 1, j * .1 - 1);
                  SeatsModel seats = new SeatsModel(Data.X, arima, false);
                  UcarimaModel ucm = decomposer.decompose(seats, null, null);
                  //System.out.println(arima);
                  if (ucm != null) {
                      WienerKolmogorovEstimator wk = new WienerKolmogorovEstimator(-1);
                      DefaultSeriesDecomposition sa1 = wk.decompose(seats, ucm, null, null);
                      KalmanEstimator kl = new KalmanEstimator(-1);
                      DefaultSeriesDecomposition sa2 = kl.decompose(seats, ucm, null, null);
                      TsData t1 = sa1.getSeries(ComponentType.Trend, ComponentInformation.Value);
                      TsData t2 = sa2.getSeries(ComponentType.Trend, ComponentInformation.Value);
                      double d = t1.distance(t2) / range;
  //                    System.out.println(d);
  //                    System.out.print(i);
  //                    System.out.print('\t');
  //                    System.out.print(j);
  //                    System.out.print('\t');
  //                    System.out.print(d);
                      assertTrue(d < EPS);
                      t1 = sa1.getSeries(ComponentType.Seasonal, ComponentInformation.Value);
                      t2 = sa2.getSeries(ComponentType.Seasonal, ComponentInformation.Value);
                      d = t1.distance(t2) / range;
                      //                   System.out.println(d);
  //                    System.out.print('\t');
  //                    System.out.print(d);
                      assertTrue(d < EPS);
                      seats.setMeanCorrection(true);
                      sa1 = wk.decompose(seats, ucm, null, null);
                      sa2 = kl.decompose(seats, ucm, null, null);
                      t1 = sa1.getSeries(ComponentType.Trend, ComponentInformation.Value);
                      t2 = sa2.getSeries(ComponentType.Trend, ComponentInformation.Value);
                      d = t1.distance(t2) / range;
                      //                   System.out.println(d);
  //                    System.out.print('\t');
  //                    System.out.print(d);
                      assertTrue(d < EPS);
                      t1 = sa1.getSeries(ComponentType.Seasonal, ComponentInformation.Value);
                      t2 = sa2.getSeries(ComponentType.Seasonal, ComponentInformation.Value);
                      d = t1.distance(t2) / range;
                      //                  System.out.println(d);
  //                    System.out.print('\t');
  //                    System.out.println(d);
                      assertTrue(d < EPS);
                  }
              }
          }
      }
test_case.class_method_signature: WienerKolmogorovEstimatorTest.testAirline()
test_case.full_signature: @Test public void testAirline()
test_case.identifier: testAirline
test_case.invocations: getMax getMin createAirlineModel decompose decompose decompose getSeries getSeries distance assertTrue getSeries getSeries distance assertTrue setMeanCorrection decompose decompose getSeries getSeries distance assertTrue getSeries getSeries distance assertTrue
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testAirline()
focal_class.declarator: npred
focal_class.modifier: private final
focal_class.original_string: private final int npred;
focal_class.type: int
focal_class.var_name: npred
focal_class.file: jtstoolkit/src/main/java/ec/satoolkit/seats/WienerKolmogorovEstimator.java
focal_class.identifier: WienerKolmogorovEstimator
focal_class.interfaces: implements IComponentsEstimator
focal_class.class_method_signature: WienerKolmogorovEstimator.nf(TsFrequency freq)
focal_class.full_signature: private int nf(TsFrequency freq)
focal_class.identifier: nf
focal_class.modifiers: private
focal_class.parameters: (TsFrequency freq)
focal_class.return: int
focal_class.signature: int nf(TsFrequency freq)
focal_class.class_method_signature: WienerKolmogorovEstimator.WienerKolmogorovEstimator(int npred)
focal_class.full_signature: public  WienerKolmogorovEstimator(int npred)
focal_class.identifier: WienerKolmogorovEstimator
focal_class.modifiers: public
focal_class.parameters: (int npred)
focal_class.signature:  WienerKolmogorovEstimator(int npred)
focal_class.class_method_signature: WienerKolmogorovEstimator.decompose(SeatsModel model, UcarimaModel ucm,
              InformationSet info, SeatsContext context)
focal_class.full_signature: @Override public DefaultSeriesDecomposition decompose(SeatsModel model, UcarimaModel ucm,
              InformationSet info, SeatsContext context)
focal_class.identifier: decompose
focal_class.modifiers: @Override public
focal_class.parameters: (SeatsModel model, UcarimaModel ucm,
              InformationSet info, SeatsContext context)
focal_class.return: DefaultSeriesDecomposition
focal_class.signature: DefaultSeriesDecomposition decompose(SeatsModel model, UcarimaModel ucm,
              InformationSet info, SeatsContext context)
focal_class.class_method_signature: WienerKolmogorovEstimator.checkModel(UcarimaModel ucm)
focal_class.full_signature: private UcarimaModel checkModel(UcarimaModel ucm)
focal_class.identifier: checkModel
focal_class.modifiers: private
focal_class.parameters: (UcarimaModel ucm)
focal_class.return: UcarimaModel
focal_class.signature: UcarimaModel checkModel(UcarimaModel ucm)
focal_method.body: @Override
      public DefaultSeriesDecomposition decompose(SeatsModel model, UcarimaModel ucm,
              InformationSet info, SeatsContext context) {
          DefaultSeriesDecomposition decomposition = new DefaultSeriesDecomposition(
                  DecompositionMode.Additive);
          BurmanEstimatesC burman = new BurmanEstimatesC();
  //	BurmanEstimates burman = new BurmanEstimates();
          UcarimaModel ucmc = ucm.clone();
          ucmc.compact(2, 2);
  
          TsData s = model.getSeries();
          int nf = nf(s.getFrequency());
          TsDomain fdomain = new TsDomain(s.getEnd(), nf);
          burman.setForecastsCount(nf);
  
          // check the ucarima model. 
          // ucm=checkModel(ucm);
          if (model.isMeanCorrection()) {
              burman.setUcarimaModelWithMean(ucmc);
          } else {
              burman.setUcarimaModel(ucmc);
          }
          burman.setData(s);
          burman.setSer(model.getSer());
          int ncmps = ucmc.getComponentsCount();
  
          TsData[] cmps = new TsData[ncmps];
          TsData[] fcmps = new TsData[ncmps];
          TsData[] ecmps = new TsData[ncmps];
          TsData[] efcmps = new TsData[ncmps];
  
          for (int i = 0; i < ncmps; ++i) {
              if (i == 0 || !ucmc.getComponent(i).isNull()) {
                  double[] tmp = burman.estimates(i, true);
                  cmps[i] = new TsData(s.getStart(), tmp, false);
                  ecmps[i] = new TsData(s.getStart(), burman.stdevEstimates(i), false);
                  tmp = burman.forecasts(i, true);
                  if (tmp != null) {
                      fcmps[i] = new TsData(s.getEnd(), tmp, false);
                  }
                  tmp = burman.stdevForecasts(i, true);
                  if (tmp != null) {
                      efcmps[i] = new TsData(s.getEnd(), tmp, false);
                  }
              }
          }
  
          TsData fs = new TsData(s.getEnd(), burman.getSeriesForecasts(), false);
          TsData efs = null, efsa = null;
          for (int i = 0; i < efcmps.length; ++i) {
              if (efcmps[i] != null) {
                  TsData var = efcmps[i].times(efcmps[i]);
                  efs = TsData.add(efs, var);
                  if (i != 1) {
                      efsa = TsData.add(efsa, var);
                  }
  
              }
          }
  
          decomposition.add(s, ComponentType.Series);
          decomposition.add(fs.fittoDomain(fdomain), ComponentType.Series, ComponentInformation.Forecast);
          if (efs != null) {
              decomposition.add(efs.fittoDomain(fdomain).sqrt(), ComponentType.Series, ComponentInformation.StdevForecast);
          }
          if (cmps[0] != null) {
              decomposition.add(cmps[0], ComponentType.Trend);
          }
          if (cmps[1] != null) {
              decomposition.add(cmps[1], ComponentType.Seasonal);
          }
  
          if (fcmps[0] != null) {
              decomposition.add(fcmps[0].fittoDomain(fdomain), ComponentType.Trend, ComponentInformation.Forecast);
          }
          if (fcmps[1] != null) {
              decomposition.add(fcmps[1].fittoDomain(fdomain), ComponentType.Seasonal, ComponentInformation.Forecast);
          }
          decomposition.add(TsData.subtract(fs, fcmps[1]),
                  ComponentType.SeasonallyAdjusted, ComponentInformation.Forecast);
          if (ecmps[0] != null) {
              decomposition.add(ecmps[0], ComponentType.Trend, ComponentInformation.Stdev);
          }
          if (efcmps[0] != null) {
              decomposition.add(efcmps[0], ComponentType.Trend, ComponentInformation.StdevForecast);
          }
          decomposition.add(TsData.subtract(s, cmps[1]),
                  ComponentType.SeasonallyAdjusted);
          if (ecmps[1] != null) {
              decomposition.add(ecmps[1], ComponentType.Seasonal, ComponentInformation.Stdev);
              decomposition.add(ecmps[1], ComponentType.SeasonallyAdjusted, ComponentInformation.Stdev);
              decomposition.add(efsa.sqrt(), ComponentType.SeasonallyAdjusted, ComponentInformation.StdevForecast);
          }
          if (efcmps[1] != null) {
              decomposition.add(efcmps[1], ComponentType.Seasonal, ComponentInformation.StdevForecast);
          }
          decomposition.add(cmps[2], ComponentType.Irregular);
          if (fcmps[2] != null) {
              decomposition.add(fcmps[2], ComponentType.Irregular, ComponentInformation.Forecast);
          }
          if (ecmps[2] != null) {
              decomposition.add(ecmps[2], ComponentType.Irregular, ComponentInformation.Stdev);
          }
          if (efcmps[2] != null) {
              decomposition.add(efcmps[2], ComponentType.Irregular, ComponentInformation.StdevForecast);
          }
  
          return decomposition;
      }
focal_method.class_method_signature: WienerKolmogorovEstimator.decompose(SeatsModel model, UcarimaModel ucm,
              InformationSet info, SeatsContext context)
focal_method.full_signature: @Override public DefaultSeriesDecomposition decompose(SeatsModel model, UcarimaModel ucm,
              InformationSet info, SeatsContext context)
focal_method.identifier: decompose
focal_method.invocations: clone compact getSeries nf getFrequency getEnd setForecastsCount isMeanCorrection setUcarimaModelWithMean setUcarimaModel setData setSer getSer getComponentsCount isNull getComponent estimates getStart getStart stdevEstimates forecasts getEnd stdevForecasts getEnd getEnd getSeriesForecasts times add add add add fittoDomain add sqrt fittoDomain add add add fittoDomain add fittoDomain add subtract add add add subtract add add add sqrt add add add add add
focal_method.modifiers: @Override public
focal_method.parameters: (SeatsModel model, UcarimaModel ucm,
              InformationSet info, SeatsContext context)
focal_method.return: DefaultSeriesDecomposition
focal_method.signature: DefaultSeriesDecomposition decompose(SeatsModel model, UcarimaModel ucm,
              InformationSet info, SeatsContext context)