@Ignore @Test public void testX12() { CompositeResults rslts = X13ProcessingFactory.process(Data.X, X13Specification.RSA5); StationaryVarianceDecomposition var = new StationaryVarianceDecomposition(); var.process(rslts); System.out.println("X12"); System.out.println(var); }
public boolean process(final TsData O, final TsData T, final TsData S, final TsData I, final TsData Cal, final TsData others, final boolean mul) { if (O == null) { return false; } TsData stOc, stCc, Sc, Ic, Calc, Pc; if (mul) { stOc = O.log(); stCc = T != null ? T.log() : null; Sc = S != null ? S.log() : null; Ic = I != null ? I.log() : null; Calc = Cal != null ? Cal.log() : null; Pc = others != null ? others.log() : null; } else { stOc = O; stCc = T; Sc = S; Ic = I; Calc = Cal; Pc = others; } TsData lt = trendComputer.calcLongTermTrend(stCc); stCc = TsData.subtract(stCc, lt); stOc = TsData.subtract(stOc, lt); DescriptiveStatistics stats = new DescriptiveStatistics(stOc); double varO = stats.getVar(); if (stCc != null) { stats = new DescriptiveStatistics(stCc); varC = stats.getVar(); } else { varC = 0; } if (Sc != null) { stats = new DescriptiveStatistics(Sc); varS = stats.getVar(); } else { varS = 0; } if (Ic != null) { stats = new DescriptiveStatistics(Ic); varI = stats.getVar(); } else { varI = 0; } if (Calc != null) { stats = new DescriptiveStatistics(Calc); varCal = stats.getVar(); } else { varCal = 0; } if (Pc != null) { stats = new DescriptiveStatistics(Pc); varP = stats.getVar(); } else { varP = 0; } varP /= varO; varCal /= varO; varS /= varO; varC /= varO; varI /= varO; return true; }
StationaryVarianceDecomposition { public boolean process(final TsData O, final TsData T, final TsData S, final TsData I, final TsData Cal, final TsData others, final boolean mul) { if (O == null) { return false; } TsData stOc, stCc, Sc, Ic, Calc, Pc; if (mul) { stOc = O.log(); stCc = T != null ? T.log() : null; Sc = S != null ? S.log() : null; Ic = I != null ? I.log() : null; Calc = Cal != null ? Cal.log() : null; Pc = others != null ? others.log() : null; } else { stOc = O; stCc = T; Sc = S; Ic = I; Calc = Cal; Pc = others; } TsData lt = trendComputer.calcLongTermTrend(stCc); stCc = TsData.subtract(stCc, lt); stOc = TsData.subtract(stOc, lt); DescriptiveStatistics stats = new DescriptiveStatistics(stOc); double varO = stats.getVar(); if (stCc != null) { stats = new DescriptiveStatistics(stCc); varC = stats.getVar(); } else { varC = 0; } if (Sc != null) { stats = new DescriptiveStatistics(Sc); varS = stats.getVar(); } else { varS = 0; } if (Ic != null) { stats = new DescriptiveStatistics(Ic); varI = stats.getVar(); } else { varI = 0; } if (Calc != null) { stats = new DescriptiveStatistics(Calc); varCal = stats.getVar(); } else { varCal = 0; } if (Pc != null) { stats = new DescriptiveStatistics(Pc); varP = stats.getVar(); } else { varP = 0; } varP /= varO; varCal /= varO; varS /= varO; varC /= varO; varI /= varO; return true; } }
StationaryVarianceDecomposition { public boolean process(final TsData O, final TsData T, final TsData S, final TsData I, final TsData Cal, final TsData others, final boolean mul) { if (O == null) { return false; } TsData stOc, stCc, Sc, Ic, Calc, Pc; if (mul) { stOc = O.log(); stCc = T != null ? T.log() : null; Sc = S != null ? S.log() : null; Ic = I != null ? I.log() : null; Calc = Cal != null ? Cal.log() : null; Pc = others != null ? others.log() : null; } else { stOc = O; stCc = T; Sc = S; Ic = I; Calc = Cal; Pc = others; } TsData lt = trendComputer.calcLongTermTrend(stCc); stCc = TsData.subtract(stCc, lt); stOc = TsData.subtract(stOc, lt); DescriptiveStatistics stats = new DescriptiveStatistics(stOc); double varO = stats.getVar(); if (stCc != null) { stats = new DescriptiveStatistics(stCc); varC = stats.getVar(); } else { varC = 0; } if (Sc != null) { stats = new DescriptiveStatistics(Sc); varS = stats.getVar(); } else { varS = 0; } if (Ic != null) { stats = new DescriptiveStatistics(Ic); varI = stats.getVar(); } else { varI = 0; } if (Calc != null) { stats = new DescriptiveStatistics(Calc); varCal = stats.getVar(); } else { varCal = 0; } if (Pc != null) { stats = new DescriptiveStatistics(Pc); varP = stats.getVar(); } else { varP = 0; } varP /= varO; varCal /= varO; varS /= varO; varC /= varO; varI /= varO; return true; } StationaryVarianceDecomposition();  StationaryVarianceDecomposition(final ILongTermTrendComputer trendComputer); }
StationaryVarianceDecomposition { public boolean process(final TsData O, final TsData T, final TsData S, final TsData I, final TsData Cal, final TsData others, final boolean mul) { if (O == null) { return false; } TsData stOc, stCc, Sc, Ic, Calc, Pc; if (mul) { stOc = O.log(); stCc = T != null ? T.log() : null; Sc = S != null ? S.log() : null; Ic = I != null ? I.log() : null; Calc = Cal != null ? Cal.log() : null; Pc = others != null ? others.log() : null; } else { stOc = O; stCc = T; Sc = S; Ic = I; Calc = Cal; Pc = others; } TsData lt = trendComputer.calcLongTermTrend(stCc); stCc = TsData.subtract(stCc, lt); stOc = TsData.subtract(stOc, lt); DescriptiveStatistics stats = new DescriptiveStatistics(stOc); double varO = stats.getVar(); if (stCc != null) { stats = new DescriptiveStatistics(stCc); varC = stats.getVar(); } else { varC = 0; } if (Sc != null) { stats = new DescriptiveStatistics(Sc); varS = stats.getVar(); } else { varS = 0; } if (Ic != null) { stats = new DescriptiveStatistics(Ic); varI = stats.getVar(); } else { varI = 0; } if (Calc != null) { stats = new DescriptiveStatistics(Calc); varCal = stats.getVar(); } else { varCal = 0; } if (Pc != null) { stats = new DescriptiveStatistics(Pc); varP = stats.getVar(); } else { varP = 0; } varP /= varO; varCal /= varO; varS /= varO; varC /= varO; varI /= varO; return true; } StationaryVarianceDecomposition();  StationaryVarianceDecomposition(final ILongTermTrendComputer trendComputer); ILongTermTrendComputer getTrendComputer(); boolean process(final TsData O, final TsData T, final TsData S, final TsData I, final TsData Cal, final TsData others, final boolean mul); boolean process(IProcResults results); double getVarI(); double getVarS(); double getVarC(); double getVarP(); double getVarTD(); double getVarTotal(); @Override String toString(); }
StationaryVarianceDecomposition { public boolean process(final TsData O, final TsData T, final TsData S, final TsData I, final TsData Cal, final TsData others, final boolean mul) { if (O == null) { return false; } TsData stOc, stCc, Sc, Ic, Calc, Pc; if (mul) { stOc = O.log(); stCc = T != null ? T.log() : null; Sc = S != null ? S.log() : null; Ic = I != null ? I.log() : null; Calc = Cal != null ? Cal.log() : null; Pc = others != null ? others.log() : null; } else { stOc = O; stCc = T; Sc = S; Ic = I; Calc = Cal; Pc = others; } TsData lt = trendComputer.calcLongTermTrend(stCc); stCc = TsData.subtract(stCc, lt); stOc = TsData.subtract(stOc, lt); DescriptiveStatistics stats = new DescriptiveStatistics(stOc); double varO = stats.getVar(); if (stCc != null) { stats = new DescriptiveStatistics(stCc); varC = stats.getVar(); } else { varC = 0; } if (Sc != null) { stats = new DescriptiveStatistics(Sc); varS = stats.getVar(); } else { varS = 0; } if (Ic != null) { stats = new DescriptiveStatistics(Ic); varI = stats.getVar(); } else { varI = 0; } if (Calc != null) { stats = new DescriptiveStatistics(Calc); varCal = stats.getVar(); } else { varCal = 0; } if (Pc != null) { stats = new DescriptiveStatistics(Pc); varP = stats.getVar(); } else { varP = 0; } varP /= varO; varCal /= varO; varS /= varO; varC /= varO; varI /= varO; return true; } StationaryVarianceDecomposition();  StationaryVarianceDecomposition(final ILongTermTrendComputer trendComputer); ILongTermTrendComputer getTrendComputer(); boolean process(final TsData O, final TsData T, final TsData S, final TsData I, final TsData Cal, final TsData others, final boolean mul); boolean process(IProcResults results); double getVarI(); double getVarS(); double getVarC(); double getVarP(); double getVarTD(); double getVarTotal(); @Override String toString();  }