アットウィキロゴ

かき2

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