JMSLTM Numerical Library 4.0

com.imsl.math
Class BsLeastSquares

java.lang.Object
  extended bycom.imsl.math.BSpline
      extended bycom.imsl.math.BsLeastSquares
All Implemented Interfaces:
Cloneable, Serializable

public class BsLeastSquares
extends BSpline

Extension of the BSpline class to compute a least squares spline approximation to data points.

Let's make the identifications

n = xData.length

x = xData

f = yData

m = nCoef

k = order

For convenience, we assume that the sequence x is increasing, although the class does not require this.

By default, k = 4, and the knot sequence we select equally distributes the knots through the distinct {x_i}'s. In particular, the m + k knots will be generated in [x_1, x_n] with k knots stacked at each of the extreme values. The interior knots will be equally spaced in the interval.

Once knots {bf t} and weights w are determined, then the spline least-squares fit to the data is computed by minimizing over the linear coefficients a_j

sum_{i=0}^{n-1} {w_ibiggl[f_i-sum_{j=1}^{m}{a_jB_j(x_i)}biggr]^2}

where the B_j, j = 1, ..., m are a (B-spline) basis for the spline subspace.

This algorithm is based on the routine L2APPR by deBoor (1978, p. 255).

See Also:
Example, Serialized Form

Field Summary
protected  int nCoef
          Number of B-spline coefficients.
protected  double[] weight
          The weight array of length n, where n is the number of data points fit.
 
Fields inherited from class com.imsl.math.BSpline
coef, knot, order
 
Constructor Summary
BsLeastSquares(double[] xData, double[] yData, int nCoef)
          Constructs a least squares B-spline approximation to the given data points.
BsLeastSquares(double[] xData, double[] yData, int nCoef, int order)
          Constructs a least squares B-spline approximation to the given data points.
BsLeastSquares(double[] xData, double[] yData, int nCoef, int order, double[] weight, double[] knot)
          Constructs a least squares B-spline approximation to the given data points.
 
Methods inherited from class com.imsl.math.BSpline
derivative, derivative, derivative, getKnots, getSpline, integral, value, value
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

nCoef

protected int nCoef
Number of B-spline coefficients.


weight

protected double[] weight
The weight array of length n, where n is the number of data points fit.

Constructor Detail

BsLeastSquares

public BsLeastSquares(double[] xData,
                      double[] yData,
                      int nCoef)
Constructs a least squares B-spline approximation to the given data points.

Parameters:
xData - A double array containing the x-coordinates of the data.
yData - A double array containing the y-coordinates of the data. The arrays xData and yData must have the same length.
nCoef - An int denoting the linear dimension of the spline subspace. It should be smaller than the number of data points and greater than or equal to the order of the spline (whose default value is 4).

BsLeastSquares

public BsLeastSquares(double[] xData,
                      double[] yData,
                      int nCoef,
                      int order)
Constructs a least squares B-spline approximation to the given data points.

Parameters:
xData - A double array containing the x-coordinates of the data.
yData - A double array containing the y-coordinates of the data. The arrays xData and yData must have the same length.
nCoef - An int denoting the linear dimension of the spline subspace. It should be smaller than the number of data points and greater than or equal to the order of the spline.
order - An int denoting the order of the spline.

BsLeastSquares

public BsLeastSquares(double[] xData,
                      double[] yData,
                      int nCoef,
                      int order,
                      double[] weight,
                      double[] knot)
Constructs a least squares B-spline approximation to the given data points.

Parameters:
xData - A double array containing the x-coordinates of the data.
yData - A double array containing the y-coordinates of the data. The arrays xData and yData must have the same length.
nCoef - An int denoting the linear dimension of the spline subspace. It should be smaller than the number of data points and greater than or equal to the order of the spline.
order - An int denoting the order of the spline.
weight - A double array containing the weights for the data. The arrays xData, yData and weights must have the same length.
knot - A double array containing the knot sequence for the spline.

JMSLTM Numerical Library 4.0

Copyright 1970-2006 Visual Numerics, Inc.
Built June 1 2006.