Cost functions for the univariate Poission distribution
Details
Collective anomalies are represented as multiplicative changes in rate
Methods
Get the length of time series
Method new()
Initialise the cost function
Arguments
x
numeric vector of observations
rate
numeric vector of rate parameters
Method baseCost()
Compute the non-anomalous cost of a segment
Usage
poisCost$baseCost(a, b, pen = 0)
Arguments
a
start of period
b
end of period
pen
penalty cost
Method pointCost()
Compute the point anomaly cost of a time step
Usage
poisCost$pointCost(b, pen)
Arguments
b
time step
pen
penalty cost
Method collectiveCost()
Compute the anomalous cost of a segment
Usage
poisCost$collectiveCost(a, b, pen, len)
Arguments
a
start of period
b
end of period
pen
penalty cost
len
minimum number of observations
Compute parameters of a segment if anomalous
Arguments
a
start of period
b
end of period
Method clone()
The objects of this class are cloneable with this method.
Usage
poisCost$clone(deep = FALSE)
Arguments
deep
Whether to make a deep clone.
Examples
set.seed(0)
r <- 8 + runif(100)*2
x <- rpois(100,lambda = r)
p <- poisCost$new(x,r)
p$baseCost(90,95) ## cost of non-anomalous distribution for x[90:95]
#> rate
#> 29.90849
p$pointCost(90,0) ## point anomaly cost for x[90] with 0 penalty
#> x
#> 4.415644
## collective anomaly cost for x[90:95] with penalty of 57 and at least 3 observation
p$collectiveCost(90,95,57,3)
#> rate
#> 86.33279