本文整理汇总了Java中org.jfree.data.statistics.Statistics.calculateMean方法的典型用法代码示例。如果您正苦于以下问题:Java Statistics.calculateMean方法的具体用法?Java Statistics.calculateMean怎么用?Java Statistics.calculateMean使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.jfree.data.statistics.Statistics
的用法示例。
在下文中一共展示了Statistics.calculateMean方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: 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);
}
示例4: 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);
}
示例5: 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 = 2;
CATEGORY_COUNT = 4;
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);
}
示例6: 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 = 2;
// CATEGORY_COUNT = 4;
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);
}
示例7: 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;
}
示例8: 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;
}
示例9: createCategoryStatRawDataset
import org.jfree.data.statistics.Statistics; //导入方法依赖的package包/类
private CategoryDataset createCategoryStatRawDataset() {
String[][] x= new String[xyLength][no_category];
String[][] y= new String[xyLength][1];
for (int index=0; index<no_category; index++)
for (int i = 0; i < xyLength; i++)
x[i][index] = indepValues[i][index];
for (int index=0; index<1; index++)
for (int i = 0; i < xyLength; i++)
y[i][index] = depValues[i][index];
int SERIES_COUNT = xyLength;
int CATEGORY_COUNT = no_category;
DefaultStatisticalCategoryDataset dataset
= new DefaultStatisticalCategoryDataset();
String[][] values_storage = new String[SERIES_COUNT][CATEGORY_COUNT];
for (int s = 0; s < SERIES_COUNT; s++) {
for (int c = 0; c < CATEGORY_COUNT; c++) {
Double[] values = createValueList(x[s][c]);
values_storage[s][c]= x[s][c];
double mean = Statistics.calculateMean(values);
double stdDev = Statistics.getStdDev(values);
dataset.add(mean, stdDev, y[s][0], independentHeaders[c]);
}
}
return dataset;
}