package math;
import org.apache.commons.math3.stat.regression.*;
public class pro {
public static void main(String[] args) {
pro test=new pro();
}
pro(){
OLSMultipleLinearRegression regression = new OLSMultipleLinearRegression();
double y[]=new double[5];
double x[][]=new double[5][2];
y[0]=1;
y[1]=2;
y[3]=3;
y[2]=4;
y[4]=7;
x[1][0]=1;
x[1][1]=2;
x[2][0]=1;
x[2][1]=3;
x[3][0]=1;
x[3][1]=4;
x[0][0]=1;
x[0][1]=5;
x[4][0]=1;
x[4][1]=5;
regression.newSampleData(y,x);
double[] beta = regression.estimateRegressionParameters();
System.out.println(beta[0]);
}
}
最終更新:2015年11月20日 23:20