qis.compute_roll_mean

qis.compute_roll_mean(data, mean_adj_type=MeanAdjType.EWMA, span=None, ewm_lambda=0.94, init_value=None, nan_backfill=NanBackfill.FFILL)[source]

mean path of each column under a mean-adjustment convention, same shape as the input.

Parameters:
  • data (DataFrame | Series | ndarray) – observations, time along the first axis

  • mean_adj_type (MeanAdjType) – NONE gives zeros; INSAMPLE the full-sample mean of each column, ignoring missing values and repeated on every row, which is forward-looking and belongs in descriptive exhibits, never inside a backtest; EXPANDING the expanding mean up to each row; EWMA the EWM mean, point in time

  • span (float | ndarray) – EWMA span; overrides ewm_lambda

  • ewm_lambda (float | ndarray) – EWMA decay

  • init_value (float | ndarray) – EWMA seed; the first observation when None

  • nan_backfill (NanBackfill) – EWMA missing-observation policy

Returns:

the mean path, same container and shape as data

Raises:

TypeError – for an unsupported container or mean_adj_type

Return type:

DataFrame | Series | ndarray