Flags \(|x_i - \mu|/\sigma > k\). Both the centre and the scale come from the series being screened, so a large outlier inflates sigma and masks itself – this is a screen, not a test.
Examples
ZscoreA(c(1, 2, 3, 4, 50), 2)
#> $estimate
#> [1] 0
#>
#> $z
#> [1] 0.5171105 0.4701005 0.4230904 0.3760804 1.7863819
#>
#> $flags
#> [1] FALSE FALSE FALSE FALSE FALSE
#>
#> $indices
#> integer(0)
#>
#> $mean
#> [1] 12
#>
#> $sd
#> [1] 21.27205
#>
#> $k
#> [1] 2
#>
#> $n
#> [1] 5
#>
#> $method
#> [1] "z-score anomaly flagging"
#>
