File Exchange

## test periodicity

version 1.1.0.0 (2.17 KB) by Hanan Shteingart

### Hanan Shteingart (view profile)

Test for signal periodicity using Fisher's g-statistics (see references below)

Updated 29 Jul 2013

Test for signal periodicity using Fisher's g-statistics (see references
below). Due to numerical limitations (large factorials) the p value can
be calculated only for significant value (p<0.1). For larger p values the
resultant p-value is 1.

syntax:
[pval, fMax] = test_periodicity(x)
input:
x - NxT - matrix of time series(N - time series, T - time samples).
fmin - (optional) - minimum freq in units of number of observed periods (minimum frequency x T)
output:
pval - Nx1 - pvalue (pvalues higher than 0.1 are set to 1).
fMax - Nx1 - frequency of maximum power (even if insignificant) in
normalized units.
References:
Fisher. "Tests of Significance in Harmonic Analysis." 1929 Proc. R. Soc. vol. 125 no. 796 54-59 - http://bioinformatics.oxfordjournals.org/content/20/1/5.full.pdf
http://www.mathworks.com/help/signal/ug/significance-testing-for-periodic-component.html\ - watch it, there is an bug there

Jason

### Jason (view profile)

The program calls a function "fprintfstack" which is not provided

Hanan Shteingart

### Hanan Shteingart (view profile)

Dear Nora,
The bug is in taking only 3 terms from the original series in Fisher's paper. At non significant samples g is small resulting in a sum over many large terms. This results in numerical errors which in turn fails to estimate the true p-value. In my submission I bypassed it by finding first the 5% significance g value and set it as a threshold below which p value is 1.

Nora

### Nora (view profile)

Would you mind telling me what is the bug that you detect in:
http://www.mathworks.com/help/signal/ug/significance-testing-for-periodic-component.html

Thanks!