whittle {hawkesbow} | R Documentation |
Fitting Hawkes processes from discrete data
Description
This function fits a Hawkes process to discrete data by minimizing the Whittle contrast.
Usage
whittle(counts, kern, binsize = NULL, trunc = 5L, init = NULL, ...)
Arguments
counts |
A bin-count sequence |
kern |
Either a string (partially) matching one of the kernels implemented (see Details), or an object of class Model |
binsize |
(Optional) The bin size of the bin-count sequence; if omitted, defaults to 1 if |
trunc |
(Optional) The number of foldings taken into account due to aliasing |
init |
(Optional) Initial values of the optimisation algorithm |
... |
Additional arguments passed to |
Details
If specified as string, the argument kern
must match (partially) one of the following
(upper cases not taken into account): Exponential, SymmetricExponential,
Gaussian, PowerLaw, Pareto3, Pareto2, Pareto1.
The periodogram used in the optimisation procedure is computed in complexity
O(n \log n)
, using function fft
.
Value
Returns a list containing the solution of the optimisation procedure, the object Model
with its parameters updated to the solution, and the output produced by optim
.
See Also
hawkes()
for the simulation of Hawkes processes,
discrete()
for the discretisation of simulated Hawkes processes,
Model for the abstract class, and Exponential for the specific
reproduction kernels.
Examples
# Simulate and fit a Hawkes process with exponential kernel
x = hawkes(1000, fun = 1, repr = .5, family = "exp", rate = 1)
y = discrete(x, binsize = 1)
opt = whittle(y, "Exponential")
opt$par # Estimated parameters
# May take up to 20 seconds
# Simulate and fit a Hawkes process with power law kernel
x = hawkes(1000, fun = 1, repr= .3, family = "powerlaw", shape = 3.5, scale = 1.0)
y = discrete(x, binsize = 1)
opt = whittle(y, "powerlaw")
opt$par # Estimated parameters