pyhctsa.operations.model_fit.loop_local_simple

pyhctsa.operations.model_fit.loop_local_simple(y, forecast_meth='mean')

How simple local forecasting depends on window length.

Analyzes the outputs of local_simple for a range of local window lengths, l. Loops over the length of the data to use for local_simple prediction.

Parameters:
y : array-like

The input time series.

forecast_meth : str, optional

The prediction method:

  • ’mean’: local mean prediction, with window lengths 1, 2, …, 10

  • ’median’: local median prediction, with window lengths 1, 3, …, 19

Default is 'mean'.

Returns:

Dictionary containing statistics about how forecasting performance varies with window length: for each of the residual standard deviation (stde), sws, swm, ac1 and ac2, the normalized mean change (_chn), the mean sign of the changes (_meansgndiff) and, for the last four, _stdn; sws_fexp_b (the rate of an exponential fit a*exp(b*l) + c to the sws curve: negative for a decay with training length), sws_fexp_r2 (between 0 and 1), sws_fexp_adjr2 and sws_fexp_rmse of that fit. The fit is the global least-squares optimum over b, with a and c found by linear least squares (pyhctsa.robust.bf_exp_fit()); a and c are not output because they are poorly determined when the curve is close to a straight line. The four sws_fexp_* outputs are NaN if the sws curve is constant. stde_minpos is the window length that forecasts best: the 1-based position, in the list of window lengths, of the smallest residual standard deviation (the first, if tied). It is 1 when the last value is the best predictor of the next (e.g. a random walk), the last position when a long average is (e.g. white noise), and in between for a smooth signal in noise. stde_minsize is that smallest residual standard deviation divided by the mean over window lengths (at most 1; near 1 if the window length makes little difference). Both are NaN if the series is too short for the longest window.

Return type:

dict