# pysteps.timeseries.autoregression.estimate_ar_params_ols#

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

Estimate the parameters of an autoregressive AR(p) model

$$x_{k+1}=c+\phi_1 x_k+\phi_2 x_{k-1}+\dots+\phi_p x_{k-p}+\phi_{p+1}\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.

Parameters
• x (array_like) – Array of shape (n,…) containing a time series of length n=p+d+h+1. The remaining dimensions are flattened. The rows and columns of x represent time steps and samples, respectively.

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

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

• check_stationarity (bool) – Check the stationarity of the estimated model.

• include_constant_term (bool) – Include the constant term $$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).

Returns

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 $$c$$ is added to the beginning of the list.

Return type

list

Notes

Estimation of the innovation term parameter $$\phi_{p+1}$$ is currently implemented for p<=2. If p > 2, $$\phi_{p+1}$$ is set to zero.