emhawkes

emhawkes specifies, simulates, and fits exponential Hawkes models, including marked, state-dependent, and multi-kernel models.

Installation

Install the CRAN release:

install.packages("emhawkes")

For the development version and the features described in the guides:

# install.packages("remotes")
remotes::install_github("ksublee/emhawkes")

Source installation requires a C++ compiler and Rcpp; on Windows, install Rtools.

Quick start

This example requires version 1.0.0 or later.

library(emhawkes)

h <- new("hspec", mu = 0.3, alpha = 1.2, beta = 1.5)
set.seed(1107)
path <- hsim(h, size = 1000)
fit <- hfit(h, inter_arrival = path$inter_arrival, optimizer = "stats")
summary(fit)

hsim() returns an hreal path. The example uses R’s optimizers and returns an emhawkes_stats_fit. By default, hfit() uses the optional maxLik package and returns a maxLik fit; install it with install.packages("maxLik") to use that provider. The first path row is the initial state, so size includes that row.

Simulation and fitting default to lambda_component0 = "auto" and report the selected initialization. Supported stable constant linear models use mean intensity components; other models use zero components and recommend supplying an initial state. These components exclude the baseline intensity.

Documentation

The basic vignette is also available in R with vignette("example", package = "emhawkes"). The website is built from this repository; the version in its header identifies the documented package.