-
Notifications
You must be signed in to change notification settings - Fork 0
/
README.rmd
80 lines (48 loc) · 1.92 KB
/
README.rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
```{r setup, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>"
)
```
# FOCuS
FOCuS, acronym for Functional Online CuSum, is an algorithm for detecting changes in mean in real-time. This is achieved by a recursive update of a piecewise quadratic, whose maximum is the CUSUM test statistic for a change. FOCuS can be applied to settings where either the pre-change mean is known or unknown. Furthermore, FOCuS can detect changes in presence of point outliers.
## Installation and Requirements
### Installing the package
To install the package from Github:
```{r gitInstall, eval=FALSE}
devtools::install_github("gtromano/FOCuS")
library(FOCuS)
```
Alternatively one could clone this repository, and run:
```{r offlineInstall, eval=FALSE}
install.packages("./FOCuS", repos = NULL, type = "source")
library(FOCuS)
```
### Requirements for the installation
The packages requires `Rcpp (>= 1.0.5)` with compiler support for the `std` library with the `g++14` standard.
### Bugs and further queries
If any bug should be spotted, feel free to open an issue on this repo. For any information regarding this package, please email the package mantainer: `g` dot `romano` at `lancaster.ac.uk`.
## Usage and examples
After installing, it should be possible to access the full documentation with:
```{r doc, eval=FALSE}
help(FOCuS)
```
### Running FOCuS
FOCuS can run in offline mode (for testing purposes) via:
```{r offline}
set.seed(42)
y <- c(rnorm(3e5, 1), rnorm(1e4, 0))
res <- FOCuS(y, 18)
```
Once happy with the parameters, one can run FOCuS online via a call to a data-generating function. This data generating function is expected to return one observation, pulled from the process of interest.
For example:
```{r online}
set.seed(42)
databuffer <- c(rnorm(3e5, 1), rnorm(1e4, 0))
f <- function() {
out <- databuffer[i] # simulating a pull from a buffer
i <<- i + 1
out
}
i <- 1; res <- FOCuS(f, 18)
```