package com.imsl.test.example.stat; import com.imsl.stat.*; /** *
Computes a lagged difference formula for the airline data excluding * the lost observations.
* *This example uses the same data as {@link DifferenceEx1}. The first number of lost observations are excluded from \(W\) due to differencing, and the number of lost observations is also output.
* @see Code * @see Output */ public class DifferenceEx2 { public static void main(String args[]) { int periods[] = {1, 12}; int nLost; 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(); diff.excludeFirst(true); double[] out = diff.compute(z, periods); nLost = diff.getObservationsLost(); System.out.println("The number of observation lost = " + nLost); for (int i = 0; i < out.length; i++) { System.out.println(out[i]); } } }