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


Java Statistics.calculateMedian方法代码示例

本文整理汇总了Java中org.jfree.data.statistics.Statistics.calculateMedian方法的典型用法代码示例。如果您正苦于以下问题:Java Statistics.calculateMedian方法的具体用法?Java Statistics.calculateMedian怎么用?Java Statistics.calculateMedian使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.jfree.data.statistics.Statistics的用法示例。


在下文中一共展示了Statistics.calculateMedian方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: 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

示例2: 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

示例3: 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

示例4: 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

示例5: 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

示例6: 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

示例7: 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

示例8: 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

示例9: 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

示例10: 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

示例11: testCalculateMedian6

import org.jfree.data.statistics.Statistics; //导入方法依赖的package包/类
/**
 * A test for the calculateMedian() method.
 */
public void testCalculateMedian6() {
    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, 0, 2);
    assertEquals(3.0, median, 0.0000001);
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:16,代码来源:StatisticsTests.java

示例12: Summary

import org.jfree.data.statistics.Statistics; //导入方法依赖的package包/类
/**
 * calculate the statistical summary for the given dataset
 * @param dataset
 */
public Summary(PieDataset dataset){

	seriesCount = dataset.getItemCount();
	categoryCount = 1;
	
	cat_sampleSize = new int[categoryCount];
	cat_mean = new double[categoryCount];
	cat_median = new double[categoryCount];
	cat_stdDev = new double[categoryCount];
	cat_skew = new double[categoryCount];
	cat_kurt = new double[categoryCount];

	seriesName = new String[seriesCount];
	categoryName = new String[categoryCount];

	categoryName[0] = "Value";
	Double[] values = new Double[seriesCount];
	List<Double> valueList = new java.util.ArrayList<Double>();
	for (int i=0; i<seriesCount; i++){

		double v;
		if (dataset.getValue(i)!=null)
			v= dataset.getValue(i).doubleValue();	
		else v=0.0;
		values[i]=new Double(v);
		valueList.add(new Double(v));
	}
	
	cat_sampleSize[0]=valueList.size();
	cat_mean[0] = Statistics.calculateMean(values, false);
	cat_median[0] = Statistics.calculateMedian(valueList);
	cat_stdDev[0] = Statistics.getStdDev(values);
	cat_skew[0] = Statistics.calculateSkewness(values);
	cat_kurt[0] = Statistics.calculateKurtosis(values);

	return;
}
 
开发者ID:SOCR,项目名称:HTML5_WebSite,代码行数:42,代码来源:Summary.java

示例13: getCellSummary

import org.jfree.data.statistics.Statistics; //导入方法依赖的package包/类
/**
* return summary for each table cell of  the given serie
* @param dataset
* @param serieIndex
* @return
*/
public String getCellSummary(CategoryDataset dataset, int serieIndex){
	String info ="";
	
	double mean, median, stdDev, skew, kurt;
	int sampleSize;


           for (int c = 0; c < categoryCount; c++) {

               Double[] values = createValueList(values_storage[serieIndex][c]);
			List<Double> valueList = new java.util.ArrayList<Double>();
			for (int i=0; i<values.length; i++)
				if(!Double.isNaN(values[i]))
				valueList.add(values[i]);
			sampleSize = valueList.size();
			mean = Statistics.calculateMean(values, false);
			median= Statistics.calculateMedian(valueList);
			stdDev = Statistics.getStdDev(values);
			skew = Statistics.calculateSkewness(values);
			kurt = Statistics.calculateKurtosis(values);

			String k = dataset.getRowKey(serieIndex).toString();
			if(k.length()>0)
				info += "["+k+".";
			else 
				info += "[";
			info += dataset.getColumnKey(c).toString()+"]:";
			info += " SampleSize="+setInfo(sampleSize);
			info += " Mean="+setInfo(mean);
			info += " Median="+setInfo(median);
			info += " stdDev="+setInfo(stdDev);
			info += " Skewness="+setInfo(skew);
			info += " Kurtosis="+setInfo(kurt);
			info +="\n";
           }
		return info;
}
 
开发者ID:SOCR,项目名称:HTML5_WebSite,代码行数:44,代码来源:Summary.java

示例14: testCalculateMedian5

import org.jfree.data.statistics.Statistics; //导入方法依赖的package包/类
/**
 * A test using some real data that caused a problem at one point.
 */
public void testCalculateMedian5() {
    final List values = new ArrayList();
    values.add(new Double(11.228692993861783));
    values.add(new Double(11.30823353859889));
    values.add(new Double(11.75312904769314));
    values.add(new Double(11.825102897465314));
    values.add(new Double(10.184252778401783));
    values.add(new Double(12.207951828057766));
    values.add(new Double(10.68841994040566));
    values.add(new Double(12.099522004479438));
    values.add(new Double(11.508874945056881));
    values.add(new Double(12.052517729558513));
    values.add(new Double(12.401481645578734));
    values.add(new Double(12.185377793028543));
    values.add(new Double(10.666372951930315));
    values.add(new Double(11.680978041499548));
    values.add(new Double(11.06528277406718));
    values.add(new Double(11.36876492904596));
    values.add(new Double(11.927565516175939));
    values.add(new Double(11.39307785978655));
    values.add(new Double(11.989603679523857));
    values.add(new Double(12.009834360354864));
    values.add(new Double(10.653351822461559));
    values.add(new Double(11.851776254376754));
    values.add(new Double(11.045441544755946));
    values.add(new Double(11.993674040560624));
    values.add(new Double(12.898219965238944));
    values.add(new Double(11.97095782819647));
    values.add(new Double(11.73234406745488));
    values.add(new Double(11.649006017243991));
    values.add(new Double(12.20549704915365));
    values.add(new Double(11.799723639384919));
    values.add(new Double(11.896208658005628));
    values.add(new Double(12.164149111823424));
    values.add(new Double(12.042795103513766));
    values.add(new Double(12.114839532596426));
    values.add(new Double(12.166609097075824));
    values.add(new Double(12.183017546225935));
    values.add(new Double(11.622009125845342));
    values.add(new Double(11.289365786738633));
    values.add(new Double(12.462984323671568));
    values.add(new Double(11.573494921030598));
    values.add(new Double(10.862867940485804));
    values.add(new Double(12.018186939664872));
    values.add(new Double(10.418046849313018));
    values.add(new Double(11.326344465881341));
    double median = Statistics.calculateMedian(values, true);
    assertEquals(11.812413268425116, median, 0.000001);
    Collections.sort(values);
    double median2 = Statistics.calculateMedian(values, false);
    assertEquals(11.812413268425116, median2, 0.000001);
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:56,代码来源:StatisticsTests.java

示例15: testCalculateMedian5

import org.jfree.data.statistics.Statistics; //导入方法依赖的package包/类
/**
 * A test using some real data that caused a problem at one point.
 */
public void testCalculateMedian5() {
    List values = new ArrayList();
    values.add(new Double(11.228692993861783));
    values.add(new Double(11.30823353859889));
    values.add(new Double(11.75312904769314));
    values.add(new Double(11.825102897465314));
    values.add(new Double(10.184252778401783));
    values.add(new Double(12.207951828057766));
    values.add(new Double(10.68841994040566));
    values.add(new Double(12.099522004479438));
    values.add(new Double(11.508874945056881));
    values.add(new Double(12.052517729558513));
    values.add(new Double(12.401481645578734));
    values.add(new Double(12.185377793028543));
    values.add(new Double(10.666372951930315));
    values.add(new Double(11.680978041499548));
    values.add(new Double(11.06528277406718));
    values.add(new Double(11.36876492904596));
    values.add(new Double(11.927565516175939));
    values.add(new Double(11.39307785978655));
    values.add(new Double(11.989603679523857));
    values.add(new Double(12.009834360354864));
    values.add(new Double(10.653351822461559));
    values.add(new Double(11.851776254376754));
    values.add(new Double(11.045441544755946));
    values.add(new Double(11.993674040560624));
    values.add(new Double(12.898219965238944));
    values.add(new Double(11.97095782819647));
    values.add(new Double(11.73234406745488));
    values.add(new Double(11.649006017243991));
    values.add(new Double(12.20549704915365));
    values.add(new Double(11.799723639384919));
    values.add(new Double(11.896208658005628));
    values.add(new Double(12.164149111823424));
    values.add(new Double(12.042795103513766));
    values.add(new Double(12.114839532596426));
    values.add(new Double(12.166609097075824));
    values.add(new Double(12.183017546225935));
    values.add(new Double(11.622009125845342));
    values.add(new Double(11.289365786738633));
    values.add(new Double(12.462984323671568));
    values.add(new Double(11.573494921030598));
    values.add(new Double(10.862867940485804));
    values.add(new Double(12.018186939664872));
    values.add(new Double(10.418046849313018));
    values.add(new Double(11.326344465881341));
    double median = Statistics.calculateMedian(values, true);
    assertEquals(11.812413268425116, median, 0.000001);
    Collections.sort(values);
    double median2 = Statistics.calculateMedian(values, false);
    assertEquals(11.812413268425116, median2, 0.000001);
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:56,代码来源:StatisticsTests.java


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