Pre Issue 29012, getKurtosisClass() did not have a tolerance; therefore,
any non-zero kurtosis was consistently mesokurtic. Instead of getting into this level of detail, getKurtosisClass() has been removed, it is a subjective measure not appropriate for DescStat. git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/math/trunk@141238 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
9459e748c8
commit
e0452e4d79
|
@ -31,7 +31,7 @@ import org.apache.commons.math.stat.univariate.summary.SumOfSquares;
|
||||||
/**
|
/**
|
||||||
* Abstract superclass for DescriptiveStatistics implementations.
|
* Abstract superclass for DescriptiveStatistics implementations.
|
||||||
*
|
*
|
||||||
* @version $Revision: 1.2 $ $Date: 2004/05/03 14:32:25 $
|
* @version $Revision: 1.3 $ $Date: 2004/05/23 00:56:15 $
|
||||||
*/
|
*/
|
||||||
public abstract class AbstractDescriptiveStatistics
|
public abstract class AbstractDescriptiveStatistics
|
||||||
extends DescriptiveStatistics {
|
extends DescriptiveStatistics {
|
||||||
|
@ -100,21 +100,6 @@ public abstract class AbstractDescriptiveStatistics
|
||||||
return apply(new Kurtosis());
|
return apply(new Kurtosis());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @see org.apache.commons.math.stat.univariate.DescriptiveStatistics#getKurtosisClass()
|
|
||||||
*/
|
|
||||||
public int getKurtosisClass() {
|
|
||||||
int kClass = MESOKURTIC;
|
|
||||||
|
|
||||||
double kurtosis = getKurtosis();
|
|
||||||
if (kurtosis > 0) {
|
|
||||||
kClass = LEPTOKURTIC;
|
|
||||||
} else if (kurtosis < 0) {
|
|
||||||
kClass = PLATYKURTIC;
|
|
||||||
}
|
|
||||||
return (kClass);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see org.apache.commons.math.stat.univariate.DescriptiveStatistics#getMax()
|
* @see org.apache.commons.math.stat.univariate.DescriptiveStatistics#getMax()
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -23,7 +23,7 @@ import org.apache.commons.discovery.tools.DiscoverClass;
|
||||||
/**
|
/**
|
||||||
* Abstract factory class for univariate statistical summaries.
|
* Abstract factory class for univariate statistical summaries.
|
||||||
*
|
*
|
||||||
* @version $Revision: 1.4 $ $Date: 2004/05/19 14:16:31 $
|
* @version $Revision: 1.5 $ $Date: 2004/05/23 00:56:15 $
|
||||||
*/
|
*/
|
||||||
public abstract class DescriptiveStatistics implements Serializable, StatisticalSummary {
|
public abstract class DescriptiveStatistics implements Serializable, StatisticalSummary {
|
||||||
|
|
||||||
|
@ -83,19 +83,6 @@ public abstract class DescriptiveStatistics implements Serializable, Statistical
|
||||||
*/
|
*/
|
||||||
public static final int INFINITE_WINDOW = -1;
|
public static final int INFINITE_WINDOW = -1;
|
||||||
|
|
||||||
/**
|
|
||||||
* A LEPTOKURTIC set has a positive kurtosis (a high peak)
|
|
||||||
*/
|
|
||||||
public static int LEPTOKURTIC = 1;
|
|
||||||
/**
|
|
||||||
* A MESOKURTIC set has a kurtosis of 0 - it is a normal distribution
|
|
||||||
*/
|
|
||||||
public static int MESOKURTIC = 0;
|
|
||||||
/**
|
|
||||||
* A PLATYKURTIC set has a negative kurtosis (a flat "peak")
|
|
||||||
*/
|
|
||||||
public static int PLATYKURTIC = -1;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds the value to the set of numbers
|
* Adds the value to the set of numbers
|
||||||
* @param v the value to be added
|
* @param v the value to be added
|
||||||
|
@ -147,17 +134,6 @@ public abstract class DescriptiveStatistics implements Serializable, Statistical
|
||||||
*/
|
*/
|
||||||
public abstract double getKurtosis();
|
public abstract double getKurtosis();
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the Kurtosis "classification" a distribution can be
|
|
||||||
* leptokurtic (high peak), platykurtic (flat peak),
|
|
||||||
* or mesokurtic (zero kurtosis).
|
|
||||||
*
|
|
||||||
* @return A static constant defined in this interface,
|
|
||||||
* StoredDeviation.LEPTOKURITC, StoredDeviation.PLATYKURTIC, or
|
|
||||||
* StoredDeviation.MESOKURTIC
|
|
||||||
*/
|
|
||||||
public abstract int getKurtosisClass();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the maximum of the available values
|
* Returns the maximum of the available values
|
||||||
* @return The max or Double.NaN if no values have been added.
|
* @return The max or Double.NaN if no values have been added.
|
||||||
|
|
|
@ -20,11 +20,10 @@ import junit.framework.TestCase;
|
||||||
import junit.framework.TestSuite;
|
import junit.framework.TestSuite;
|
||||||
|
|
||||||
import org.apache.commons.math.TestUtils;
|
import org.apache.commons.math.TestUtils;
|
||||||
import org.apache.commons.math.stat.univariate.DescriptiveStatistics;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test cases for the {@link StatUtils} class.
|
* Test cases for the {@link StatUtils} class.
|
||||||
* @version $Revision: 1.15 $ $Date: 2004/04/27 16:42:31 $
|
* @version $Revision: 1.16 $ $Date: 2004/05/23 00:56:15 $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public final class StatUtilsTest extends TestCase {
|
public final class StatUtilsTest extends TestCase {
|
||||||
|
@ -42,7 +41,6 @@ public final class StatUtilsTest extends TestCase {
|
||||||
private double max = 3;
|
private double max = 3;
|
||||||
private double skewness = 0;
|
private double skewness = 0;
|
||||||
private double kurtosis = 0.5;
|
private double kurtosis = 0.5;
|
||||||
private int kClass = DescriptiveStatistics.LEPTOKURTIC;
|
|
||||||
private double tolerance = 10E-15;
|
private double tolerance = 10E-15;
|
||||||
|
|
||||||
public StatUtilsTest(String name) {
|
public StatUtilsTest(String name) {
|
||||||
|
|
|
@ -26,7 +26,7 @@ import org.apache.commons.math.random.RandomDataImpl;
|
||||||
/**
|
/**
|
||||||
* Test cases for the {@link Univariate} class.
|
* Test cases for the {@link Univariate} class.
|
||||||
*
|
*
|
||||||
* @version $Revision: 1.5 $ $Date: 2004/05/23 00:30:01 $
|
* @version $Revision: 1.6 $ $Date: 2004/05/23 00:56:15 $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public final class DescriptiveStatisticsTest extends TestCase {
|
public final class DescriptiveStatisticsTest extends TestCase {
|
||||||
|
@ -43,7 +43,6 @@ public final class DescriptiveStatisticsTest extends TestCase {
|
||||||
private double max = 3;
|
private double max = 3;
|
||||||
private double skewness = 0;
|
private double skewness = 0;
|
||||||
private double kurtosis = 0.5;
|
private double kurtosis = 0.5;
|
||||||
private int kClass = DescriptiveStatistics.LEPTOKURTIC;
|
|
||||||
private double tolerance = 10E-15;
|
private double tolerance = 10E-15;
|
||||||
|
|
||||||
public DescriptiveStatisticsTest(String name) {
|
public DescriptiveStatisticsTest(String name) {
|
||||||
|
@ -408,30 +407,5 @@ public final class DescriptiveStatisticsTest extends TestCase {
|
||||||
assertEquals(3.0, u.getMean(), tolerance);
|
assertEquals(3.0, u.getMean(), tolerance);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testKurtosisClass() {
|
|
||||||
DescriptiveStatistics u = DescriptiveStatistics.newInstance();
|
|
||||||
u.setWindowSize(5);
|
|
||||||
|
|
||||||
u.addValue(1.0);
|
|
||||||
u.addValue(1.0);
|
|
||||||
u.addValue(2.0);
|
|
||||||
u.addValue(1.0);
|
|
||||||
u.addValue(1.0);
|
|
||||||
assertEquals(DescriptiveStatistics.LEPTOKURTIC, u.getKurtosisClass());
|
|
||||||
|
|
||||||
u.addValue(1.0);
|
|
||||||
u.addValue(2.0);
|
|
||||||
u.addValue(2.0);
|
|
||||||
u.addValue(2.0);
|
|
||||||
u.addValue(1.0);
|
|
||||||
assertEquals(DescriptiveStatistics.PLATYKURTIC, u.getKurtosisClass());
|
|
||||||
//
|
|
||||||
// u.addValue(1.0);
|
|
||||||
// u.addValue(1.5);
|
|
||||||
// u.addValue(2.0912994180548905);
|
|
||||||
// u.addValue(1.5);
|
|
||||||
// u.addValue(1.0);
|
|
||||||
// assertEquals(DescriptiveStatistics.MESOKURTIC, u.getKurtosisClass());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,7 @@ import junit.framework.TestSuite;
|
||||||
/**
|
/**
|
||||||
* Test cases for the {@link Univariate} class.
|
* Test cases for the {@link Univariate} class.
|
||||||
*
|
*
|
||||||
* @version $Revision: 1.1 $ $Date: 2004/04/12 02:27:50 $
|
* @version $Revision: 1.2 $ $Date: 2004/05/23 00:56:15 $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public final class ListUnivariateImplTest extends TestCase {
|
public final class ListUnivariateImplTest extends TestCase {
|
||||||
|
@ -43,7 +43,6 @@ public final class ListUnivariateImplTest extends TestCase {
|
||||||
private double max = 3;
|
private double max = 3;
|
||||||
private double skewness = 0;
|
private double skewness = 0;
|
||||||
private double kurtosis = 0.5;
|
private double kurtosis = 0.5;
|
||||||
private int kClass = DescriptiveStatistics.LEPTOKURTIC;
|
|
||||||
private double tolerance = 10E-15;
|
private double tolerance = 10E-15;
|
||||||
|
|
||||||
public ListUnivariateImplTest(String name) {
|
public ListUnivariateImplTest(String name) {
|
||||||
|
|
|
@ -27,7 +27,7 @@ import junit.framework.TestSuite;
|
||||||
/**
|
/**
|
||||||
* Test cases for the {@link Univariate} class.
|
* Test cases for the {@link Univariate} class.
|
||||||
*
|
*
|
||||||
* @version $Revision: 1.1 $ $Date: 2004/04/12 02:27:50 $
|
* @version $Revision: 1.2 $ $Date: 2004/05/23 00:56:15 $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public final class MixedListUnivariateImplTest extends TestCase {
|
public final class MixedListUnivariateImplTest extends TestCase {
|
||||||
|
@ -45,7 +45,6 @@ public final class MixedListUnivariateImplTest extends TestCase {
|
||||||
private double max = 3;
|
private double max = 3;
|
||||||
private double skewness = 0;
|
private double skewness = 0;
|
||||||
private double kurtosis = 0.5;
|
private double kurtosis = 0.5;
|
||||||
private int kClass = DescriptiveStatistics.LEPTOKURTIC;
|
|
||||||
private double tolerance = 10E-15;
|
private double tolerance = 10E-15;
|
||||||
|
|
||||||
private TransformerMap transformers = new TransformerMap();
|
private TransformerMap transformers = new TransformerMap();
|
||||||
|
|
|
@ -25,7 +25,7 @@ import org.apache.commons.math.random.RandomDataImpl;
|
||||||
/**
|
/**
|
||||||
* Test cases for the {@link Univariate} class.
|
* Test cases for the {@link Univariate} class.
|
||||||
*
|
*
|
||||||
* @version $Revision: 1.1 $ $Date: 2004/04/12 02:27:50 $
|
* @version $Revision: 1.2 $ $Date: 2004/05/23 00:56:15 $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public final class StoreUnivariateImplTest extends TestCase {
|
public final class StoreUnivariateImplTest extends TestCase {
|
||||||
|
@ -42,7 +42,6 @@ public final class StoreUnivariateImplTest extends TestCase {
|
||||||
private double max = 3;
|
private double max = 3;
|
||||||
private double skewness = 0;
|
private double skewness = 0;
|
||||||
private double kurtosis = 0.5;
|
private double kurtosis = 0.5;
|
||||||
private int kClass = DescriptiveStatistics.LEPTOKURTIC;
|
|
||||||
private double tolerance = 10E-15;
|
private double tolerance = 10E-15;
|
||||||
|
|
||||||
public StoreUnivariateImplTest(String name) {
|
public StoreUnivariateImplTest(String name) {
|
||||||
|
|
Loading…
Reference in New Issue