Abstract
Nonparametric estimators and tests for time series analysis. The functions use bootstrap techniques and robust nonparametric difference-based estimators to test for the presence of possibly non-monotonic trends and for synchronicity of trends in multiple time series.
Introduction
Time series data in fields like climatology, economics, and ecology are rarely "well-behaved." They often feature autocorrelation, non-normal error distributions, and trends that aren't simply linear—they might rise, plateau, or reverse direction (non-monotonicity). Standard statistical tests often fail or produce false positives when faced with these complexities. The funtimes R package addresses these gaps by providing a suite of functions designed to handle "messy" real-world temporal data through robust, nonparametric methods.
Methodology
The package distinguishes itself by moving away from traditional parametric models in favor of nonparametric and bootstrap-based approaches. A central feature is the WAVK Test, which uses a local-window approach to detect trends of any smooth functional form. To handle dependencies, the package employs difference-based estimators (such as the Hall and Van Keilegom estimator) to calculate autoregressive (AR) parameters. This allows for filtering out noise without needing to specify the trend's shape beforehand.
For structural analysis, the package includes several change point tests. These tests require parameters defining the significance level and the bootstrap method used to derive critical values, as seen in the configuration for the polynomial regression-based test.
Key Insights and Features
- Synchronicity vs. Correlation:
funtimesfocuses on underlying trend dynamics, recognizing that two series can be correlated without being synchronized in their long-term trends. - Automated Window Selection: For tests like WAVK, the package includes a heuristic "m-out-of-n" subsampling algorithm to automatically select optimal local window sizes, reducing user bias.
- Predictive Causality: Out-of-sample Granger causality tests move beyond simple in-sample fit, providing a more rigorous check of whether one variable actually helps predict another in real-world forecasting scenarios.
Results and Applications
The package documentation showcases practical successes across various datasets, including US terrorism incidents and macroeconomic data. For instance, the package correctly identifies structural shifts in terrorism data corresponding to the year 2001. The output of these tests typically includes the estimated change point index, the test statistic, and the associated p-value.
Furthermore, the sync_cluster function effectively groups series with shared linear trends while isolating noise series. The bootstrap-based WAVK test maintains a stable Type I error rate even under strong autocorrelation, where traditional t-tests typically fail.
Limitations and Conclusion
While powerful, the package's reliance on bootstrapping (often 1,000+ iterations) can be computationally expensive for large datasets. To mitigate this, the authors have included support for parallel processing. Additionally, several core functions do not support missing values (NAs), requiring users to perform data cleaning beforehand. Despite these constraints, funtimes provides a critical toolkit for researchers dealing with the complexities of modern temporal data.
Summary updated