pyeeg.models.fit_var

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

Fit a VAR model to a time series.

Instead of fitting k independent models as in fit_ar, this function fits a single model but with multivariate regressors.

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)