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 (one dimensional array of cells (e.g. rows or columns)).

**X** is the second data series (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 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 (sides) test, so the computed p-value should be compared with half of the significance level ($\alpha$).

## Examples

**Example 1: **

A | B | C | |
---|---|---|---|

1 | Date | Series1 | Series2 |

2 | 1/1/2008 | #N/A | -2.61 |

3 | 1/2/2008 | -2.83 | -0.28 |

4 | 1/3/2008 | -0.95 | -0.90 |

5 | 1/4/2008 | -0.88 | -1.72 |

6 | 1/5/2008 | 1.21 | 1.92 |

7 | 1/6/2008 | -1.67 | -0.17 |

8 | 1/7/2008 | 0.83 | -0.04 |

9 | 1/8/2008 | -0.27 | 1.63 |

10 | 1/9/2008 | 1.36 | -0.12 |

11 | 1/10/2008 | -0.34 | 0.14 |

12 | 1/11/2008 | 0.48 | -1.96 |

13 | 1/12/2008 | -2.83 | 1.30 |

14 | 1/13/2008 | -0.95 | -2.51 |

15 | 1/14/2008 | -0.88 | -0.93 |

16 | 1/15/2008 | 1.21 | 0.39 |

17 | 1/16/2008 | -1.67 | -0.06 |

18 | 1/17/2008 | -2.99 | -1.29 |

19 | 1/18/2008 | 1.24 | 1.41 |

20 | 1/19/2008 | 0.64 | 2.37 |

Formula | Description (Result) | |
---|---|---|

=XCFTest(\$B\$2:\$B\$20,\$C\$2:\$C\$20,1,1) | =XCFTest for P-Value (0.100) | |

=XCFTest(\$B\$2:\$B\$20,\$C\$2:\$C\$20,1,2) | XCFTest for Test Statistics (1.335) | |

=XCFTest(\$B\$2:\$B\$20,\$C\$2:\$C\$20,1,3) | XCFTest for Critical Value (2.120) |

## Files Examples

## 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

## 0 Comments