List of usage examples for org.apache.commons.math3.stat.descriptive.moment StandardDeviation getN
public long getN()
From source file:com.itemanalysis.psychometrics.irt.equating.MeanSigmaMethodTest.java
/** * Tests the calculations needed for mean/mean and mean/sigma scale linking. * Item parameters and true values obtained from example 2 from the STUIRT * program by Michael Kolen and colleagues. Note that the original example * used teh PARSCALE version of item parameters. These were converted to * ICL type parameters by subtracting a step from the item difficulty. * *///from www . j av a 2s. c o m @Test public void mixedFormatDescriptiveStatisticsTestFormX() { System.out.println("Mixed format descriptive statistics test Form X"); ItemResponseModel[] irm = new ItemResponseModel[17]; irm[0] = new Irm3PL(0.751335, -0.897391, 0.244001, 1.7); irm[1] = new Irm3PL(0.955947, -0.811477, 0.242883, 1.7); irm[2] = new Irm3PL(0.497206, -0.858681, 0.260893, 1.7); irm[3] = new Irm3PL(0.724000, -0.123911, 0.243497, 1.7); irm[4] = new Irm3PL(0.865200, 0.205889, 0.319135, 1.7); irm[5] = new Irm3PL(0.658129, 0.555228, 0.277826, 1.7); irm[6] = new Irm3PL(1.082118, 0.950549, 0.157979, 1.7); irm[7] = new Irm3PL(0.988294, 1.377501, 0.084828, 1.7); irm[8] = new Irm3PL(1.248923, 1.614355, 0.181874, 1.7); irm[9] = new Irm3PL(1.116682, 2.353932, 0.246856, 1.7); irm[10] = new Irm3PL(0.438171, 3.217965, 0.309243, 1.7); irm[11] = new Irm3PL(1.082206, 4.441864, 0.192339, 1.7); double[] step1 = { 0, -1.09327, 1.101266 }; irm[12] = new IrmGPCM(0.269994, step1, 1.7); double[] step2 = { 0, 1.526148, 1.739176 }; irm[13] = new IrmGPCM(0.972506, step2, 1.7); double[] step3 = { 0, 1.362356, 5.566958 }; irm[14] = new IrmGPCM(0.378812, step3, 1.7); double[] step4 = { 0, 1.486566, -0.071229, 1.614823 }; irm[15] = new IrmGPCM(0.537706, step4, 1.7); double[] step5 = { 0, 1.425413, 2.630705, 3.242696 }; irm[16] = new IrmGPCM(0.554506, step5, 1.7); Mean discriminationX = new Mean(); Mean difficultyX = new Mean(); Mean difficultyMeanX = new Mean(); StandardDeviation difficultySdX = new StandardDeviation(false);//Do not correct for bias. Use N in the denominator, not N-1. for (int j = 0; j < 17; j++) { irm[j].incrementMeanMean(discriminationX, difficultyX); irm[j].incrementMeanSigma(difficultyMeanX, difficultySdX); } // System.out.println("Mean/mean descriptive statistics for Form X"); // System.out.println("a-mean: " + discriminationX.getResult()); // System.out.println("b-mean: " + difficultyX.getResult()); assertEquals("Mean/mean check: discrimination mean", 0.7719, Precision.round(discriminationX.getResult(), 4), 1e-5); assertEquals("Mean/mean check: difficulty mean", 1.3566, Precision.round(difficultyX.getResult(), 4), 1e-5); assertEquals("Mean/mean check: Number of difficulties (including steps) ", 24, difficultyX.getN(), 1e-3); // System.out.println(); // System.out.println("Mean/sigma descriptive statistics for Form X"); // System.out.println("b-mean: " + difficultyMeanX.getResult()); // System.out.println("b-sd: " + difficultySdX.getResult()); // System.out.println("b-N: " + difficultyMeanX.getN() + ", " + difficultySdX.getN()); assertEquals("Mean/sigma check: difficulty mean", 1.3566, Precision.round(difficultyMeanX.getResult(), 4), 1e-5); assertEquals("Mean/sigma check: difficulty sd", 1.6372, Precision.round(difficultySdX.getResult(), 4), 1e-5); assertEquals("Mean/sigma check: Number of difficulties (including steps) ", 24, difficultyMeanX.getN(), 1e-3); assertEquals("Mean/sigma check: Number of difficulties (including steps) ", 24, difficultySdX.getN(), 1e-3); }
From source file:com.itemanalysis.psychometrics.irt.equating.MeanSigmaMethodTest.java
/** * Tests the calculations needed for mean/mean and mean/sigma scale linking. * Item parameters and true values obtained from example 2 from the STUIRT * program by Michael Kolen and colleagues. Note that the original example * used teh PARSCALE version of item parameters. These were converted to * ICL type parameters by subtracting a step from the item difficulty. * */// w ww.j a v a 2 s .co m @Test public void mixedFormatDescriptiveStatisticsTestFormY() { System.out.println("Mixed format descriptive statistics test Form Y"); ItemResponseModel[] irm = new ItemResponseModel[17]; irm[0] = new Irm3PL(0.887276, -1.334798, 0.134406, 1.7); irm[1] = new Irm3PL(1.184412, -1.129004, 0.237765, 1.7); irm[2] = new Irm3PL(0.609412, -1.464546, 0.15139, 1.7); irm[3] = new Irm3PL(0.923812, -0.576435, 0.240097, 1.7); irm[4] = new Irm3PL(0.822776, -0.476357, 0.192369, 1.7); irm[5] = new Irm3PL(0.707818, -0.235189, 0.189557, 1.7); irm[6] = new Irm3PL(1.306976, 0.242986, 0.165553, 1.7); irm[7] = new Irm3PL(1.295471, 0.598029, 0.090557, 1.7); irm[8] = new Irm3PL(1.366841, 0.923206, 0.172993, 1.7); irm[9] = new Irm3PL(1.389624, 1.380666, 0.238008, 1.7); irm[10] = new Irm3PL(0.293806, 2.02807, 0.203448, 1.7); irm[11] = new Irm3PL(0.885347, 3.152928, 0.195473, 1.7); double[] step1 = { 0, -1.387347, 0.399117 }; irm[12] = new IrmGPCM(0.346324, step1, 1.7); double[] step2 = { 0, 0.756514, 0.956014 }; irm[13] = new IrmGPCM(1.252012, step2, 1.7); double[] step3 = { 0, 0.975303, 4.676299 }; irm[14] = new IrmGPCM(0.392282, step3, 1.7); double[] step4 = { 0, 0.643405, -0.418869, 0.804394 }; irm[15] = new IrmGPCM(0.660841, step4, 1.7); double[] step5 = { 0, 0.641293, 1.750488, 2.53802 }; irm[16] = new IrmGPCM(0.669612, step5, 1.7); Mean discriminationX = new Mean(); Mean difficultyX = new Mean(); Mean difficultyMeanX = new Mean(); StandardDeviation difficultySdX = new StandardDeviation(false);//Do not correct for bias. Use N in the denominator, not N-1. for (int j = 0; j < 17; j++) { irm[j].incrementMeanMean(discriminationX, difficultyX); irm[j].incrementMeanSigma(difficultyMeanX, difficultySdX); } // System.out.println("Mean/mean descriptive statistics for Form X"); // System.out.println("a-mean: " + discriminationX.getResult()); // System.out.println("b-mean: " + difficultyX.getResult()); assertEquals("Mean/mean check: discrimination mean", 0.8820, Precision.round(discriminationX.getResult(), 4), 1e-5); assertEquals("Mean/mean check: difficulty mean", 0.6435, Precision.round(difficultyX.getResult(), 4), 1e-5); assertEquals("Mean/mean check: Number of difficulties (including steps) ", 24, difficultyX.getN(), 1e-3); // System.out.println(); // System.out.println("Mean/sigma descriptive statistics for Form X"); // System.out.println("b-mean: " + difficultyMeanX.getResult()); // System.out.println("b-sd: " + difficultySdX.getResult()); // System.out.println("b-N: " + difficultyMeanX.getN() + ", " + difficultySdX.getN()); assertEquals("Mean/sigma check: difficulty mean", 0.6435, Precision.round(difficultyMeanX.getResult(), 4), 1e-5); assertEquals("Mean/sigma check: difficulty sd", 1.4527, Precision.round(difficultySdX.getResult(), 4), 1e-5); assertEquals("Mean/sigma check: Number of difficulties (including steps) ", 24, difficultyMeanX.getN(), 1e-3); assertEquals("Mean/sigma check: Number of difficulties (including steps) ", 24, difficultySdX.getN(), 1e-3); }