mesmer.stats.lowess#
- mesmer.stats.lowess(data, dim, *, combine_dim=None, n_steps=None, frac=None, use_coords=True, it=0)#
LOWESS (Locally Weighted Scatterplot Smoothing) for xarray objects
- Parameters:
data (xr.DataArray | xr.Dataset) – Data to smooth (y-values).
dim (str) – Dimension along which to smooth (x-dimension)
combine_dim (str, default: None) – Dimension along which to pool the data. This will stack the data and estimate the smoothing on the stacked data.
n_steps (int) – The number of data points used to estimate each y-value, must be between 0 and the length of dim. If given used to calculate
frac
. Exactly one ofn_steps
andfrac
must be given.frac (float) – The fraction of the data used when estimating each y-value. Between 0 and 1. Exactly one of
n_steps
andfrac
must be given.use_coords (boolean, default: True) – If True uses
data[dim]
as x-values else usesnp.arange(data[dim].size)
(useful ifdim
are time coordinates).it (int, default: 0) – The number of residual-based re-weightings to perform.
- Returns:
out (xr.DataArray | xr.Dataset) – LOWESS smoothed array
See also
statsmodels.nonparametric.smoothers_lowess.lowess
Notes
For
it=0
, the following three options are equivalent:mesmer.stats.lowess(data.mean("cells"), "time", frac=0.3) mesmer.stats.lowess(data, "time", combine_dim="cells", frac=0.3) mesmer.stats.lowess(data, "time", frac=0.3).mean("cells")