# NDK_DIFF

 int __stdcall NDK_DIFF ( double * X, size_t N, size_t S, size_t D )

Returns an array of cells for the differenced time series (i.e. (1-L^S)^D).

Returns
status code of the operation
Return values
 NDK_SUCCESS Operation successful NDK_FAILED Operation unsuccessful. See Macros for full list.
Parameters
 [in,out] X is the univariate time series data (a one dimensional array). [in] N is the number of observations in X. [in] S is the lag order (e.g. k=0 (no lag), k=1 (1st lag), etc.). [in] D is the number of repeated differencing (e.g. d=0 (none), d=1 (difference once), 2=(difference twice), etc.).
Remarks
1. The time series are homogeneous or equally spaced.
2. The two time series have an identical number of observations and time order, or the second series contains a single value.
3. In the case where the two time series are identically sized, the second series is subtracted from the first point-by-point: $\left[z_t\right] = \left[x_t\right] - \left[y_t\right]$ Where:
• $$\left[z_t\right]$$ is the difference time series.
• $$\left[x_t\right]$$ is the first time series.
• $$\left[y_t\right]$$ is the second time series.
4. In the case where the second time series is passed as a single value ($$\alpha$$), this constant is subtracted from all points in the first time series: $\left[z_t\right] =\left[x_t\right] - \left[\alpha\right]$ Where:
• $$\left[z_t\right]$$ is the difference time series.
• $$\left[x_t\right]$$ is the first time series.
• $$\alpha$$ is a constant value.
5. The returned array has the same size and time order as the first input time series.
Requirements
Examples



 Namespace: NumXLAPI Class: SFSDK Scope: Public Lifetime: Static
 int NDK_DIFF ( double[] data, UIntPtr nSize, UIntPtr nLag, UIntPtr nDifference )

Returns an array of cells for the differenced time series (i.e. (1-L^S)^D).

Returns
status code of the operation
Return values
 NDK_SUCCESS Operation successful NDK_FAILED Operation unsuccessful. See Macros for full list.
Parameters
 [in,out] data is the univariate time series data (a one dimensional array). [in] nSize is the number of observations in data. [in] nLag is the lag order (e.g. k=0 (no lag), k=1 (1st lag), etc.). [in] nDifference is the number of repeated differencing (e.g. d=0 (none), d=1 (difference once), 2=(difference twice), etc.).
Remarks
1. The time series are homogeneous or equally spaced.
2. The two time series have an identical number of observations and time order, or the second series contains a single value.
3. In the case where the two time series are identically sized, the second series is subtracted from the first point-by-point: $\left[z_t\right] = \left[x_t\right] - \left[y_t\right]$ Where:
• $$\left[z_t\right]$$ is the difference time series.
• $$\left[x_t\right]$$ is the first time series.
• $$\left[y_t\right]$$ is the second time series.
4. In the case where the second time series is passed as a single value ($$\alpha$$), this constant is subtracted from all points in the first time series: $\left[z_t\right] =\left[x_t\right] - \left[\alpha\right]$ Where:
• $$\left[z_t\right]$$ is the difference time series.
• $$\left[x_t\right]$$ is the first time series.
• $$\alpha$$ is a constant value.
5. The returned array has the same size and time order as the first input time series.
Exceptions
Exception Type Condition
None N/A
Requirements
Namespace NumXLAPI SFSDK Public Static 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