# NDK_LAG

 int __stdcall NDK_LAG ( double * X, size_t N, size_t K )

Returns an array of cells for the backward shifted, backshifted or lagged time series.

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] K is the lag order (e.g. k=0 (no lag), k=1 (1st lag), etc.).
Remarks
1. The time series is homogeneous or equally spaced.
2. The time series may include missing values (e.g. NaN) at either end.
3. k (i.e. Excel lag order) should be non-negative and less than the size of the time series.
4. The lagged time series is: $\left[z_t\right] = L^k\left[x_t\right] = \left[x_{t-k}\right]$ Where:
• $$\left[z_t\right]$$ is the lagged time series.
• $$\left[x_t\right]$$ is the input time series.
• $$L$$ is the Excel lag operator.
• $$k$$ is the Excel lag order.
$$k \leq T-1$$
Requirements
Examples



 Namespace: NumXLAPI Class: SFSDK Scope: Public Lifetime: Static
 int NDK_LAG ( double[] data, UIntPtr nLen, UIntPtr lag )

Returns an array of cells for the backward shifted, backshifted or lagged time series.

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] nLen is the number of observations in data. [in] lag is the lag order (e.g. k=0 (no lag), k=1 (1st lag), etc.).
Remarks
1. The time series is homogeneous or equally spaced.
2. The time series may include missing values (e.g. NaN) at either end.
3. k (i.e. Excel lag order) should be non-negative and less than the size of the time series.
4. The lagged time series is: $\left[z_t\right] = L^k\left[x_t\right] = \left[x_{t-k}\right]$ Where:
• $$\left[z_t\right]$$ is the lagged time series.
• $$\left[x_t\right]$$ is the input time series.
• $$L$$ is the Excel lag operator.
• $$k$$ is the Excel lag order.
$$k \leq T-1$$
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