Fits a state space model by treating a known set of outliers as missing data. This benchmark model assumes prior knowledge of outlier locations and is intended for comparison with automatic outlier detection procedures.
Usage
oracle_SSM(
y,
init_par,
build,
outlier_locs,
lower = NA,
upper = NA,
control = list(parscale = init_par)
)Arguments
- y
A numeric matrix of observations (time points in rows).
- init_par
A numeric vector of initial parameter values.
- build
A function that returns a
dlmmodel given a parameter vector. Thespecify_SSM()function can be used to create thisbuildfunction.- outlier_locs
An integer or logical vector of length equal to the number of time points, indicating locations of known outliers.
- lower
Optional numeric vector of lower bounds for parameter estimation. Defaults to
-Inf. Must be of same length asinit_par.- upper
Optional numeric vector of upper bounds for parameter estimation. Defaults to
Inf. Must be of same length asinit_par.- control
Optional list of control parameters passed to
optimviadlm::dlmMLE(). Default islist(parscale = init_par), which can help the optimizer if parameters are on vastly different scales.
Value
An object of class oracle_SSM containing the optimization result, the provided outlier locations, the original data, and the original build function.
