mesmer.stats.fit_auto_regression_scen_ens#
- mesmer.stats.fit_auto_regression_scen_ens(*objs, dim, ens_dim, lags)#
fit an auto regression and potentially calculate the mean over ensemble members and scenarios
- Parameters:
obj (DataTree, xr.DataArrays or dict of DataArrays) – A
DataTree
holding one or severalxr.Dataset
,xr.DataArray``s, or dict of ``xr.DataArray``s to estimate the auto regression order over, each representing one scenario, potentially with several ensemble members along `ens_dim`. If a ``DataTree
, eachxr.Dataset
should only hold one variable, the one for which to estimate the autoregression.dim (str) – Dimension along which to fit the auto regression (often time).
ens_dim (str) – Dimension name of the ensemble members, None if no ensemble is provided. Must be the same for all scenarios and have coordinates if not None.
lags (int) – The number of lags to include in the model.
- Returns:
xr.Dataset
– Dataset containing the estimated parameters of theintercept
, the ARcoeffs
and thevariance
of the residuals.
Notes
If ens_dim is not None, calculates the mean auto regression first over all ensemble members and then over scenarios. This is done to weight scenarios equally, consequently ensemble members are not weighted equally, if the number of members differs between scenarios. If no ensemble members are provided, the mean is calculated over scenarios only.