Skip to contents

Computes surprise using a rolling window of observations.

Usage

surprise_rolling(
  observed,
  expected = NULL,
  window_size = 10,
  step = 1,
  models = c("uniform", "baserate", "funnel"),
  ...
)

Arguments

observed

Numeric vector of observed values (time-ordered)

expected

Numeric vector of expected values

window_size

Number of observations in the window

step

Step size for moving the window

models

Model specification

...

Additional arguments passed to compute_surprise()

Value

A list with surprise values for each window position