plot.hawkes: Plot of a Hawkes process

Description Usage Arguments Value Examples

View source: R/hawkes.R

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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
## 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 hawkes.

intensity

(default = FALSE) A boolean - whether to represent the cluster representation (FALSE) or the intensity function (TRUE).

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 dname, or directly the distribution function.

M

(default = NULL) A non-negative numeric value - upper bound on fun(ignored if fun is a numeric value).

...

Additional arguments passed on to the random generation function dname.

Value

None

Examples

1
2
3
4
5
6
7
8
9
# 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))

hawkesbow documentation built on April 10, 2021, 1:07 a.m.