NDK_EWXCF

 int __stdcall NDK_EWXCF ( double * X, double * Y, size_t N, double lambda, size_t step, double * retVal )

Computes the correlation factor using the exponential-weighted correlation function.

NDK_EWXCF computes the correlation estimate using the exponential-weighted covariance (EWCOV) and volatility (EWMA/EWV) method for each 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] X is the first univariate time series data (a one dimensional array). [in] Y is the second univariate time series data (a one dimensional array). [in] N is the number of observations in X (or Y). [in] lambda is the smoothing parameter used for the exponential-weighting scheme. If missing, a default value of 0.94 is assumed. [in] step is the forecast time/horizon (expressed in terms of steps beyond the end of the time series X). If missing, a default value of 0 is assumed. [out] retVal is the estimated value of the correlation factor.
Remarks
1. The time series are homogeneous or equally spaced.
2. The two time series must have identical size and time order.
3. The cross correlation function is defined as:
• $$\rho^{(xy)}_t=\frac{\sigma_t^{(xy)}}{{_x\sigma_t}\times{_y\sigma_t}}$$
• $$\sigma_t^{(xy)} = \lambda\sigma_{t-1}^{(xy)}+(1-\lambda)x_{t-1}y_{t-1}$$
• $$_x\sigma_t^2=\lambda\times{_x\sigma_{t-1}^2}+(1-\lambda)x_{t-1}^2$$
• $$_y\sigma_t^2=\lambda\times{_y\sigma_{t-1}^2}+(1-\lambda)y_{t-1}^2$$,
where:
• $$\rho^{(xy)}_t$$ is the sample correlation between X and Y at time t.
• $$\sigma_t^{(xy)}$$ is the sample exponential-weighted covariance between X and Y at time t.
• $$_x\sigma_t$$ is the sample exponential-weighted volatility for the time series X at time t.
• $$_y\sigma_t$$ is the sample exponential-weighted volatility for the time series Y at time t.
• $$\lambda$$ is the smoothing factor used in the exponential-weighted volatility and covariance calculations.
Requirements
Examples



 Namespace: NumXLAPI Class: SFSDK Scope: Public Lifetime: Static
 int NDK_EWXCF ( double[] pData1, double[] pData2, UIntPtr nSize, double lambda, UIntPtr nStep, out double retVal )

NDK_EWXCF computes the correlation estimate using the exponential-weighted covariance (EWCOV) and volatility (EWMA/EWV) method for each time series.

Return Value

a value from NDK_RETCODE enumeration for the status of the call.

 NDK_SUCCESS operation successful Error Error Code
Parameters
 [in] pData1 is the first univariate time series data (a one dimensional array). [in] pData2 is the second univariate time series data (a one dimensional array). [in] nSize is the number of observations in pData1 (or pData2). [in] lambda is the smoothing parameter used for the exponential-weighting scheme. If missing, a default value of 0.94 is assumed. [in] nStep is the forecast time/horizon (expressed in terms of steps beyond the end of the time series X). If missing, a default value of 0 is assumed. [out] retVal is the estimated value of the correlation factor.
Remarks
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