pysteps.timeseries.autoregression.estimate_var_params_ols(x, p, d=0, check_stationarity=True, include_constant_term=False, h=0, lam=0.0)#

Estimate the parameters of a vector autoregressive VAR(p) model

\(\mathbf{x}_{k+1}=\mathbf{c}+\mathbf{\Phi}_1\mathbf{x}_k+ \mathbf{\Phi}_2\mathbf{x}_{k-1}+\dots+\mathbf{\Phi}_p\mathbf{x}_{k-p}+ \mathbf{\Phi}_{p+1}\mathbf{\epsilon}\)

by using ordinary least squares (OLS). If \(d\geq 1\), the parameters are estimated for a d times differenced time series that is integrated back to the original one by summation of the differences.

  • x (array_like) – Array of shape (n, q, :) containing a time series of length n=p+d+h+1 with q-dimensional variables. The remaining dimensions are flattened. The remaining dimensions starting from the third one represent the samples.

  • p (int) – The order of the model.

  • d ({0,1}) – The order of differencing to apply to the time series.

  • check_stationarity (bool) – If True, the stationarity of the resulting VAR(p) process is tested. An exception is thrown if the process is not stationary.

  • include_constant_term (bool) – Include the constant term \(\mathbf{c}\) to the model.

  • h (int) – If h>0, the fitting is done by using a history of length h in addition to the minimal required number of time steps n=p+d+1.

  • lam (float) – If lam>0, the regression is regularized by adding a penalty term (i.e. ridge regression).


out – The estimated parameter matrices \(\mathbf{\Phi}_1,\mathbf{\Phi}_2, \dots,\mathbf{\Phi}_{p+1}\). If include_constant_term is True, the constant term \(\mathbf{c}\) is added to the beginning of the list.

Return type:



Estimation of the innovation parameter \(\mathbf{\Phi}_{p+1}\) is not currently implemented, and it is set to a zero matrix.