com.ijchart.xychart.util
Class RegressionUtil

java.lang.Object
  extended by com.ijchart.xychart.util.RegressionUtil

public abstract class RegressionUtil
extends java.lang.Object

Title: IJChart

Description: a chart library for the Java(tm) platform.

A utility class for fitting regression curves to data.

Copyright: Copyright (c) 2013

Company:

Version:
1.0
Author:
zhang feng min,shanghai china. Contract me by email.

Constructor Summary
RegressionUtil()
           
 
Method Summary
static double[] getOLSRegression(double[][] data)
           Returns the parameters 'a' and 'b' for an equation y = a + bx, fitted to the data using ordinary least squares regression.The result is returned as a double[], where result[0] is a, and result[1] is b.
static double[] getOLSRegression(IMatrixDataset dataset, int rowIdx)
           Returns the parameters 'a' and 'b' for an equation y = a + bx, fitted to the data using ordinary least squares regression.The result is returned as a double[], where result[0] is a, and result[1] is b.
static double[] getPowerRegression(double[][] data)
           Returns the parameters 'a' and 'b' for an equation y=ax^b, fitted to the data using a power regression equation.The result is returned as an array, where double[0] is a, and double[1] is b.
static double[] getPowerRegression(IMatrixDataset dataset, int rowIdx)
           Returns the parameters 'a' and 'b' for an equation y=ax^b, fitted to the data using a power regression equation.The result is returned as an array, where double[0] is a, and double[1] is b.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RegressionUtil

public RegressionUtil()
Method Detail

getOLSRegression

public static double[] getOLSRegression(double[][] data)
Returns the parameters 'a' and 'b' for an equation y = a + bx, fitted to the data using ordinary least squares regression.The result is returned as a double[], where result[0] is a, and result[1] is b.

Parameters:
data - double[][] The datas.
Returns:
double[] result[0] is 'a',and result[1] is 'b'.

getOLSRegression

public static double[] getOLSRegression(IMatrixDataset dataset,
                                        int rowIdx)
Returns the parameters 'a' and 'b' for an equation y = a + bx, fitted to the data using ordinary least squares regression.The result is returned as a double[], where result[0] is a, and result[1] is b.

Parameters:
dataset - IMatrixDataset The dataset,and each data is XYNumberChartData object in dataset. (null not permitted).
rowIdx - int The row index,must be greater than or equal to 0.
Returns:
double[] result[0] is 'a',and result[1] is 'b'.

getPowerRegression

public static double[] getPowerRegression(double[][] data)
Returns the parameters 'a' and 'b' for an equation y=ax^b, fitted to the data using a power regression equation.The result is returned as an array, where double[0] is a, and double[1] is b.

Parameters:
data - double[][] The datas.
Returns:
double[] result[0] is 'a',and result[1] is 'b'.

getPowerRegression

public static double[] getPowerRegression(IMatrixDataset dataset,
                                          int rowIdx)
Returns the parameters 'a' and 'b' for an equation y=ax^b, fitted to the data using a power regression equation.The result is returned as an array, where double[0] is a, and double[1] is b.

Parameters:
dataset - IMatrixDataset The dataset,and each data is XYNumberChartData object in dataset. (null not permitted).
rowIdx - int The row index,must be greater than or equal to 0.
Returns:
double[] result[0] is 'a',and result[1] is 'b'.