    @Test
    public void probabilityTest(){

        System.out.println("Probability test");

        double[] theta = {-4.0, -3.9, -3.8, -3.7, -3.6, -3.5, -3.4, -3.3, -3.2, -3.1, -3.0, -2.9, -2.8, -2.7, -2.6,
                -2.5, -2.4, -2.3, -2.2, -2.1, -2.0, -1.9, -1.8, -1.7, -1.6, -1.5, -1.4, -1.3, -1.2, -1.1,
                -1.0, -0.9, -0.8, -0.7, -0.6, -0.5, -0.4, -0.3, -0.2, -0.1,  0.0,  0.1,  0.2,  0.3,  0.4,
                0.5,  0.6,  0.7,  0.8,  0.9,  1.0,  1.1, 1.2,  1.3,  1.4,  1.5,  1.6,  1.7,  1.8,  1.9,
                2.0,  2.1,  2.2,  2.3,  2.4,  2.5,  2.6,  2.7,  2.8,  2.9,  3.0,  3.1,  3.2,  3.3,  3.4,
                3.5,  3.6,  3.7,  3.8,  3.9,  4.0};
        double[][] prob = {
                {9.99925e-01,7.46220e-05,6.10908e-10},
                {9.99907e-01,9.30761e-05,9.50443e-10},
                {9.99884e-01,1.16093e-04,1.47868e-09},
                {9.99855e-01,1.44802e-04,2.30049e-09},
                {9.99819e-01,1.80608e-04,3.57901e-09},
                {9.99775e-01,2.25267e-04,5.56803e-09},
                {9.99719e-01,2.80965e-04,8.66234e-09},
                {9.99650e-01,3.50430e-04,1.34761e-08},
                {9.99563e-01,4.37061e-04,2.09645e-08},
                {9.99455e-01,5.45098e-04,3.26133e-08},
                {9.99320e-01,6.79822e-04,5.07335e-08},
                {9.99152e-01,8.47815e-04,7.89187e-08},
                {9.98943e-01,1.05728e-03,1.22757e-07},
                {9.98681e-01,1.31842e-03,1.90938e-07},
                {9.98356e-01,1.64396e-03,2.96967e-07},
                {9.97950e-01,2.04972e-03,4.61838e-07},
                {9.97444e-01,2.55537e-03,7.18170e-07},
                {9.96814e-01,3.18535e-03,1.11663e-06},
                {9.96028e-01,3.97004e-03,1.73591e-06},
                {9.95050e-01,4.94706e-03,2.69810e-06},
                {9.93833e-01,6.16303e-03,4.19261e-06},
                {9.92318e-01,7.67558e-03,6.51299e-06},
                {9.90434e-01,9.55575e-03,1.01138e-05},
                {9.88093e-01,1.18909e-02,1.56980e-05},
                {9.85187e-01,1.47882e-02,2.43513e-05},
                {9.81584e-01,1.83782e-02,3.77476e-05},
                {9.77122e-01,2.28194e-02,5.84614e-05},
                {9.71607e-01,2.83025e-02,9.04418e-05},
                {9.64805e-01,3.50553e-02,1.39726e-04},
                {9.56438e-01,4.33461e-02,2.15502e-04},
                {9.46182e-01,5.34868e-02,3.31686e-04},
                {9.33658e-01,6.58323e-02,5.09213e-04},
                {9.18445e-01,8.07761e-02,7.79332e-04},
                {9.00073e-01,9.87386e-02,1.18824e-03},
                {8.78051e-01,1.20146e-01,1.80346e-03},
                {8.51883e-01,1.45394e-01,2.72223e-03},
                {8.21114e-01,1.74803e-01,4.08231e-03},
                {7.85378e-01,2.08547e-01,6.07490e-03},
                {7.44466e-01,2.46575e-01,8.95907e-03},
                {6.98397e-01,2.88527e-01,1.30761e-02},
                {6.47487e-01,3.33652e-01,1.88610e-02},
                {5.92393e-01,3.80760e-01,2.68474e-02},
                {5.34123e-01,4.28216e-01,3.76611e-02},
                {4.74001e-01,4.74001e-01,5.19982e-02},
                {4.13565e-01,5.15850e-01,7.05849e-02},
                {3.54440e-01,5.51443e-01,9.41170e-02},
                {2.98175e-01,5.78640e-01,1.23184e-01},
                {2.46105e-01,5.95712e-01,1.58184e-01},
                {1.99234e-01,6.01532e-01,1.99234e-01},
                {1.58184e-01,5.95712e-01,2.46105e-01},
                {1.23184e-01,5.78640e-01,2.98175e-01},
                {9.41170e-02,5.51443e-01,3.54440e-01},
                {7.05849e-02,5.15850e-01,4.13565e-01},
                {5.19982e-02,4.74001e-01,4.74001e-01},
                {3.76611e-02,4.28216e-01,5.34123e-01},
                {2.68474e-02,3.80760e-01,5.92393e-01},
                {1.88610e-02,3.33652e-01,6.47487e-01},
                {1.30761e-02,2.88527e-01,6.98397e-01},
                {8.95907e-03,2.46575e-01,7.44466e-01},
                {6.07490e-03,2.08547e-01,7.85378e-01},
                {4.08231e-03,1.74803e-01,8.21114e-01},
                {2.72223e-03,1.45394e-01,8.51883e-01},
                {1.80346e-03,1.20146e-01,8.78051e-01},
                {1.18824e-03,9.87386e-02,9.00073e-01},
                {7.79332e-04,8.07761e-02,9.18445e-01},
                {5.09213e-04,6.58323e-02,9.33658e-01},
                {3.31686e-04,5.34868e-02,9.46182e-01},
                {2.15502e-04,4.33461e-02,9.56438e-01},
                {1.39726e-04,3.50553e-02,9.64805e-01},
                {9.04418e-05,2.83025e-02,9.71607e-01},
                {5.84614e-05,2.28194e-02,9.77122e-01},
                {3.77476e-05,1.83782e-02,9.81584e-01},
                {2.43513e-05,1.47882e-02,9.85187e-01},
                {1.56980e-05,1.18909e-02,9.88093e-01},
                {1.01138e-05,9.55575e-03,9.90434e-01},
                {6.51299e-06,7.67558e-03,9.92318e-01},
                {4.19261e-06,6.16303e-03,9.93833e-01},
                {2.69810e-06,4.94706e-03,9.95050e-01},
                {1.73591e-06,3.97004e-03,9.96028e-01},
                {1.11663e-06,3.18535e-03,9.96814e-01},
                {7.18170e-07,2.55537e-03,9.97444e-01}
        };

        double[] step = {0.0, 0.3, 1.3};
        IrmGPCM model = new IrmGPCM(1.3, step, 1.7);

        assertEquals("  Number of categories test",  3, model.getNcat());
        assertEquals("  Number of parameters test",  4, model.getNumberOfParameters());

        for(int i=0;i<theta.length;i++){
            assertEquals("  Probability test at theta " + i, prob[i][0], model.probability(theta[i], 0), 1e-6);
            assertEquals("  Probability test at theta " + i, prob[i][1], model.probability(theta[i], 1), 1e-6);
            assertEquals("  Probability test at theta " + i, prob[i][2], model.probability(theta[i], 2), 1e-6);
        }


    }