dotnetCHARTING Send comments on this topic.
NonLinearModel(String,Series,Series,Double[],Boolean[]) Method
See Also 
dotnetCHARTING Namespace > ForecastEngine.Advanced Class > NonLinearModel Method : NonLinearModel(String,Series,Series,Double[],Boolean[]) Method


seriesName
The name of the series which will be displayed on the chart, i.e. its label.
s
A statistical series.
deviations
An array of doubles where the k-th terms corresponding to the weighting given to the model errors associated within the k-th data point.
a
The parameters/state of the model.
vary
False to indicate the corresponding modelParameters[k] is to be held fixed.
Here we offer the Levenberg - Marquardt algorithm which fits a given non-linear function set in accordance with the least squares approach.

Syntax

Visual Basic (Declaration)  
Public Overloads Shared Function NonLinearModel( _
   ByVal seriesName As String, _
   ByVal s As Series, _
   ByVal deviations As Series, _
   ByVal a() As Double, _
   ByVal vary() As Boolean _
) As Series
Visual Basic (Usage) Copy Code
Dim seriesName As String
Dim s As Series
Dim deviations As Series
Dim a() As Double
Dim vary() As Boolean
Dim value As Series
 
value = ForecastEngine.Advanced.NonLinearModel(seriesName, s, deviations, a, vary)
C#  
public static Series NonLinearModel( 
   string seriesName,
   Series s,
   Series deviations,
   double[] a,
   bool[] vary
)

Parameters

seriesName
The name of the series which will be displayed on the chart, i.e. its label.
s
A statistical series.
deviations
An array of doubles where the k-th terms corresponding to the weighting given to the model errors associated within the k-th data point.
a
The parameters/state of the model.
vary
False to indicate the corresponding modelParameters[k] is to be held fixed.

Remarks

This examlpe finds the real valued function of best fit, of the type considered in accordance with the least squares approach. That is, for the functon f, which depends on the parameters (or variables a[]), we find the variables such that:

E = sum_k {(y[k] - f(x[k],a)) / s[k]}^2

is minimal, where:

  1. x[] - are the domain points, i.e. the points at which the values of the real valued function are evaluated.
  2. y[] - are the values of the data points at the domain values.
  3. a[] - the models parameters, that is the variables which the function which is being fitted depends on.
  4. s[] - the scale (or weight) which is applied to each error. That is, s[k] is the scale applied the error for the k-th data set point.

Remark: The implemention of the function interface, implements two methods which return the value and the gradient of the function f(x,a), and not the functional E given above.

Features of the Algorithm

The algorithm for the non-linear framework finds the local minimum in accordance with the least squares approach. This mean that the initial point given from which the minimum is sort lies within the same basin of attraction of the global minimum. In practice, this means in particularly when a non-linear function with many terms is considered that the initial starting point is very carefully chosen. This is not a consequence of our implementation but the nature of the algorithm and problem at hand. The algorithms is of greedy type and essentially uses an abstraction of calculus based methods in which the best point in a neighbourhood of a point a chosen at each step.

Remark: As a side note, the reason why the linear algorithm work so well is that it is based on a simplex algorithm which is combinatorial in nature.

See Also