pysteps.timeseries.autoregression.estimate_ar_params_ols_localized(x, p, window_radius, d=0, include_constant_term=False, h=0, lam=0.0, window='gaussian')#

Estimate the parameters of a localized AR(p) model


by using ordinary least squares (OLS), where \(i\) denote spatial coordinates with arbitrary dimension. 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,…) 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.

  • window_radius (float) – Radius of the moving window. If window is ‘gaussian’, window_radius is the standard deviation of the Gaussian filter. If window is ‘uniform’, the size of the window is 2*window_radius+1.

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

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

  • window ({"gaussian", "uniform"}) – The weight function to use for the moving window. Applicable if window_radius < np.inf. Defaults to ‘gaussian’.


out – List of length p+1 containing the AR(p) parameter fields for for the lag-p terms and the innovation term. The parameter fields have the same shape as the elements of gamma. Nan values are assigned, where the sample size for estimating the parameters is too small. If include_constant_term is True, the constant term \(c_i\) is added to the beginning of the list.

Return type



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