forecast_errors#

pypillometry.signal.gaussmarkov.forecast_errors(model, y, horizons, step=1, mask=None, obs_var=None, segments=None)[source]#

Errors of forecasts several samples ahead.

From the filtered state at every step-th sample (given the data up to that sample), the model predicts the observations horizons samples later. The errors measure the accuracy of the forecasts; the errors divided by their predicted standard deviation should have variance 1 if the model describes the dependence over that horizon (below 1: the model expects more variability than there is).

Parameters:
  • model (LGSSM) – needs independent noise of the channels (a diagonal R)

  • y (array, (T,) or (T, m)) – observations; NaN, inf and masked values are missing

  • horizons (sequence of int) – how many samples ahead to predict (positive)

  • step (int, optional) – forecasts are made from every step-th sample (default 1)

  • mask – see kalman_filter(); forecasts do not cross the border of a segment

  • obs_var – see kalman_filter(); forecasts do not cross the border of a segment

  • segments – see kalman_filter(); forecasts do not cross the border of a segment

Return type:

tuple[ndarray, ndarray]

Returns:

  • err (np.ndarray, (n_origins, n_horizons, m)) – forecast errors (NaN where the origin or the target is missing)

  • std_err (np.ndarray, (n_origins, n_horizons, m)) – errors divided by their predicted standard deviation