Description Usage Arguments Value Examples
Outputs the residuals (values of the compensator at the times of arrival) of a Hawkes process. Useful function for diagnosis through the random time change theorem: the residuals should follow a unit rate Poisson process.
1 |
x |
A non-negative numeric vector, sorted in ascending order; or an object of class "hawkes" output by function |
fun |
(default = TRUE) A non-negative numeric function or value - intensity (function) of the immigrant process. |
repr |
(default = NULL) A non-negative numeric value - mean number of offsprings. |
family |
(default = NULL) A character string "name" naming a distribution with corresponding distribution function |
M |
(default = NULL) A non-negative numeric value - upper bound on |
... |
Additional arguments passed on to the random generation function |
The residuals of the process.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | # Simulate an exponential Hawkes process with baseline intensity 1,
# reproduction mean 0.5 and exponential fertility distribution with rate 2.
x <- hawkes(10, fun=1, repr=0.5, family="exp", rate=2)
resid = residuals(x)
resid
plot(resid)
abline(0, 1, col="red", lty="dashed")
# Residuals with a different set of parameters
residuals(x, repr=0.8, rate=3)
# Residuals with a different distribution function
residuals(x, family="chisq", df=2)
# Simulate a Hawkes process with baseline intensity function 1 + sin(x),
# reproduction mean 0.5 and custom [0,1]-triangular fertility function.
x <- hawkes(10, fun=function(y) {1+sin(y)}, M=2, repr=0.5,
family=function(n) {1 - sqrt(1 - runif(n))})
resid = residuals(x, family=function(y) ifelse(y>0 & y<1, 2-2*y, 0))
plot(resid)
abline(0, 1, col="red", lty="dashed")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.