16 package emlab.gen.util;
19 import org.apache.commons.math.stat.regression.SimpleRegression;
24 public static double[] estimateLinearTrend(
double[][] input,
double[] predictionYears){
27 SimpleRegression sr =
new SimpleRegression();
29 double result[] =
new double[predictionYears.length];
30 for(
int i = 0 ; i<result.length; i++){
31 result[i]=sr.predict(predictionYears[i]);
38 public static double[] estimateGeometricTrend(
double[][] input,
double[] predictionYears){
40 for(
int i=0;i<input.length;i++){
41 input[i][1]=Math.log(input[i][1]);
44 SimpleRegression sr =
new SimpleRegression();
46 double result[] =
new double[predictionYears.length];
47 for(
int i = 0 ; i<result.length; i++){
48 result[i]=Math.exp(sr.predict(predictionYears[i]));