本文整理汇总了Java中org.jfree.data.statistics.Statistics类的典型用法代码示例。如果您正苦于以下问题:Java Statistics类的具体用法?Java Statistics怎么用?Java Statistics使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Statistics类属于org.jfree.data.statistics包,在下文中一共展示了Statistics类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createDataset
import org.jfree.data.statistics.Statistics; //导入依赖的package包/类
/**
* Creates a sample dataset.
*
* @return The dataset.
*/
protected CategoryDataset createDataset(boolean isDemo) {
double mean, stdDev;
if (isDemo){
SERIES_COUNT = 3;
// CATEGORY_COUNT = 1;
VALUE_COUNT = 10;
values_storage = new String[SERIES_COUNT][CATEGORY_COUNT];
DefaultStatisticalCategoryDataset dataset
= new DefaultStatisticalCategoryDataset();
for (int s = 0; s < SERIES_COUNT; s++) {
for (int c = 0; c < CATEGORY_COUNT; c++) {
Double[] values = createValueList(0, 20.0, VALUE_COUNT);
values_storage[s][c]= vs;
mean = Statistics.calculateMean(values);
stdDev = Statistics.getStdDev(values);
dataset.add(mean,stdDev, "Series " + s, "Category " + c);
}
}
return dataset;}
else return super.createDataset(false);
}
示例2: createDataset
import org.jfree.data.statistics.Statistics; //导入依赖的package包/类
/**
* Creates a sample dataset.
*
* @return The dataset.
*/
protected CategoryDataset createDataset(boolean isDemo) {
double mean, stdDev;
if (isDemo){
SERIES_COUNT = 3;
CATEGORY_COUNT = 2;
VALUE_COUNT = 10;
values_storage = new String[SERIES_COUNT][CATEGORY_COUNT];
DefaultStatisticalCategoryDataset dataset
= new DefaultStatisticalCategoryDataset();
for (int s = 0; s < SERIES_COUNT; s++) {
for (int c = 0; c < CATEGORY_COUNT; c++) {
Double[] values = createValueList(0, 20.0, VALUE_COUNT);
values_storage[s][c]= vs;
mean = Statistics.calculateMean(values);
stdDev = Statistics.getStdDev(values);
dataset.add(mean,stdDev, "Series " + s, "Category " + c);
}
}
return dataset;}
else return super.createDataset(false);
}
示例3: paramEstimate
import org.jfree.data.statistics.Statistics; //导入依赖的package包/类
public void paramEstimate(double[] distData) {
double a, b, sum = 0;
//a = getMedian();
List<Double> valueList = new java.util.ArrayList<Double>();
for (int i=0; i<distData.length; i++){
valueList.add(new Double(distData[i]));
}
a = Statistics.calculateMedian(valueList);
sum = 0;
for(int i = 0; i < distData.length; i++){
double temp = Math.abs(distData[i]-a);
sum += temp;
}
b = sum/distData.length;
setParameters(a, b);
}
示例4: testCalculateMean1
import org.jfree.data.statistics.Statistics; //导入依赖的package包/类
/**
* A simple test for the calculateMean(Collection) method.
*/
public void testCalculateMean1() {
List values = new ArrayList();
values.add(new Double(9.0));
values.add(new Double(3.0));
values.add(new Double(2.0));
values.add(new Double(2.0));
double mean = Statistics.calculateMean(values);
assertEquals(4.0, mean, 0.0000001);
}
示例5: testCalculateMean2
import org.jfree.data.statistics.Statistics; //导入依赖的package包/类
/**
* A simple test for the calculateMean(Number[]) method.
*/
public void testCalculateMean2() {
final Number[] values = new Number[3];
values[0] = new Double(1);
values[1] = new Double(2);
values[2] = new Double(3);
final double mean = Statistics.calculateMean(values);
assertEquals(2.0, mean, 0.0000001);
}
示例6: testCalculateMedian1
import org.jfree.data.statistics.Statistics; //导入依赖的package包/类
/**
* A test for the calculateMedian() method.
*/
public void testCalculateMedian1() {
final List values = new ArrayList();
values.add(new Double(1.0));
final double median = Statistics.calculateMedian(values);
assertEquals(1.0, median, 0.0000001);
}
示例7: testCalculateMedian2
import org.jfree.data.statistics.Statistics; //导入依赖的package包/类
/**
* A test for the calculateMedian() method.
*/
public void testCalculateMedian2() {
final List values = new ArrayList();
values.add(new Double(2.0));
values.add(new Double(1.0));
final double median = Statistics.calculateMedian(values);
assertEquals(1.5, median, 0.0000001);
}
示例8: testCalculateMedian3
import org.jfree.data.statistics.Statistics; //导入依赖的package包/类
/**
* A test for the calculateMedian() method.
*/
public void testCalculateMedian3() {
final List values = new ArrayList();
values.add(new Double(1.0));
values.add(new Double(2.0));
values.add(new Double(3.0));
values.add(new Double(6.0));
values.add(new Double(5.0));
values.add(new Double(4.0));
final double median = Statistics.calculateMedian(values);
assertEquals(3.5, median, 0.0000001);
}
示例9: testCalculateMedian4
import org.jfree.data.statistics.Statistics; //导入依赖的package包/类
/**
* A test for the calculateMedian() method.
*/
public void testCalculateMedian4() {
final List values = new ArrayList();
values.add(new Double(7.0));
values.add(new Double(2.0));
values.add(new Double(3.0));
values.add(new Double(5.0));
values.add(new Double(4.0));
values.add(new Double(6.0));
values.add(new Double(1.0));
final double median = Statistics.calculateMedian(values);
assertEquals(4.0, median, 0.0000001);
}
示例10: testCalculateMedian6
import org.jfree.data.statistics.Statistics; //导入依赖的package包/类
/**
* A test for the calculateMedian() method.
*/
public void testCalculateMedian6() {
final List values = new ArrayList();
values.add(new Double(7.0));
values.add(new Double(2.0));
values.add(new Double(3.0));
values.add(new Double(5.0));
values.add(new Double(4.0));
values.add(new Double(6.0));
values.add(new Double(1.0));
final double median = Statistics.calculateMedian(values, 0, 2);
assertEquals(3.0, median, 0.0000001);
}
示例11: testCorrelation1
import org.jfree.data.statistics.Statistics; //导入依赖的package包/类
/**
* A simple test for the correlation calculation.
*/
public void testCorrelation1() {
final Number[] data1 = new Number[3];
data1[0] = new Double(1);
data1[1] = new Double(2);
data1[2] = new Double(3);
final Number[] data2 = new Number[3];
data2[0] = new Double(1);
data2[1] = new Double(2);
data2[2] = new Double(3);
final double r = Statistics.getCorrelation(data1, data2);
assertTrue(NumberUtils.equal(r, 1.0));
}
示例12: testCalculateMedian1
import org.jfree.data.statistics.Statistics; //导入依赖的package包/类
/**
* A test for the calculateMedian() method.
*/
public void testCalculateMedian1() {
List values = new ArrayList();
values.add(new Double(1.0));
double median = Statistics.calculateMedian(values);
assertEquals(1.0, median, 0.0000001);
}
示例13: testCalculateMedian2
import org.jfree.data.statistics.Statistics; //导入依赖的package包/类
/**
* A test for the calculateMedian() method.
*/
public void testCalculateMedian2() {
List values = new ArrayList();
values.add(new Double(2.0));
values.add(new Double(1.0));
double median = Statistics.calculateMedian(values);
assertEquals(1.5, median, 0.0000001);
}
示例14: testCalculateMedian3
import org.jfree.data.statistics.Statistics; //导入依赖的package包/类
/**
* A test for the calculateMedian() method.
*/
public void testCalculateMedian3() {
List values = new ArrayList();
values.add(new Double(1.0));
values.add(new Double(2.0));
values.add(new Double(3.0));
values.add(new Double(6.0));
values.add(new Double(5.0));
values.add(new Double(4.0));
double median = Statistics.calculateMedian(values);
assertEquals(3.5, median, 0.0000001);
}
示例15: testCalculateMedian4
import org.jfree.data.statistics.Statistics; //导入依赖的package包/类
/**
* A test for the calculateMedian() method.
*/
public void testCalculateMedian4() {
List values = new ArrayList();
values.add(new Double(7.0));
values.add(new Double(2.0));
values.add(new Double(3.0));
values.add(new Double(5.0));
values.add(new Double(4.0));
values.add(new Double(6.0));
values.add(new Double(1.0));
double median = Statistics.calculateMedian(values);
assertEquals(4.0, median, 0.0000001);
}