Description Usage Arguments Value Notes on default hyper-parameters References See Also Examples
Implements the BARD (Bayesian Abnormal Region Detector) procedure of Bardwell and Fearnhead (2017). BARD is a fully Bayesian inference procedure which is able to give measures of uncertainty about the number and location of anomalous regions. It uses negative binomial prior distributions on the lengths of anomalous and non-anomalous regions as well as a uniform prior for the means of anomalous regions. Inference is conducted by solving a set of recursions. To reduce computational and storage costs a resampling step is included.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
x |
An n x p real matrix representing n observations of p variates. The time series data classes ts, xts, and zoo are also supported. |
p_N |
Hyper-parameter of the negative binomial distribution for the length of non-anomalous segments (probability of success). Defaults to \frac{1}{n+1}. |
p_A |
Hyper-parameter of the negative binomial distribution for the length of anomalous segments (probability of success). Defaults to \frac{5}{n}. |
k_N |
Hyper-parameter of the negative binomial distribution for the length of non-anomalous segments (size). Defaults to 1. |
k_A |
Hyper-parameter of the negative binomial distribution for the length of anomalous segments (size). Defaults to \frac{5p_A}{1- p_A}. |
pi_N |
Probability that an anomalous segment is followed by a non-anomalous segment. Defaults to 0.9. |
paffected |
Proportion of the variates believed to be affected by any given anomalous segment. Defaults to 5%. This parameter is relatively robust to being mis-specified and is studied empirically in Section 5.1 of \insertCitebardwell2017;textualanomaly. |
lower |
The lower limit of the the prior uniform distribution for the mean of an anomalous segment μ. Defaults to 2√{\frac{\log(n)}{n}}. |
upper |
The upper limit of the prior uniform distribution for the mean of an anomalous segment μ.
Defaults to the largest standardised value of x, i.e. |
alpha |
Threshold used to control the resampling in the approximation of the posterior distribution at each time step. A sensible default is 1e-4. Decreasing alpha increases the accuracy of the posterior distribution but also increases the computational complexity of the algorithm. |
h |
The step size in the numerical integration used to find the marginal likelihood.
The quadrature points are located from |
transform |
A function used to transform the data prior to analysis. The default value is to scale the data using the median and the median absolute deviation. |
An instance of the S4 object of type .bard.class
containing the data x
, procedure parameter values, and the results.
This function gives certain default hyper-parameters for the two segment length distributions. We chose these to be quite flexible for a range of problems. For non-anomalous segments a geometric distribution was selected having an average segment length of n with the standard deviation being of the same order. For anomalous segments we chose parameters that gave an average length of 5 and a variance of n. These may not be suitable for all problems and the user is encouraged to tune these parameters.
bardwell2017anomaly
1 2 3 4 5 6 7 8 9 10 |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.