pyhctsa.operations.model_fit.local_simple

pyhctsa.operations.model_fit.local_simple(y, forecast_meth='mean', train_length=3)

Simple local time-series forecasting.

Simple predictors using the past train_length values of the time series to predict its next value. The residuals (prediction minus data) are summarized with the 'core' level of residual_analysis(), plus the Gaussianity of their distribution. The first train_length values are used for training only and are not forecast.

Parameters:
y : array-like

The input time series.

forecast_meth : str, optional

The forecasting method:

  • ’mean’: local mean prediction using the past train_length time-series values

  • ’median’: local median prediction using the past train_length time-series values

  • ’lfit’: local linear prediction using the past train_length time-series values

Default is 'mean'.

train_length : int or str, optional

The number of time-series values to use to forecast the next value, or a string that sets it from the series: ‘ac’ (the first zero crossing of the autocorrelation function of y, discrete), ‘ac1e’ (the floor of its first 1/e crossing) or ‘mi’ (the smaller of the first minimum of the Kraskov automutual information and the ‘ac1e’ delay), as in pyhctsa.utils.get_tau(). For ‘lfit’ with ‘ac’, ‘ac1e’ or ‘mi’, the window is at least 2 (a straight line needs two points). Default is 3.

Returns:

The 11 'core' residual statistics (meane, meanabs, stde, maxonstd, ac1, ac2, ac3, propbth, taurat, sws, swm) and normr2, the R-squared of a Gaussian fit to the kernel-smoothed distribution of the residuals. NaN if the series is too short to forecast or the window cannot be set.

Return type:

dict