Implements the CFDAutoperiod algorithm (Puech et al. 2020) which applies first-order differencing for detrending, then uses density-based clustering of spectral peaks and ACF validation on the original signal.
Value
A list of class "cfd_autoperiod_result" with components:
- period
Primary detected period (best validated cluster center)
- confidence
Combined confidence (ACF validation * spectral power)
- acf_validation
ACF validation score for the primary period
- n_periods
Number of validated period clusters
- periods
All detected period cluster centers
- confidences
Confidence scores for each detected period
Details
The CFDAutoperiod algorithm works in five stages:
Differencing: First-order differencing removes polynomial trends
FFT: Computes periodogram on the detrended signal
Peak Detection: Finds all peaks above the noise floor
Clustering: Groups nearby period candidates into clusters
ACF Validation: Validates cluster centers using the ACF of the original (non-differenced) signal
This method is particularly effective for:
Signals with strong polynomial trends
Multiple concurrent periodicities
Signals where spectral leakage creates nearby spurious peaks
References
Puech, T., Boussard, M., D'Amato, A., & Millerand, G. (2020). A fully automated periodicity detection in time series. In Advanced Analytics and Learning on Temporal Data (pp. 43-54). Springer.
See also
autoperiod for the original Autoperiod algorithm,
sazed for an ensemble method
Examples
# Generate data with trend
t <- seq(0, 20, length.out = 400)
X <- matrix(0.2 * t + sin(2 * pi * t / 2), nrow = 1)
fd <- fdata(X, argvals = t)
# CFDAutoperiod handles trends via differencing
result <- cfd.autoperiod(fd)
print(result)
#> CFDAutoperiod Detection
#> -----------------------
#> Primary Period: 2.0000
#> Confidence: 0.8939
#> ACF Validation: 0.8939
#> Periods Found: 1
# Multiple periods detected
X2 <- matrix(sin(2 * pi * t / 2) + 0.5 * sin(2 * pi * t / 5), nrow = 1)
fd2 <- fdata(X2, argvals = t)
result2 <- cfd.autoperiod(fd2)
print(result2$periods) # All detected periods
#> [1] 2