# NDK_XCFTEST

 int __stdcall NDK_XCFTEST ( double * X, double * Y, size_t N, int K, double target, double alpha, WORD method, WORD retType, double * retVal )

Calculates the test stats, p-value or critical value of the correlation test.

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] K is the lag order (e.g. k=0 (no lag), k=1 (1st lag), etc.).
[in] target is the assumed correlation value. If missing, a default of zero is assumed.
[in] alpha is the statistical significance level. If missing, a default of 5% is assumed.
[in] method is the desired correlation coefficient (1=Pearson (default), 2=Spearman, 3=Kendall). If missing, a Pearson coefficient is assumed.
[in] retType is a switch to select the return output:
Method Value Description
TEST_PVALUE 1 P-Value
TEST_SCORE 2 Test statistics (aka score)
TEST_CRITICALVALUE 3 Critical value.
[out] retVal is the calculated test statistics.
Remarks
1. The XCF test hypothesis: $H_{o}: \rho_{x,y}=0$ $H_{1}: \rho_{x,y} \neq 0$ Where:
• $$H_{o}$$ is the null hypothesis ($\hat\rho$ is not different from zero)
• $$H_{1}$$ is the alternate hypothesis ($$\hat\rho$$ is statistically significant)
• $$\rho_{x,y}$$ is the correlation factor between population X and Y
2. The time series is homogeneous or equally spaced.
3. The significance level (i.e. alpha) is only needed for calculating the test critical value.
4. The time series may include missing values (NaN) at either end.
5. This is a two-tails (sides) test, so the computed p-value should be compared with half of the significance level ($$\alpha$$).
Requirements
Examples



 Namespace: NumXLAPI Class: SFSDK Scope: Public Lifetime: Static
 int NDK_XCFTEST ( double[] pData1, double[] pData2, UInPtr nSize, int nLag, double target, double alpha, UInt16 method, UInt16 retType, out double retVal )

Calculates the test stats, p-value or critical value of the correlation test.

Returns
status code of the operation
Return values
 NDK_SUCCESS Operation successful NDK_FAILED Operation unsuccessful. See Macros for full list.
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 X (or Y).
[in] nLag is the lag order (e.g. k=0 (no lag), k=1 (1st lag), etc.).
[in] target is the assumed correlation value. If missing, a default of zero is assumed.
[in] alpha is the statistical significance level. If missing, a default of 5% is assumed.
[in] method is the desired correlation coefficient (1=Pearson (default), 2=Spearman, 3=Kendall). If missing, a Pearson coefficient is assumed.
[in] retType is a switch to select the return output:
Method Value Description
TEST_PVALUE 1 P-Value
TEST_SCORE 2 Test statistics (aka score)
TEST_CRITICALVALUE 3 Critical value.
[out] retVal is the calculated test statistics.
Remarks
1. The XCF test hypothesis: $H_{o}: \rho_{x,y}=0$ $H_{1}: \rho_{x,y} \neq 0$ Where:
• $$H_{o}$$ is the null hypothesis ($\hat\rho$ is not different from zero)
• $$H_{1}$$ is the alternate hypothesis ($$\hat\rho$$ is statistically significant)
• $$\rho_{x,y}$$ is the correlation factor between population X and Y
2. The time series is homogeneous or equally spaced.
3. The significance level (i.e. alpha) is only needed for calculating the test critical value.
4. The time series may include missing values (NaN) at either end.
5. This is a two-tails (sides) test, so the computed p-value should be compared with half of the significance level ($$\alpha$$).
Exceptions
Exception Type Condition
None N/A
Requirements
Namespace NumXLAPI SFSDK Public Static NumXLAPI.DLL
Examples

References
Hull, John C.; Options, Futures and Other DerivativesFinancial Times/ Prentice Hall (2011), ISBN 978-0132777421
Hans-Peter Deutsch; , Derivatives and Internal Models, Palgrave Macmillan (2002), ISBN 0333977068
John Y. Campbell, Andrew W. Lo, A. Craig MacKinlay, Andrew Y. Lo; The Econometrics of Financial Markets; Princeton University Press; 2nd edition(Dec 09, 1996), ISBN: 691043019
* 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