for t= 14, 15, ...,24.
import com.imsl.stat.*; public class DifferenceEx1 { public static void main(String args[]) { int periods[] = {1, 12}; double[] z = { 112.0, 118.0, 132.0, 129.0, 121.0, 135.0, 148.0, 148.0, 136.0, 119.0, 104.0, 118.0, 115.0, 126.0, 141.0, 135.0, 125.0, 149.0, 170.0, 170.0, 158.00, 133.0, 114.0, 140.0 }; Difference diff = new Difference(); double[] out = diff.compute(z, periods); int nLost = diff.getObservationsLost(); System.out.println("Observations Lost = " + nLost); for (int i = 0; i < out.length; i++) { System.out.println(out[i]); } } }
Observations Lost = 13 NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN 5.0 1.0 -3.0 -2.0 10.0 8.0 0.0 0.0 -8.0 -4.0 12.0Link to Java source.