Add n
anomalies to an existing vector.
Usage
add_anomaly(x, n, score_window, spec_window, var_cap_rng = 5:15)
Arguments
- x
Numeric vector.
- n
Integer value for number of anomalies to apply.
- score_window
Integer value for the window width for scoring.
- spec_window
Positive integer value for the window to calculate the averaged log spectrum.
- var_cap_rng
A range of values to cap variances.
Details
Method to calculate is:
$$x + (\bar{x} + mean)(1+var)(\mathcal{N}(0,1))$$
Will exclude the first point to ensure variance
calculation has a useful value.