plot.hawkes {hawkesbow} | R Documentation |
Plot of a Hawkes process
Description
Plots the realisation of a Hawkes process and either its cluster representation (intensity=FALSE
, only available for a simulated Hawkes process) or its intensity function (intensity=TRUE
).
Usage
## S3 method for class 'hawkes'
plot(
x,
intensity = FALSE,
precision = 1000,
fun = NULL,
repr = NULL,
family = NULL,
M = NULL,
...
)
Arguments
x |
Either: a numeric vector, sorted in ascending order; or an object of class "hawkes" output by function |
intensity |
(default = FALSE) A boolean - whether to represent the cluster representation ( |
precision |
(default = 1e3) Number of points to plot. |
fun |
(default = NULL) A numeric function - 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 |
Value
None
Examples
# Simulate an exponential Hawkes process with baseline intensity 1,
# reproduction mean 0.5 and exponential fertility function with rate 2.
x <- hawkes(10, fun=1, repr=0.5, family="exp", rate=2)
plot(x)
# 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))})
plot(x, intensity=TRUE, family=function(y) ifelse(y>0 & y<1, 2-2*y, 0))