Class PolynomialsLeastSquaresFitter
- java.lang.Object
-
- com.opengamma.strata.math.impl.interpolation.PolynomialsLeastSquaresFitter
-
public class PolynomialsLeastSquaresFitter extends Object
Derive coefficients of n-degree polynomial that minimizes least squares error of fit by using QR decomposition and back substitution.
-
-
Constructor Summary
Constructors Constructor Description PolynomialsLeastSquaresFitter()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description LeastSquaresRegressionResult
regress(double[] xData, double[] yData, int degree)
Given a set of data (X_i, Y_i) and degrees of a polynomial, determines optimal coefficients of the polynomial.PolynomialsLeastSquaresFitterResult
regressVerbose(double[] xData, double[] yData, int degree, boolean normalize)
Alternative regression method with different output.
-
-
-
Method Detail
-
regress
public LeastSquaresRegressionResult regress(double[] xData, double[] yData, int degree)
Given a set of data (X_i, Y_i) and degrees of a polynomial, determines optimal coefficients of the polynomial.- Parameters:
xData
- X values of datayData
- Y values of datadegree
- Degree of polynomial which fits the given data- Returns:
- LeastSquaresRegressionResult Containing optimal coefficients of the polynomial and difference between yData[i] and f(xData[i]), where f() is the polynomial with the derived coefficients
-
regressVerbose
public PolynomialsLeastSquaresFitterResult regressVerbose(double[] xData, double[] yData, int degree, boolean normalize)
Alternative regression method with different output.- Parameters:
xData
- X values of datayData
- Y values of datadegree
- Degree of polynomial which fits the given datanormalize
- Normalize xData by mean and standard deviation if normalize == true- Returns:
- PolynomialsLeastSquaresRegressionResult containing coefficients, rMatrix, degrees of freedom, norm of residuals, and mean, standard deviation
-
-