Java Code Examples for org.apache.commons.math.stat.StatUtils#variance()
The following examples show how to use
org.apache.commons.math.stat.StatUtils#variance() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SemiVarianceTest.java From astor with GNU General Public License v2.0 | 5 votes |
/** * Check that the lower + upper semivariance against the mean sum to the * variance. */ public void testVarianceDecompMeanCutoff() { double[] values = { -2.0d, 2.0d, 4.0d, -2.0d, 22.0d, 11.0d, 3.0d, 14.0d, 5.0d }; double variance = StatUtils.variance(values); SemiVariance sv = new SemiVariance(true); // Bias corrected sv.setVarianceDirection(SemiVariance.DOWNSIDE_VARIANCE); final double lower = sv.evaluate(values); sv.setVarianceDirection(SemiVariance.UPSIDE_VARIANCE); final double upper = sv.evaluate(values); assertEquals(variance, lower + upper, 10e-12); }
Example 2
Source File: SemiVarianceTest.java From astor with GNU General Public License v2.0 | 5 votes |
/** * Check that the lower + upper semivariance against the mean sum to the * variance. */ public void testVarianceDecompMeanCutoff() { double[] values = { -2.0d, 2.0d, 4.0d, -2.0d, 22.0d, 11.0d, 3.0d, 14.0d, 5.0d }; double variance = StatUtils.variance(values); SemiVariance sv = new SemiVariance(true); // Bias corrected sv.setVarianceDirection(SemiVariance.DOWNSIDE_VARIANCE); final double lower = sv.evaluate(values); sv.setVarianceDirection(SemiVariance.UPSIDE_VARIANCE); final double upper = sv.evaluate(values); assertEquals(variance, lower + upper, 10e-12); }
Example 3
Source File: SemiVarianceTest.java From astor with GNU General Public License v2.0 | 5 votes |
/** * Check that the lower + upper semivariance against the mean sum to the * variance. */ @Test public void testVarianceDecompMeanCutoff() { double[] values = { -2.0d, 2.0d, 4.0d, -2.0d, 22.0d, 11.0d, 3.0d, 14.0d, 5.0d }; double variance = StatUtils.variance(values); SemiVariance sv = new SemiVariance(true); // Bias corrected sv.setVarianceDirection(SemiVariance.DOWNSIDE_VARIANCE); final double lower = sv.evaluate(values); sv.setVarianceDirection(SemiVariance.UPSIDE_VARIANCE); final double upper = sv.evaluate(values); Assert.assertEquals(variance, lower + upper, 10e-12); }
Example 4
Source File: SemiVarianceTest.java From astor with GNU General Public License v2.0 | 5 votes |
/** * Check that the lower + upper semivariance against the mean sum to the * variance. */ public void testVarianceDecompMeanCutoff() { double[] values = { -2.0d, 2.0d, 4.0d, -2.0d, 22.0d, 11.0d, 3.0d, 14.0d, 5.0d }; double variance = StatUtils.variance(values); SemiVariance sv = new SemiVariance(true); // Bias corrected sv.setVarianceDirection(SemiVariance.DOWNSIDE_VARIANCE); final double lower = sv.evaluate(values); sv.setVarianceDirection(SemiVariance.UPSIDE_VARIANCE); final double upper = sv.evaluate(values); assertEquals(variance, lower + upper, 10e-12); }
Example 5
Source File: SemiVarianceTest.java From astor with GNU General Public License v2.0 | 5 votes |
/** * Check that the lower + upper semivariance against the mean sum to the * variance. */ public void testVarianceDecompMeanCutoff() { double[] values = { -2.0d, 2.0d, 4.0d, -2.0d, 22.0d, 11.0d, 3.0d, 14.0d, 5.0d }; double variance = StatUtils.variance(values); SemiVariance sv = new SemiVariance(true); // Bias corrected sv.setVarianceDirection(SemiVariance.DOWNSIDE_VARIANCE); final double lower = sv.evaluate(values); sv.setVarianceDirection(SemiVariance.UPSIDE_VARIANCE); final double upper = sv.evaluate(values); assertEquals(variance, lower + upper, 10e-12); }
Example 6
Source File: SemiVarianceTest.java From astor with GNU General Public License v2.0 | 5 votes |
/** * Check that the lower + upper semivariance against the mean sum to the * variance. */ public void testVarianceDecompMeanCutoff() { double[] values = { -2.0d, 2.0d, 4.0d, -2.0d, 22.0d, 11.0d, 3.0d, 14.0d, 5.0d }; double variance = StatUtils.variance(values); SemiVariance sv = new SemiVariance(true); // Bias corrected sv.setVarianceDirection(SemiVariance.DOWNSIDE_VARIANCE); final double lower = sv.evaluate(values); sv.setVarianceDirection(SemiVariance.UPSIDE_VARIANCE); final double upper = sv.evaluate(values); assertEquals(variance, lower + upper, 10e-12); }
Example 7
Source File: SemiVarianceTest.java From astor with GNU General Public License v2.0 | 5 votes |
/** * Check that the lower + upper semivariance against the mean sum to the * variance. */ public void testVarianceDecompMeanCutoff() { double[] values = { -2.0d, 2.0d, 4.0d, -2.0d, 22.0d, 11.0d, 3.0d, 14.0d, 5.0d }; double variance = StatUtils.variance(values); SemiVariance sv = new SemiVariance(true); // Bias corrected sv.setVarianceDirection(SemiVariance.DOWNSIDE_VARIANCE); final double lower = sv.evaluate(values); sv.setVarianceDirection(SemiVariance.UPSIDE_VARIANCE); final double upper = sv.evaluate(values); assertEquals(variance, lower + upper, 10e-12); }
Example 8
Source File: SemiVarianceTest.java From astor with GNU General Public License v2.0 | 5 votes |
/** * Check that the lower + upper semivariance against the mean sum to the * variance. */ @Test public void testVarianceDecompMeanCutoff() { double[] values = { -2.0d, 2.0d, 4.0d, -2.0d, 22.0d, 11.0d, 3.0d, 14.0d, 5.0d }; double variance = StatUtils.variance(values); SemiVariance sv = new SemiVariance(true); // Bias corrected sv.setVarianceDirection(SemiVariance.DOWNSIDE_VARIANCE); final double lower = sv.evaluate(values); sv.setVarianceDirection(SemiVariance.UPSIDE_VARIANCE); final double upper = sv.evaluate(values); Assert.assertEquals(variance, lower + upper, 10e-12); }
Example 9
Source File: SemiVarianceTest.java From astor with GNU General Public License v2.0 | 5 votes |
/** * Check that the lower + upper semivariance against the mean sum to the * variance. */ public void testVarianceDecompMeanCutoff() { double[] values = { -2.0d, 2.0d, 4.0d, -2.0d, 22.0d, 11.0d, 3.0d, 14.0d, 5.0d }; double variance = StatUtils.variance(values); SemiVariance sv = new SemiVariance(true); // Bias corrected sv.setVarianceDirection(SemiVariance.DOWNSIDE_VARIANCE); final double lower = sv.evaluate(values); sv.setVarianceDirection(SemiVariance.UPSIDE_VARIANCE); final double upper = sv.evaluate(values); assertEquals(variance, lower + upper, 10e-12); }
Example 10
Source File: RevisedLesk.java From lesk-wsd-dsm with GNU General Public License v3.0 | 5 votes |
/** * * @param list * @return */ public double getVariance(List<SynsetOut> list) { double[] scores = new double[list.size()]; int l = 0; for (SynsetOut out : list) { scores[l] = out.getScore(); l++; } return StatUtils.variance(scores); }