comparison gnv-artifacts/src/main/java/de/intevation/gnv/statistics/AbstractStatistics.java @ 657:af3f56758f59

merged gnv-artifacts/0.5
author Thomas Arendsen Hein <thomas@intevation.de>
date Fri, 28 Sep 2012 12:13:53 +0200
parents f7038820df2e
children 9a828e5a2390
comparison
equal deleted inserted replaced
590:5f5f273c8566 657:af3f56758f59
1 package de.intevation.gnv.statistics;
2
3 import org.apache.commons.math.stat.descriptive.DescriptiveStatistics;
4
5 import org.apache.commons.math.stat.regression.SimpleRegression;
6
7 import org.apache.log4j.Logger;
8
9 /**
10 * @author Sascha L. Teichmann (sascha.teichmann@intevation.de)
11 */
12 public abstract class AbstractStatistics
13 implements Statistics
14 {
15 private static Logger log = Logger.getLogger(
16 AbstractStatistics.class);
17
18 public AbstractStatistics() {
19 }
20
21 protected StatisticSet generateStatisticsValues(
22 DescriptiveStatistics lStatistics,
23 SimpleRegression lRegression,
24 String statisticName
25 ) {
26 StatisticSet statisticSet = new StatisticSet(statisticName);
27
28 statisticSet.addStatistic(
29 new Statistic(
30 "gnviewer.statistics.descriptive.arithmeticMean",
31 lStatistics.getMean()));
32
33 statisticSet.addStatistic(
34 new Statistic(
35 "gnviewer.statistics.descriptive.kurtosis",
36 lStatistics.getKurtosis()));
37
38 statisticSet.addStatistic(
39 new Statistic(
40 "gnviewer.statistics.descriptive.max",
41 lStatistics.getMax()));
42
43 statisticSet.addStatistic(
44 new Statistic(
45 "gnviewer.statistics.descriptive.min",
46 lStatistics.getMin()));
47
48 statisticSet.addStatistic(
49 new Statistic(
50 "gnviewer.statistics.descriptive.n",
51 lStatistics.getN()));
52
53 statisticSet.addStatistic(
54 new Statistic(
55 "gnviewer.statistics.descriptive.percentile.90",
56 lStatistics.getPercentile(90)));
57
58 statisticSet.addStatistic(
59 new Statistic(
60 "gnviewer.statistics.descriptive.percentile.75",
61 lStatistics.getPercentile(75)));
62
63 statisticSet.addStatistic(
64 new Statistic(
65 "gnviewer.statistics.descriptive.percentile.50",
66 lStatistics.getPercentile(50)));
67
68 statisticSet.addStatistic(
69 new Statistic(
70 "gnviewer.statistics.descriptive.percentile.10",
71 lStatistics.getPercentile(10)));
72
73 statisticSet.addStatistic(
74 new Statistic(
75 "gnviewer.statistics.descriptive.deviation",
76 lStatistics.getStandardDeviation()));
77
78 statisticSet.addStatistic(
79 new Statistic(
80 "gnviewer.statistics.descriptive.variance",
81 lStatistics.getVariance()));
82
83 statisticSet.addStatistic(
84 new Statistic(
85 "gnviewer.statistics.descriptive.intercept",
86 lRegression.getIntercept()));
87
88 statisticSet.addStatistic(
89 new Statistic(
90 "gnviewer.statistics.descriptive.slope",
91 lRegression.getSlope()));
92
93 return statisticSet;
94 }
95 }
96 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
97

http://dive4elements.wald.intevation.org