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

## Syntax

**XCFTest**(**Y**, **X**, **K**, **$\rho$**, **Method**, **Return_type**, **$\alpha$**)

- Y
- is the first data series (a one-dimensional array of cells (e.g., rows or columns)).
- X
- is the second data series (a one-dimensional array of cells (e.g., rows or columns)).
- K
- is the lag order (e.g., 0 = no lag, 1 = 1st lag, etc.) to use with the second time series input (X). If missing, the default lag order of zero (i.e., no-lag) is assumed.
- $\rho$
- is the hypothetical (assumed) correlation factor. If missing, the default value of zero is assumed.
- Method
- is the desired correlation coefficient (1 = Pearson (default), 2 = Spearman, 3 = Kendall). If missing, a Pearson coefficient is assumed.
Method Description 1 Pearson. 2 Spearman. 3 Kendall. - Return_type
- is a switch to select the return output (1 = P-Value (default), 2 = Test Stats, 3 = Critical Value).
Method Description 1 P-Value. 2 Test Statistics (e.g., Z-score). 3 Critical Value. - $\alpha$
- is the statistical significance or confidence level (i.e., $\alpha$). If missing or omitted, an alpha value of 5% is assumed.

## Remarks

- The XCF test performs the following test:
- 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.

- The time series is homogeneous or equally spaced.
- The significance level (i.e., $\alpha$) is only needed for calculating the test critical value.
- The time series may include missing values (e.g., #N/A) at either end.
- This is a two-tails (i.e., two-sides) test, so the computed p-value should be compared with half of the significance level ($\alpha$).

## Files Examples

## Related Links

- Wikipedia - Correlation.
- Wikipedia - Cross-Correlation.
- Wikipedia - Pearson product-moment correlation coefficient.
- Wikipedia - Spearman's rank correlation coefficient.
- Wikipedia - Kendall tau rank correlation coefficient.

## References

- Jarque, Carlos M.; Anil K. Bera (1980). "Efficient tests for normality, homoscedasticity and serial independence of regression residuals". Economics Letters 6 (3): 255-259.
- Ljung, G. M. and Box, G. E. P., "On a measure of lack of fit in time series models." Biometrika 65 (1978): 297-303.
- Enders, W., "Applied econometric time series", John Wiley & Sons, 1995, p. 86-87.
- Shapiro, S. S. and Wilk, M. B. (1965). "An analysis of variance test for normality (complete samples)", Biometrika, 52, 3 and 4, pages 591-611.

## Comments

Article is closed for comments.