test_class.file: jtstoolkit/src/test/java/ec/tstoolkit/arima/estimation/OneStepAheadPredictionErrorsTest.java
test_class.identifier: OneStepAheadPredictionErrorsTest
test_case.body: @Test
      public void testSomeMethod() {
          PreprocessingModel process = TramoSpecification.TRfull.build().process(Data.X, null);
          RegArimaModel<SarimaModel> regArima = process.estimation.getRegArima();
          DataBlock errors = OneStepAheadPredictionErrors.errors(regArima);
  //        System.out.println(errors);
          DataBlock cerrors = DataBlock.select(errors, x->Double.isFinite(x));
  //        System.out.println(cerrors);
          assertEquals(cerrors.ssq(), process.estimation.getStatistics().SsqErr, 1e-6);
      }
test_case.class_method_signature: OneStepAheadPredictionErrorsTest.testSomeMethod()
test_case.full_signature: @Test public void testSomeMethod()
test_case.identifier: testSomeMethod
test_case.invocations: process build getRegArima errors select isFinite assertEquals ssq getStatistics
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testSomeMethod()
focal_class.file: jtstoolkit/src/main/java/ec/tstoolkit/arima/estimation/OneStepAheadPredictionErrors.java
focal_class.identifier: OneStepAheadPredictionErrors
focal_class.class_method_signature: OneStepAheadPredictionErrors.errors(RegArimaModel regarima)
focal_class.full_signature: public static DataBlock errors(RegArimaModel regarima)
focal_class.identifier: errors
focal_class.modifiers: public static
focal_class.parameters: (RegArimaModel regarima)
focal_class.return: DataBlock
focal_class.signature: DataBlock errors(RegArimaModel regarima)
focal_method.body: public static DataBlock errors(RegArimaModel regarima) {
          IArimaModel arima = regarima.getArima();
          if (regarima.isMeanCorrection()) {
              // increase differencing order and ma polynomial
              arima = new ArimaModel(arima.getStationaryAR(), arima.getNonStationaryAR().times(BackFilter.D1),
                      arima.getMA().times(BackFilter.D1), arima.getInnovationVariance());
          }
          ISsf ssf;
          SsfArima ssfarima = new SsfArima(arima);
          DataBlock y = regarima.getY().deepClone();
          int nx = regarima.getXCount();
          if (nx > 0) {
              Matrix x = new Matrix(y.getLength(), nx);
              for (int i = 0; i < nx; ++i) {
                  x.column(i).copy(regarima.X(i));
              }
              ssf = new RegSsf(ssfarima, x.all());
          } else {
              ssf = ssfarima;
          }
          Filter filter = new Filter();
          filter.setSsf(ssf);
          filter.setInitializer(new DiffuseSquareRootInitializer());
  
          int[] missings = regarima.getMissings();
          if (missings != null) {
              for (int i = 0; i < missings.length; ++i) {
                  y.set(missings[i], Double.NaN);
              }
          }
          DiffusePredictionErrorDecomposition ped=new DiffusePredictionErrorDecomposition(true);
          
          filter.process(new SsfData(y, null), ped);
          return new DataBlock(ped.residuals(false));
      }
focal_method.class_method_signature: OneStepAheadPredictionErrors.errors(RegArimaModel regarima)
focal_method.full_signature: public static DataBlock errors(RegArimaModel regarima)
focal_method.identifier: errors
focal_method.invocations: getArima isMeanCorrection getStationaryAR times getNonStationaryAR times getMA getInnovationVariance deepClone getY getXCount getLength copy column X all setSsf setInitializer getMissings set process residuals
focal_method.modifiers: public static
focal_method.parameters: (RegArimaModel regarima)
focal_method.return: DataBlock
focal_method.signature: DataBlock errors(RegArimaModel regarima)