From a76d8ae7240715fb43af4057f82c5a4c5bf141ee Mon Sep 17 00:00:00 2001 From: Iskander Gaba Date: Fri, 25 Oct 2024 20:48:39 +0200 Subject: [PATCH] Expand the example page --- docs/example.rst | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/docs/example.rst b/docs/example.rst index 2f55be1..227e182 100644 --- a/docs/example.rst +++ b/docs/example.rst @@ -1,7 +1,6 @@ Example ------- - -Start by loading Mauna Loa Weekly Atmospheric CO2 Data from `statsmodels `__ +For this example, start by loading Mauna Loa Weekly Atmospheric CO2 Data from `statsmodels `__ and downsampling its data to a monthly frequency. .. code:: python @@ -22,7 +21,25 @@ Use ``Autoperiod`` to find the list of periods based in this data (if any). The detected periodicity length is 12 which suggests a strong yearly seasonality given that the data has a monthly frequency. +To confirm this, we run the ``Autoperiod`` again on the same data resampled to a weekly and daily frequencies. + +.. code:: python + + >>> data = co2.load().data + >>> data = data.resample("W").mean().ffill() + >>> autoperiod = Autoperiod(data) + >>> autoperiod.fit() + array([52]) + >>> data = co2.load().data + >>> data = data.resample("D").mean().ffill() + >>> autoperiod = Autoperiod(data) + >>> autoperiod.fit() + array([364]) + +As expected, the detected period lengths for weekly and daily frequencies are 52 and 364, respectively, +which confirms the strong yearly seasonality of the data. + You can use other estimation algorithms like ``CFDAutoperiod`` variant of ``Autoperiod``, ``ACFPeriodicityDetector``, or ``FFTPeriodicityDetector`` and compare results and performance. -All estimation algorithms can be used in the same manner as in the example above with different -optional parameters. Check the :doc:`api` for more details. +All the supported estimation algorithms can be used in the same manner as in the example above +with different optional parameters. Check the :doc:`api` for more details.