NDK_TREND

int __stdcall NDK_TREND ( double *  pData,
size_t  nSize,
BOOL  bAscending,
WORD  nTrendType,
WORD  argPolyOrder,
BOOL  AllowIntercep,
double  InterceptVal,
int  nHorizon,
WORD  retType,
double  argAlpha,
double *  retVal 
)

Returns values along a trend curve (e.g. linear, quadratic, exponential, etc.) at time T+m.

Returns
status code of the operation
Return values
NDK_SUCCESS  Operation successful
NDK_FAILED  Operation unsuccessful. See Macros for full list.
Parameters
[in] pData is the univariate time series data (a one dimensional array).
[in] nSize is the number of elements in pData.
[in] bAscending  is the time order in the data series (i.e. the first data point's corresponding date (earliest date=1 (default), latest date=0)).
[in] nTrendType  is the model description flag for the trend function:
Order   Description
1 Linear (default)
2 Polynomial
3 Exponential
4 Logarithmic
5 Power
[in] argPolyOrder is the polynomial order. This is only relevant for a polynomial trend type and is ignored for all others. If missing, POrder = 1.
[in] AllowIntercep  is a switch to include or exclude an intercept in the regression.
[in] InterceptVal  is the constant or the intercept value to fix (e.g. zero). If missing (i.e. NaN), an intercept will not be fixed and is computed normally.
[in] nHorizon  is the forecast time horizon beyond the end of pData. If missing, a default value of 0 (latest or end of pData) is assumed.
[in] retType  is a switch to select the return output:
Method   Description
1 Forecast value (default)
2 C.I. Upper limit
3 C.I. Lower limit
4 R-Squared
[in] argAlpha  is the statistical significance or confidence level (i.e. alpha). If missing or omitted, an alpha value of 5% is assumed.
[out] retVal  is the calculated value of this function.
Remarks
  1. NDK_TREND supports the following trend functions: \[ \begin{cases} \mathrm{Linear} & Y_t=\alpha + \beta \times t \\ \mathrm{Polynomial} & Y_t=\alpha + \beta_1 \times t + \beta_2 \times t^2 + \cdots + \beta_N \times t^N \\ \mathrm{Exponential:} & Y_t= \alpha \times e^{\beta \times t} \\ \mathrm{Logarithm:} & Y_t= \alpha + \beta \times \ln(t) \\ \mathrm{Power:} & Y_t= \alpha \times t^{\beta} \\ \end{cases} \]
  2. For exponential and logarithmic trend in Excel functions, the intercept value is not permitted be fixed, and thus is ignored.
  3. The polynomial order argument must be a positive integer.
  4. The time series may include missing values (NaN) at either end.
Requirements
Header SFSDK.H
Library SFSDK.LIB
DLL SFSDK.DLL
Examples


   
Namespace:  NumXLAPI
Class:  SFSDK
Scope:  Public
Lifetime:  Static
int NDK_TREND ( double[]  pData,
int  nSize,
BOOL  bAscending,
short  nTrendType,
short  argPolyOrder,
BOOL  AllowIntercep,
double  InterceptVal,
int  nHorizon,
short  argRetType,
double  argAlpha,
ref double  retVal 
)

Returns values along a trend curve (e.g. linear, quadratic, exponential, etc.) at time T+m.

Returns
status code of the operation
Return values
NDK_SUCCESS  Operation successful
NDK_FAILED  Operation unsuccessful. See Macros for full list.
Parameters
[in] pData is the univariate time series data (a one dimensional array).
[in] nSize is the number of elements in pData.
[in] bAscending  is the time order in the data series (i.e. the first data point's corresponding date (earliest date=1 (default), latest date=0)).
[in] nTrendType  is the model description flag for the trend function:
Order   Description
1 Linear (default)
2 Polynomial
3 Exponential
4 Logarithmic
5 Power
[in] argPolyOrder is the polynomial order. This is only relevant for a polynomial trend type and is ignored for all others. If missing, POrder = 1.
[in] AllowIntercep  is a switch to include or exclude an intercept in the regression.
[in] InterceptVal  is the constant or the intercept value to fix (e.g. zero). If missing (i.e. NaN), an intercept will not be fixed and is computed normally.
[in] nHorizon  is the forecast time horizon beyond the end of pData. If missing, a default value of 0 (latest or end of pData) is assumed.
[in] argRetType  is a switch to select the return output:
Method   Description
1 Forecast value (default)
2 C.I. Upper limit
3 C.I. Lower limit
4 R-Squared
[in] argAlpha  is the statistical significance or confidence level (i.e. alpha). If missing or omitted, an alpha value of 5% is assumed.
[out] retVal  is the calculated value of this function.
Remarks
  1. NDK_TREND supports the following trend functions: \[ \begin{cases} \mathrm{Linear} & Y_t=\alpha + \beta \times t \\ \mathrm{Polynomial} & Y_t=\alpha + \beta_1 \times t + \beta_2 \times t^2 + \cdots + \beta_N \times t^N \\ \mathrm{Exponential:} & Y_t= \alpha \times e^{\beta \times t} \\ \mathrm{Logarithm:} & Y_t= \alpha + \beta \times \ln(t) \\ \mathrm{Power:} & Y_t= \alpha \times t^{\beta} \\ \end{cases} \]
  2. For exponential and logarithmic trend in Excel functions, the intercept value is not permitted be fixed, and thus is ignored.
  3. The polynomial order argument must be a positive integer.
  4. The time series may include missing values (NaN) at either end.
Exceptions
Exception Type Condition
None N/A
Requirements
Namespace NumXLAPI
Class SFSDK
Scope Public
Lifetime Static
Package NumXLAPI.DLL
Examples

	
References
* Hamilton, J .D.; Time Series Analysis , Princeton University Press (1994), ISBN 0-691-04289-6
* Tsay, Ruey S.; Analysis of Financial Time Series John Wiley & SONS. (2005), ISBN 0-471-690740
* D. S.G. Pollock; Handbook of Time Series Analysis, Signal Processing, and Dynamics; Academic Press; Har/Cdr edition(Nov 17, 1999), ISBN: 125609906
* Box, Jenkins and Reisel; Time Series Analysis: Forecasting and Control; John Wiley & SONS.; 4th edition(Jun 30, 2008), ISBN: 470272848