whittle: Fitting Hawkes processes from discrete data

Description Usage Arguments Details Value See Also Examples

View source: R/whittle.R

Description

This function fits a Hawkes process to discrete data by minimizing the Whittle contrast.

Usage

1
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 kern is a string, or uses the member binsize of kern if it is of class Model

trunc

(Optional) The number of foldings taken into account due to aliasing

init

(Optional) Initial values of the optimisation algorithm

...

Additional arguments passed to optim

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

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

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