Example usage for org.apache.commons.math3.stat.regression GLSMultipleLinearRegression GLSMultipleLinearRegression

List of usage examples for org.apache.commons.math3.stat.regression GLSMultipleLinearRegression GLSMultipleLinearRegression

Introduction

In this page you can find the example usage for org.apache.commons.math3.stat.regression GLSMultipleLinearRegression GLSMultipleLinearRegression.

Prototype

GLSMultipleLinearRegression

Source Link

Usage

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//from w  w w  .  j  a  v  a2  s  .  co  m
        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();
}