The mathIT Library
A Java™ API for mathematics
org.mathIT.approximation

## Class Regression

• ```public class Regression
extends Object```
This class enables to generate objects from data points (t, y) such as time series and to compute regression polynomials from them. There are multiple data series possible, i.e., y is an array.
Version:
1.1
Author:
Andreas de Vries
• ### Constructor Summary

Constructors
Constructor and Description
```Regression(double[] t, double[][] y)```
constructor for time series with unknown measurement errors.
```Regression(double[] t, double[][] y, double[][] deltaY)```
constructor for time series with known measurement errors.
• ### Method Summary

All Methods
Modifier and Type Method and Description
`void` `computeCoefficients(int rMax)`
polynomial regression for given data points
`double[]` `getT()`
Returns the t-values of the data points (t, y).
`double[][]` `getY()`
Returns the array of y-values of the data points (t, y).
`double[][]` ```polynomial(double t, double chi2, double p, int nr, int nf)```
computes the value eta(t) on the regression curve at t and its distance from the confidence limits, if the measurement errors are unknown.
`double[][]` ```polynomial(double t, double p, int nr)```
computes the value on the regression curve at t and its distance from the confidence limits, if the measurement errors are known.
`double[]` ```polynomial(double t, int nr)```
computes the value on the regression curve at t.
• ### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`
• ### Constructor Detail

• #### Regression

```public Regression(double[] t,
double[][] y)```
constructor for time series with unknown measurement errors.
Parameters:
`t` - the t-values of the data points (t, y)
`y` - an array of the y-values of the data points (t, y)
• #### Regression

```public Regression(double[] t,
double[][] y,
double[][] deltaY)```
constructor for time series with known measurement errors.
Parameters:
`t` - the t-values of the data points (t, y)
`y` - an array of the y-values of the data points (t, y)
`deltaY` - the measurement errors
• ### Method Detail

• #### getT

`public double[] getT()`
Returns the t-values of the data points (t, y).
Returns:
the t-values of the data points (t, y).
• #### getY

`public double[][] getY()`
Returns the array of y-values of the data points (t, y).
Returns:
the array of y-values of the data points (t, y).
• #### computeCoefficients

`public void computeCoefficients(int rMax)`
polynomial regression for given data points.

y(t) = x0 f0(t) + x1 f1(t) + ... + xr fr(t),

Parameters:
`rMax` - maximal number of parameters
• #### polynomial

```public double[] polynomial(double t,
int nr)```
computes the value on the regression curve at t. It does not return its distance from the confidence limit, so it does not matter whether the measurement errors are known or not.
Parameters:
`t` - value of the control variable
`nr` - the degree of the regression polynomial
Returns:
regression value, for each y-data row
• #### polynomial

```public double[][] polynomial(double t,
double p,
int nr)```
computes the value on the regression curve at t and its distance from the confidence limits, if the measurement errors are known.
Parameters:
`t` - value of the control variable
`p` - probability of the confidence limit
`nr` - number of parameters r in the polynomial
Returns:
for each y-data row, an array consisting of the regression value and its distance from the confidence limits
• #### polynomial

```public double[][] polynomial(double t,
double chi2,
double p,
int nr,
int nf)```
computes the value eta(t) on the regression curve at t and its distance from the confidence limits, if the measurement errors are unknown. The distance of eta(t) from the confidence limits depends on chi2, the value of the least square fit for adjusting a polynomial of degree r-1 under the assumption that all measurement errors sigma_i = 1. It must be positive, chi2 %gt; 0.
Parameters:
`t` - value of the control variable
`chi2` - value of the least square fit for adjusting a polynomial of degree r-1
`p` - probability of the confidence limit
`nr` - number of parameters r in the polynomial
`nf` - number f = N - r of degrees of freedom
Returns:
for each y-data row, an array consisting of the regression value and its distance from the confidence limits