public static LinearModel fit(Formula formula, DataFrame data) {
        return fit(formula, data, new Properties());
    }
@Test
    public void testLongley() throws Exception {
        System.out.println("Longley");

        LinearModel model = OLS.fit(Longley.formula, Longley.data);
        System.out.println(model);

        assertEquals(12.8440, model.RSS(), 1E-4);
        assertEquals(1.1946, model.error(), 1E-4);
        assertEquals(9, model.df());
        assertEquals(0.9926, model.RSquared(), 1E-4);
        assertEquals(0.9877, model.adjustedRSquared(), 1E-4);
        assertEquals(202.5094, model.ftest(), 1E-4);
        assertEquals(4.42579E-9, model.pvalue(), 1E-14);

        double[][] ttest = {
                {2946.85636, 5647.97658,   0.522,   0.6144},
                {   0.26353,    0.10815,   2.437,   0.0376},
                {   0.03648,    0.03024,   1.206,   0.2585},
                {   0.01116,    0.01545,   0.722,   0.4885},
                {  -1.73703,    0.67382,  -2.578,   0.0298},
                {  -1.41880,    2.94460,  -0.482,   0.6414},
                {   0.23129,    1.30394,   0.177,   0.8631}
        };

        double[] residuals = {
                -0.6008156,  1.5502732,  0.1032287, -1.2306486, -0.3355139,  0.2693345,  0.8776759,
                0.1222429, -2.0086121, -0.4859826,  1.0663129,  1.2274906, -0.3835821,  0.2710215,
                0.1978569, -0.6402823
        };

        for (int i = 0; i < ttest.length; i++) {
            for (int j = 0; j < 4; j++) {
                assertEquals(ttest[i][j], model.ttest()[i][j], 1E-3);
            }
        }

        for (int i = 0; i < residuals.length; i++) {
            assertEquals(residuals[i], model.residuals()[i], 1E-4);
        }

        java.nio.file.Path temp = Write.object(model);
        Read.object(temp);

        // Test with data without response variable.
        DataFrame test = Longley.data.drop("deflator");
        model.predict(test);
    }