当前位置: 首页>>代码示例>>Java>>正文


Java Statistics类代码示例

本文整理汇总了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);
  }
 
开发者ID:SOCR,项目名称:HTML5_WebSite,代码行数:31,代码来源:StatisticalBarChartDemo3.java

示例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);
  }
 
开发者ID:SOCR,项目名称:HTML5_WebSite,代码行数:31,代码来源:StatisticalBarChartDemo2.java

示例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);
 }
 
开发者ID:SOCR,项目名称:HTML5_WebSite,代码行数:19,代码来源:LaplaceDistribution.java

示例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);
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:13,代码来源:StatisticsTests.java

示例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);
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:12,代码来源:StatisticsTests.java

示例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);
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:10,代码来源:StatisticsTests.java

示例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);
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:11,代码来源:StatisticsTests.java

示例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);
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:15,代码来源:StatisticsTests.java

示例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);
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:16,代码来源:StatisticsTests.java

示例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);
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:16,代码来源:StatisticsTests.java

示例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));        
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:16,代码来源:StatisticsTests.java

示例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);
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:10,代码来源:StatisticsTests.java

示例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);
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:11,代码来源:StatisticsTests.java

示例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);
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:15,代码来源:StatisticsTests.java

示例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);
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:16,代码来源:StatisticsTests.java


注:本文中的org.jfree.data.statistics.Statistics类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。