Visual Basic (Declaration)  

Public Overloads Shared Function TrendLinePolynomial( _ ByVal seriesName As String, _ ByVal s As Series, _ ByVal degree As Integer, _ ByVal startDate As Date, _ ByVal endDate As Date _ ) As Series 
Visual Basic (Usage)  Copy Code 


C#  

public static Series TrendLinePolynomial( string seriesName, Series s, int degree, DateTime startDate, DateTime endDate ) 
Parameters
 seriesName
 The name of the series which will be displayed on the chart, i.e. its label.
 s
 A statistical series.
 degree
 The degree of the polynomial which is fitted to the data set given (i.e. if degree is 2, then a quadratic is fitted).
 startDate
 The start date of the trend line
 endDate
 The end date of the trend line
Return Value
A series where the kth element of the array represents of kth point (i.e. { x_k, y_k }) of the total set over which the fitted function is evaluated. The total set over which the fitted function is evaluated consists of the `backward' points, original data set points and the `forward' points.Remark: This methods corresponds in functionality to the method of the same name within Microsoft Excel.
Remark: The difference between this method and TrendLinePolynomial, is that it allows the values of the fitted function to be evaluated over an extended range. That is, a range in the xcoordinate greater than the original given data set.
Where the extended values are evaluated?
The parameters step
, forward
, backward
allows the position
and number of additional points above and/or below the range of the values in the
xcoordinate of the original data set to be given. The forward
parameter specifies
the number of the additional evaluation points of the fitted function which are greater
than the values of the xcoordinates of the original data set. Similarly, the
backward
parameter specifies the number of the additional evaluation points of the
fitted function which are lower than the values of the xcoordinates of the original
data set. The step
specifies the distance in the xcoordinate between each of the
additional data points, where the first additional data point either above or below is
exactly a distance of step
from the points of the original data set
which the highest and lowest values in the xcoordinate.
For example, consider the data set x = 1, 2, 3
; y = 1, 2, 3
. Now if
step = 1
, forward = 2
, and backward = 3
, then this method when applied
will return a two dimensional array. This two dimensional array will have the following
structure: { { 2, f(2) } { 1, f(1) } { 0, f(0) }{ 1, 1 } { 2, 2 }{ 3, 3 } { 4, f(4) } { 5, f(5) } }
,
where f(2), f(1), f(0), f(4), f(5)
correspond to the value of the fitted functions at the
points x = 2, 1, 0, 4, 5
, respectively.