pyhctsa.operations.model_fit.fit_subsegments¶
-
pyhctsa.operations.model_fit.fit_subsegments(y, model=
'ar', order=2, subset_how='uniform', sample_p=[20, 0.1])¶ Robustness of model parameters across different segments of a time series.
The spread of parameters obtained (including in-sample goodness of fit statistics) provides some indication of stationarity. Values of goodness of fit provide some indication of model suitability.
- Parameters:¶
- y : array-like¶
The input time series.
- model : str, optional¶
The model to fit in each segment of the time series:
’ar’: fits an AR model of a specified order. Outputs are how the fitted AR parameters vary across the different segments of time series.
’arma’: Not yet implemented.
’ss’: Not yet implemented.
- order : int, optional¶
The order of the model to fit (used for ‘ar’, ‘ss’, or ‘arma’ models).
- subset_how : str, optional¶
- How to choose segments from the time series, either:
’uniform’ (uniformly)
’rand’ (at random) [not implemented].
- sample_p : list or tuple, optional¶
A two-vector specifying how many segments to take and of what length. Of the form [n_samples, length], where length can be a proportion of the time-series length. For example, [20, 0.1] takes 20 segments of 10% the time-series length.
- Returns:¶
Dictionary of statistics on the spread and mean of fitted model parameters and goodness of fit across segments.
- Return type:¶
dict