pyeeg.models.fit_ar

pyeeg.models.fit_ar(x, nlags=1, time_axis=0)

Fit an autoregressive model to a time series. This is a helper function for autoregressive models estimation.

If fed with a multidimensional time series, it will fit a model for each dimension.

Parameters:
  • x (ndarray (nsamples, nchans) or (nsamples, )) – Time series to fit.

  • nlags (int) – Number of lags to use in the model (model order).

  • time_axis (int) – Axis of the time series.

Returns:

betas – Coefficients of the autoregressive model.

Return type:

ndarray (nchans, nlags)