pyActigraphy.analysis.Fractal.dfa

classmethod Fractal.dfa(ts, n_array, deg=1, overlap=False, exclude_segment_with_nans=False, nan_frac=0, log=False)[source]

Detrended Fluctuation Analysis function

Compute the q-th order mean squared fluctuations for different segment lengths.

Parameters:
  • ts (pandas.Series) – Input signal.

  • n_array (array of int) – Time scales (i.e window sizes). In minutes.

  • deg (int, optional) – Degree(s) of the fitting polynomials. Default is 1.

  • overlap (bool, optional) – If set to True, consecutive windows during segmentation overlap by 50%. Default is False.

  • exclude_segment_with_nans (bool, optional) – If set to True, segments containing a NaN fraction equal or greater than nan_frac are excluded. Default is False.

  • nan_frac (float, optional) – Threshold on the maximal fraction of NaN in the returned segments. Default is 0.

  • log (bool, optional) – If set to True, returned values are log-transformed. Default is False.

Returns:

q_th_order_msq_fluc – Array of q-th order mean squared fluctuations.

Return type:

numpy.array