NonlinearCurveFitter Class

Represents an algorithm that fits a nonlinear curve to data.

Definition

Namespace: Numerics.NET.Curves
Assembly: Numerics.NET (in Numerics.NET.dll) Version: 9.0.4
C#
public class NonlinearCurveFitter : CurveFitter
Inheritance
Object  →  CurveFitter  →  NonlinearCurveFitter

Remarks

Use the NonlinearCurveFitter class to fit data to a nonlinear curve by the method of least squares. The curve, which must be of a type that inherits from NonlinearCurve, is specified by the Curve property. The data is supplied as Vector objects through the XValues and YValues properties.

The Fit() method performs the actual curve fit. This method returns the NonlinearCurve that best fits the supplied data. The Optimizer property returns the MultidimensionalOptimizer object that was used to find the least squares solution. To verify that the algorithm terminated normally, you can inspect the Optimizer's Status property, which is of type AlgorithmStatus. A value of Normal indicates that the algorithm terminated normally. However, it is still possible that the algorithm didn't converge to the actual best fit. A visual inspection is always recommended.

The parameters of the fitted curve can be retrieved through the BestFitParameters property. The standard deviations associated with each parameter are available through the GetStandardDeviations() method.

By default, the observations are unweighted. You can supply a weighting method in two ways. You can set the WeightFunction property to a function of two variables delegate that computes the weight for each observation. The WeightFunctions class provides predefined delegates for the most common weight functions. Alternatively, you can set the individual weights by setting the WeightVector property to a Vector that contains the weight for each individual observation.

Constructors

NonlinearCurveFitter() Constructs a new NonlinearCurveFitter object.
NonlinearCurveFitter(NonlinearCurveFittingMethod) Constructs a new NonlinearCurveFitter object.

Properties

BestFitParameters Gets the curve parameters corresponding to the best fit.
(Inherited from CurveFitter)
Curve Gets the non-linear curve that is being fitted.
(Overrides CurveFitter.Curve)
InitialGuess Gets or sets the initial value for the iteration.
(Inherited from CurveFitter)
LowerBounds Gets or sets the vector of lower bounds of the curve parameters.
Method Gets or sets the nonlinear least squares algorithm that is to be used in the calculations.
Optimizer Gets the optimizer used to calculate the nonlinear least-squares solution.
Residuals Gets the residuals for the observations.
(Inherited from CurveFitter)
ScaleVector Gets or sets the vector used to scale the curve parameters.
(Inherited from CurveFitter)
StandardError Gets the standard error of the curve fit.
(Inherited from CurveFitter)
UpperBounds Gets or sets the vector of upper bounds of the curve parameters.
WeightFunction Gets or sets the weight function.
(Inherited from CurveFitter)
WeightVector Gets or sets the weight vector.
(Inherited from CurveFitter)
XValues Gets or sets the vector of x-values.
(Inherited from CurveFitter)
YValues Gets or sets the vector of y-values.
(Inherited from CurveFitter)

Methods

ComputeFit Calculates the least-squares fit.
(Overrides CurveFitter.ComputeFit(DenseVector<Double>, SymmetricMatrix<Double>, Double))
EqualsDetermines whether the specified object is equal to the current object.
(Inherited from Object)
FinalizeAllows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
(Inherited from Object)
Fit Calculates the least-squares fit.
(Inherited from CurveFitter)
GetConfidenceBandwidth(Double) Gets the width of the confidence band around the best-fit curve at the specified point at the 95% confidence level.
(Inherited from CurveFitter)
GetConfidenceBandwidth(Double, Double) Gets the width of the confidence band around the best-fit curve at the specified point.
(Overrides CurveFitter.GetConfidenceBandwidth(Double, Double))
GetHashCodeServes as the default hash function.
(Inherited from Object)
GetPredictionBandwidth(Double) Gets the width of the prediction band around the best-fit curve at the specified point at the 95% confidence level.
(Inherited from CurveFitter)
GetPredictionBandwidth(Double, Double) Gets the width of the prediction band around the best-fit curve at the specified point.
(Overrides CurveFitter.GetPredictionBandwidth(Double, Double))
GetStandardDeviations Gets the standard deviations.
(Inherited from CurveFitter)
GetTypeGets the Type of the current instance.
(Inherited from Object)
GetVarianceCovarianceMatrix Returns the variance-covariance matrix of the fit.
(Inherited from CurveFitter)
MemberwiseCloneCreates a shallow copy of the current Object.
(Inherited from Object)
Scale(DenseVector<Double>) Scales the components of a vector using the values from ScaleVector.
(Inherited from CurveFitter)
Scale(Vector<Double>) Scales the components of a vector using the values from ScaleVector.
(Inherited from CurveFitter)
ToStringReturns a string that represents the current object.
(Inherited from Object)
Unscale(DenseVector<Double>) Undoes the scaling of the components of a vector using the values from ScaleVector.
(Inherited from CurveFitter)
Unscale(Vector<Double>) Undoes the scaling of the components of a vector using the values from ScaleVector.
(Inherited from CurveFitter)

See Also