Class GeneralizedLeastSquare
- java.lang.Object
-
- com.opengamma.strata.math.impl.statistics.leastsquare.GeneralizedLeastSquare
-
public class GeneralizedLeastSquare extends Object
Generalized least square method.
-
-
Constructor Summary
Constructors Constructor Description GeneralizedLeastSquare()
Creates an instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <T> GeneralizedLeastSquareResults<T>
solve(List<T> x, List<Double> y, List<Double> sigma, List<Function<T,Double>> basisFunctions)
<T> GeneralizedLeastSquareResults<T>
solve(List<T> x, List<Double> y, List<Double> sigma, List<Function<T,Double>> basisFunctions, double lambda, int differenceOrder)
Generalised least square with penalty on (higher-order) finite differences of weights.<T> GeneralizedLeastSquareResults<T>
solve(List<T> x, List<Double> y, List<Double> sigma, List<Function<T,Double>> basisFunctions, int[] sizes, double[] lambda, int[] differenceOrder)
Specialist method used mainly for solving multidimensional P-spline problems where the basis functions (B-splines) span a N-dimension space, and the weights sit on an N-dimension grid and are treated as a N-order tensor rather than a vector, so k-order differencing is done for each tensor index while varying the other indices.<T> GeneralizedLeastSquareResults<T>
solve(T[] x, double[] y, double[] sigma, List<Function<T,Double>> basisFunctions)
<T> GeneralizedLeastSquareResults<T>
solve(T[] x, double[] y, double[] sigma, List<Function<T,Double>> basisFunctions, double lambda, int differenceOrder)
Generalised least square with penalty on (higher-order) finite differences of weights.
-
-
-
Method Detail
-
solve
public <T> GeneralizedLeastSquareResults<T> solve(T[] x, double[] y, double[] sigma, List<Function<T,Double>> basisFunctions)
- Type Parameters:
T
- The type of the independent variables (e.g. Double, double[], DoubleArray etc)- Parameters:
x
- independent variablesy
- dependent (scalar) variablessigma
- (Gaussian) measurement error on dependent variablesbasisFunctions
- set of basis functions - the fitting function is formed by these basis functions times a set of weights- Returns:
- the results of the least square
-
solve
public <T> GeneralizedLeastSquareResults<T> solve(T[] x, double[] y, double[] sigma, List<Function<T,Double>> basisFunctions, double lambda, int differenceOrder)
Generalised least square with penalty on (higher-order) finite differences of weights.- Type Parameters:
T
- The type of the independent variables (e.g. Double, double[], DoubleArray etc)- Parameters:
x
- independent variablesy
- dependent (scalar) variablessigma
- (Gaussian) measurement error on dependent variablesbasisFunctions
- set of basis functions - the fitting function is formed by these basis functions times a set of weightslambda
- strength of penalty functiondifferenceOrder
- difference order between weights used in penalty function- Returns:
- the results of the least square
-
solve
public <T> GeneralizedLeastSquareResults<T> solve(List<T> x, List<Double> y, List<Double> sigma, List<Function<T,Double>> basisFunctions)
- Type Parameters:
T
- The type of the independent variables (e.g. Double, double[], DoubleArray etc)- Parameters:
x
- independent variablesy
- dependent (scalar) variablessigma
- (Gaussian) measurement error on dependent variablesbasisFunctions
- set of basis functions - the fitting function is formed by these basis functions times a set of weights- Returns:
- the results of the least square
-
solve
public <T> GeneralizedLeastSquareResults<T> solve(List<T> x, List<Double> y, List<Double> sigma, List<Function<T,Double>> basisFunctions, double lambda, int differenceOrder)
Generalised least square with penalty on (higher-order) finite differences of weights.- Type Parameters:
T
- The type of the independent variables (e.g. Double, double[], DoubleArray etc)- Parameters:
x
- independent variablesy
- dependent (scalar) variablessigma
- (Gaussian) measurement error on dependent variablesbasisFunctions
- set of basis functions - the fitting function is formed by these basis functions times a set of weightslambda
- strength of penalty functiondifferenceOrder
- difference order between weights used in penalty function- Returns:
- the results of the least square
-
solve
public <T> GeneralizedLeastSquareResults<T> solve(List<T> x, List<Double> y, List<Double> sigma, List<Function<T,Double>> basisFunctions, int[] sizes, double[] lambda, int[] differenceOrder)
Specialist method used mainly for solving multidimensional P-spline problems where the basis functions (B-splines) span a N-dimension space, and the weights sit on an N-dimension grid and are treated as a N-order tensor rather than a vector, so k-order differencing is done for each tensor index while varying the other indices.- Type Parameters:
T
- The type of the independent variables (e.g. Double, double[], DoubleArray etc)- Parameters:
x
- independent variablesy
- dependent (scalar) variablessigma
- (Gaussian) measurement error on dependent variablesbasisFunctions
- set of basis functions - the fitting function is formed by these basis functions times a set of weightssizes
- The size the weights tensor in each dimension (the product of this must equal the number of basis functions)lambda
- strength of penalty function in each dimensiondifferenceOrder
- difference order between weights used in penalty function for each dimension- Returns:
- the results of the least square
-
-