SeasonalDummies implements ITsVariable { @Override public void data(TsDomain domain, List<DataBlock> data) { int pstart = domain.getStart().getPosition(); int ifreq = domain.getFrequency().intValue(); int lstart = ifreq - pstart - 1; if (lstart < 0) { lstart += ifreq; } for (int i = 0; i < ifreq - 1; i++) { DataBlock x = data.get(i); int jstart = i - pstart; if (jstart < 0) { jstart += ifreq; } DataBlock m = x.extract(jstart, -1, ifreq); m.set(1); DataBlock q = x.extract(lstart, -1, ifreq); q.set(-1); } } SeasonalDummies(TsFrequency freq); @Override void data(TsDomain domain, List<DataBlock> data); @Override TsDomain getDefinitionDomain(); @Override TsFrequency getDefinitionFrequency(); @Override String getDescription(TsFrequency context); @Override int getDim(); @Override String getItemDescription(int idx, TsFrequency context); @Override boolean isSignificant(TsDomain domain); @Override String getName();  }
@Test public void tesSum() { SeasonalDummies ds=new SeasonalDummies(TsFrequency.Monthly); TsDomain domain =new TsDomain(TsFrequency.Monthly, 1980, 3, 120); Matrix M=new Matrix(120, 11); ds.data(domain, M.columnList()); assertTrue(Math.abs(M.sum())<1e-9 ); }