loess#

swordfish.function.loess()#

Resample X based on the specified resampleRule, closed and origin. Implement Local Regression Algorithm (Loess) for interpolation on Y based on the resampled X.

If outputX is unspecified, return a vector of Y after the interpolation.

If outputX=true, return a tuple where the first element is the vector of resampled X and the second element is a vector of Y after the interpolation.

Parameters:
  • X (Constant) – A strictly increasing vector of temporal type.

  • Y (Constant) – A numeric vector of the same length as X.

  • resampleRule (Constant) – A string. See the parameter rule of function resample for the optional values.

  • closed (Constant, optional) –

    A string indicating which boundary of the interval is closed. The default value is ‘left’ for all values of rule except for ‘M’, ‘A’, ‘Q’, ‘BM’, ‘BA’, ‘BQ’, and ‘W’ which all have a default of ‘right’.

    The default is ‘right’ if origin is ‘end’ or ‘end_day’.

  • origin (Constant, optional) –

    A string or a scalar of the same data type as X, indicating the timestamp where the intervals start. It can be ‘epoch’, start’, ‘start_day’, ‘end’, ‘end_day’ or a user-defined time object. The default value is ‘start_day’.

    • ’epoch’: origin is 1970-01-01

    • ’start’: origin is the first value of the timeseries

    • ’start_day’: origin is 00:00 of the first day of the timeseries

    • ’end’: origin is the last value of the timeseries

    • ’end_day’: origin is 24:00 of the last day of the timeseries

  • outputX (Constant) – A Boolean value indicating whether to output the resampled X. The default value is false.

  • bandwidth (Constant) – A numeric scalar in (0,1]. when computing the loess fit at a particular point, this fraction of source points closest to the current point is taken into account for computing a least-squares regression.

  • robustnessIter (Constant) – A postive interger indicating how many robustness iterations are done.

  • accuracy (Constant) – A number greater than 1. If the median residual at a certain robustness iteration is less than this amount, no more iterations are done.