TestFunctionInstance(TsData data, IReadDataBlock parameters) { this.data = data; if (parameters != null) { params[0] = parameters.get(0); params[1] = parameters.get(1); } int n = data.getLength(); int freq = data.getFrequency().intValue(); S = new Matrix(n, freq - 1); SeasonalDummies s = new SeasonalDummies(data.getFrequency()); s.data(data.getDomain(), S.columnList()); ssfdata = new SsfData(data.getValues().internalStorage(), null); SsfRwAr1 rwar1 = new SsfRwAr1(); rwar1.setRho(params[0]); ssf = new RwExtendedSsf(rwar1, S.subMatrix(), params[1] * params[1]); }
double[] scomponent() { DisturbanceSmoother smoother = new DisturbanceSmoother(); smoother.setSsf(ssf); smoother.process(ssfdata); SmoothingResults sstates = smoother.calcSmoothedStates(); double[] cmp = new double[ssfdata.getCount()]; DataBlock z = new DataBlock(ssf.getStateDim()); DataBlock zc = z.drop(2, 0); for (int i = 0; i < cmp.length; ++i) { zc.copy(S.row(i)); cmp[i] = sstates.zcomponent(i, z); } return cmp; }