test_class.file: jtstoolkit/src/test/java/ec/tstoolkit/modelling/arima/demetra/TradingDaysSelectionModuleTest.java
test_class.identifier: TradingDaysSelectionModuleTest
test_case.body: @Test
      public void testProd() {
          TradingDaysSelectionModule tdm=new TradingDaysSelectionModule(.01, .01);
          ModellingContext context=new ModellingContext();
          context.automodelling=true;
          context.hasseas=true;
          context.description=new ModelDescription(Data.X, null);
          context.description.setAirline(true);
          context.description.setTransformation(DefaultTransformationType.Log);
          tdm.process(context);
  //        System.out.println(new DataBlock(tdm.getPdel()));
  //        System.out.println(new DataBlock(tdm.getPtd()));
  //        System.out.println(tdm.getChoice());
      }
test_case.class_method_signature: TradingDaysSelectionModuleTest.testProd()
test_case.full_signature: @Test public void testProd()
test_case.identifier: testProd
test_case.invocations: setAirline setTransformation process
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testProd()
focal_class.declarator: REGS = "Regression variables"
focal_class.modifier: private static final
focal_class.original_string: private static final String REGS = "Regression variables";
focal_class.type: String
focal_class.var_name: REGS
focal_class.declarator: DEF_MODEL_EPS = .01
focal_class.modifier: private static final
focal_class.original_string: private static final double DEF_MODEL_EPS = .01, DEF_CONSTRAINT_EPS = .01;
focal_class.type: double
focal_class.var_name: DEF_MODEL_EPS
focal_class.declarator: DEF_TD
              = new GenericTradingDays[]{
                  GenericTradingDays.contrasts(DayClustering.TD7),
                  GenericTradingDays.contrasts(DayClustering.TD4),
                  GenericTradingDays.contrasts(DayClustering.TD3),
                  GenericTradingDays.contrasts(DayClustering.TD2)
              }
focal_class.modifier: private static final
focal_class.original_string: private static final GenericTradingDays[] DEF_TD
              = new GenericTradingDays[]{
                  GenericTradingDays.contrasts(DayClustering.TD7),
                  GenericTradingDays.contrasts(DayClustering.TD4),
                  GenericTradingDays.contrasts(DayClustering.TD3),
                  GenericTradingDays.contrasts(DayClustering.TD2)
              };
focal_class.type: GenericTradingDays[]
focal_class.var_name: DEF_TD
focal_class.declarator: tdVars
focal_class.modifier: private final
focal_class.original_string: private final GenericTradingDays[] tdVars;
focal_class.type: GenericTradingDays[]
focal_class.var_name: tdVars
focal_class.declarator: tdModel
focal_class.modifier: private
focal_class.original_string: private PreprocessingModel tdModel;
focal_class.type: PreprocessingModel
focal_class.var_name: tdModel
focal_class.declarator: ntdStats
focal_class.modifier: private
focal_class.original_string: private LikelihoodStatistics ntdStats;
focal_class.type: LikelihoodStatistics
focal_class.var_name: ntdStats
focal_class.declarator: tdStats
focal_class.modifier: private
focal_class.original_string: private LikelihoodStatistics[] tdStats;
focal_class.type: LikelihoodStatistics[]
focal_class.var_name: tdStats
focal_class.declarator: pftd
focal_class.modifier: private final
focal_class.original_string: private final double pftd, pfdel;
focal_class.type: double
focal_class.var_name: pftd
focal_class.declarator: pdel
focal_class.modifier: private
focal_class.original_string: private double[] pdel, ptd, bic;
focal_class.type: double[]
focal_class.var_name: pdel
focal_class.declarator: sigma
focal_class.modifier: private
focal_class.original_string: private double sigma;
focal_class.type: double
focal_class.var_name: sigma
focal_class.declarator: DEF_TVAL = 1.96
focal_class.modifier: private static final
focal_class.original_string: private static final double DEF_TVAL = 1.96;
focal_class.type: double
focal_class.var_name: DEF_TVAL
focal_class.declarator: tval = DEF_TVAL
focal_class.modifier: private
focal_class.original_string: private double tval = DEF_TVAL;
focal_class.type: double
focal_class.var_name: tval
focal_class.declarator: choice
focal_class.modifier: private
focal_class.original_string: private int choice;
focal_class.type: int
focal_class.var_name: choice
focal_class.file: jtstoolkit/src/main/java/ec/tstoolkit/modelling/arima/demetra/TradingDaysSelectionModule.java
focal_class.identifier: TradingDaysSelectionModule
focal_class.interfaces: implements IPreprocessingModule
focal_class.class_method_signature: TradingDaysSelectionModule.TradingDaysSelectionModule(final double pftd, final double pfdel)
focal_class.full_signature: public  TradingDaysSelectionModule(final double pftd, final double pfdel)
focal_class.identifier: TradingDaysSelectionModule
focal_class.modifiers: public
focal_class.parameters: (final double pftd, final double pfdel)
focal_class.signature:  TradingDaysSelectionModule(final double pftd, final double pfdel)
focal_class.class_method_signature: TradingDaysSelectionModule.TradingDaysSelectionModule(final double pftd, final double pfdel, final GenericTradingDays[] td)
focal_class.full_signature: public  TradingDaysSelectionModule(final double pftd, final double pfdel, final GenericTradingDays[] td)
focal_class.identifier: TradingDaysSelectionModule
focal_class.modifiers: public
focal_class.parameters: (final double pftd, final double pfdel, final GenericTradingDays[] td)
focal_class.signature:  TradingDaysSelectionModule(final double pftd, final double pfdel, final GenericTradingDays[] td)
focal_class.class_method_signature: TradingDaysSelectionModule.getPftd()
focal_class.full_signature: public double getPftd()
focal_class.identifier: getPftd
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: double
focal_class.signature: double getPftd()
focal_class.class_method_signature: TradingDaysSelectionModule.getTValue()
focal_class.full_signature: public double getTValue()
focal_class.identifier: getTValue
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: double
focal_class.signature: double getTValue()
focal_class.class_method_signature: TradingDaysSelectionModule.setTvalue(double tval)
focal_class.full_signature: public void setTvalue(double tval)
focal_class.identifier: setTvalue
focal_class.modifiers: public
focal_class.parameters: (double tval)
focal_class.return: void
focal_class.signature: void setTvalue(double tval)
focal_class.class_method_signature: TradingDaysSelectionModule.process(ModellingContext context)
focal_class.full_signature: @Override public ProcessingResult process(ModellingContext context)
focal_class.identifier: process
focal_class.modifiers: @Override public
focal_class.parameters: (ModellingContext context)
focal_class.return: ProcessingResult
focal_class.signature: ProcessingResult process(ModellingContext context)
focal_class.class_method_signature: TradingDaysSelectionModule.calcProb()
focal_class.full_signature: private void calcProb()
focal_class.identifier: calcProb
focal_class.modifiers: private
focal_class.parameters: ()
focal_class.return: void
focal_class.signature: void calcProb()
focal_class.class_method_signature: TradingDaysSelectionModule.createModel(ModellingContext context, GenericTradingDays td, LengthOfPeriodType lp)
focal_class.full_signature: private PreprocessingModel createModel(ModellingContext context, GenericTradingDays td, LengthOfPeriodType lp)
focal_class.identifier: createModel
focal_class.modifiers: private
focal_class.parameters: (ModellingContext context, GenericTradingDays td, LengthOfPeriodType lp)
focal_class.return: PreprocessingModel
focal_class.signature: PreprocessingModel createModel(ModellingContext context, GenericTradingDays td, LengthOfPeriodType lp)
focal_class.class_method_signature: TradingDaysSelectionModule.check(GenericTradingDays td, LengthOfPeriodType lp)
focal_class.full_signature: private LikelihoodStatistics check(GenericTradingDays td, LengthOfPeriodType lp)
focal_class.identifier: check
focal_class.modifiers: private
focal_class.parameters: (GenericTradingDays td, LengthOfPeriodType lp)
focal_class.return: LikelihoodStatistics
focal_class.signature: LikelihoodStatistics check(GenericTradingDays td, LengthOfPeriodType lp)
focal_class.class_method_signature: TradingDaysSelectionModule.backModel(ModellingContext context, GenericTradingDays td, LengthOfPeriodType lp, boolean mean)
focal_class.full_signature: private ModelDescription backModel(ModellingContext context, GenericTradingDays td, LengthOfPeriodType lp, boolean mean)
focal_class.identifier: backModel
focal_class.modifiers: private
focal_class.parameters: (ModellingContext context, GenericTradingDays td, LengthOfPeriodType lp, boolean mean)
focal_class.return: ModelDescription
focal_class.signature: ModelDescription backModel(ModellingContext context, GenericTradingDays td, LengthOfPeriodType lp, boolean mean)
focal_class.class_method_signature: TradingDaysSelectionModule.checkLY(PreprocessingModel model)
focal_class.full_signature: private boolean checkLY(PreprocessingModel model)
focal_class.identifier: checkLY
focal_class.modifiers: private
focal_class.parameters: (PreprocessingModel model)
focal_class.return: boolean
focal_class.signature: boolean checkLY(PreprocessingModel model)
focal_class.class_method_signature: TradingDaysSelectionModule.addLPInfo(PreprocessingModel model, double tstat)
focal_class.full_signature: private void addLPInfo(PreprocessingModel model, double tstat)
focal_class.identifier: addLPInfo
focal_class.modifiers: private
focal_class.parameters: (PreprocessingModel model, double tstat)
focal_class.return: void
focal_class.signature: void addLPInfo(PreprocessingModel model, double tstat)
focal_class.class_method_signature: TradingDaysSelectionModule.addEasterInfo(PreprocessingModel model, double tstat)
focal_class.full_signature: private void addEasterInfo(PreprocessingModel model, double tstat)
focal_class.identifier: addEasterInfo
focal_class.modifiers: private
focal_class.parameters: (PreprocessingModel model, double tstat)
focal_class.return: void
focal_class.signature: void addEasterInfo(PreprocessingModel model, double tstat)
focal_class.class_method_signature: TradingDaysSelectionModule.addTDInfo(ModellingContext context, double pwd, double ptd, double pdel, int sel)
focal_class.full_signature: private void addTDInfo(ModellingContext context, double pwd, double ptd, double pdel, int sel)
focal_class.identifier: addTDInfo
focal_class.modifiers: private
focal_class.parameters: (ModellingContext context, double pwd, double ptd, double pdel, int sel)
focal_class.return: void
focal_class.signature: void addTDInfo(ModellingContext context, double pwd, double ptd, double pdel, int sel)
focal_class.class_method_signature: TradingDaysSelectionModule.getTdStats()
focal_class.full_signature: public LikelihoodStatistics[] getTdStats()
focal_class.identifier: getTdStats
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: LikelihoodStatistics[]
focal_class.signature: LikelihoodStatistics[] getTdStats()
focal_class.class_method_signature: TradingDaysSelectionModule.getPdel()
focal_class.full_signature: public double[] getPdel()
focal_class.identifier: getPdel
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: double[]
focal_class.signature: double[] getPdel()
focal_class.class_method_signature: TradingDaysSelectionModule.getPtd()
focal_class.full_signature: public double[] getPtd()
focal_class.identifier: getPtd
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: double[]
focal_class.signature: double[] getPtd()
focal_class.class_method_signature: TradingDaysSelectionModule.getChoice()
focal_class.full_signature: public int getChoice()
focal_class.identifier: getChoice
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: int
focal_class.signature: int getChoice()
focal_class.class_method_signature: TradingDaysSelectionModule.getBic()
focal_class.full_signature: public double[] getBic()
focal_class.identifier: getBic
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: double[]
focal_class.signature: double[] getBic()
focal_class.class_method_signature: TradingDaysSelectionModule.getTdVars()
focal_class.full_signature: public GenericTradingDays[] getTdVars()
focal_class.identifier: getTdVars
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: GenericTradingDays[]
focal_class.signature: GenericTradingDays[] getTdVars()
focal_class.class_method_signature: TradingDaysSelectionModule.getTdModel()
focal_class.full_signature: public PreprocessingModel getTdModel()
focal_class.identifier: getTdModel
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: PreprocessingModel
focal_class.signature: PreprocessingModel getTdModel()
focal_class.class_method_signature: TradingDaysSelectionModule.getNtdStats()
focal_class.full_signature: public LikelihoodStatistics getNtdStats()
focal_class.identifier: getNtdStats
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: LikelihoodStatistics
focal_class.signature: LikelihoodStatistics getNtdStats()
focal_class.superclass: extends DemetraModule
focal_method.body: @Override
      public ProcessingResult process(ModellingContext context) {
          tdStats = new LikelihoodStatistics[tdVars.length];
          // Computes the more general model, the parameters are kept in more restrivitve models
          PreprocessingModel tdm = createModel(context, tdVars[0], LengthOfPeriodType.LeapYear);
          if (tdm == null) {
              return ProcessingResult.Failed;
          }
          tdModel = tdm;
          ConcentratedLikelihood ll = tdm.estimation.getLikelihood();
          tdStats[0] = tdm.estimation.getStatistics();
          int nhp = tdm.description.getArimaComponent().getFreeParametersCount();
          int df = ll.getN() - ll.getNx() - nhp;
          sigma = ll.getSsqErr() / df;
          ntdStats = check(null, LengthOfPeriodType.LeapYear);
  
          // compute the other models
          for (int i = 1; i < tdVars.length; ++i) {
              tdStats[i] = check(tdVars[i], LengthOfPeriodType.LeapYear);
          }
  
          calcProb();
  
          int sel = 0;
          choice = -1;
          for (int i = 0; i < pdel.length; ++i) {
              if (pdel[i] < pfdel && ptd[i] < pftd) {
                  choice = i;
                  break;
              }
          }
          if (choice < 0 && ptd[pdel.length] < pftd) {// Prefer TD
              choice = pdel.length;
  
          }
  //        addTDInfo(context, 1 - pwd, 1 - ptd, 1 - pdel, sel);
          GenericTradingDays best = choice < 0 ? null : tdVars[choice];
          tdModel = createModel(context, best, LengthOfPeriodType.LeapYear);
          if (best == null || !checkLY(tdModel)) {
              boolean mean = Math.abs(tdModel.estimation.getLikelihood().getTStats(true, 2)[0]) > 1.96;
              context.description = backModel(context, best, LengthOfPeriodType.None, mean);
          } else {
              boolean mean = Math.abs(tdModel.estimation.getLikelihood().getTStats(true, 2)[0]) > 1.96;
              context.description = backModel(context, best, LengthOfPeriodType.LeapYear, mean);
          }
          context.estimation = null;
          return ProcessingResult.Changed;
      }
focal_method.class_method_signature: TradingDaysSelectionModule.process(ModellingContext context)
focal_method.full_signature: @Override public ProcessingResult process(ModellingContext context)
focal_method.identifier: process
focal_method.invocations: createModel getLikelihood getStatistics getFreeParametersCount getArimaComponent getN getNx getSsqErr check check calcProb createModel checkLY abs getTStats getLikelihood backModel abs getTStats getLikelihood backModel
focal_method.modifiers: @Override public
focal_method.parameters: (ModellingContext context)
focal_method.return: ProcessingResult
focal_method.signature: ProcessingResult process(ModellingContext context)