List of usage examples for org.apache.commons.math3.stat.regression AbstractMultipleLinearRegression newSampleData
public void newSampleData(double[] data, int nobs, int nvars)
Loads model x and y sample data from a flat input array, overriding any previous sample.
From source file:msi.gama.util.GamaRegression.java
public GamaRegression(final IScope scope, final GamaFloatMatrix data, final String method) throws Exception { AbstractMultipleLinearRegression regressionMethod = null; if (method.equals("GLS")) regressionMethod = new GLSMultipleLinearRegression(); else/* www.j av a 2s . com*/ regressionMethod = new OLSMultipleLinearRegression(); final int nbFeatures = data.numCols - 1; final int nbInstances = data.numRows; final double[] instances = new double[data.numCols * data.numRows]; for (int i = 0; i < data.length(scope); i++) { instances[i] = data.getMatrix()[i]; } regressionMethod.newSampleData(instances, nbInstances, nbFeatures); param = regressionMethod.estimateRegressionParameters(); }