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