Fit a Hawkes (self-exciting point process) model by maximum likelihood
Source:R/hawkes_fit.R
morie_hawkes_fit.RdFits a one-dimensional Hawkes process with a constant baseline to a
vector of event times. The conditional intensity is
$$lambda(t) = nu + eta * sum_{t_j < t} g(t - t_j),$$
where nu = exp(a0) is the baseline rate, eta the
branching ratio, and g the chosen triggering kernel.
Usage
morie_hawkes_fit(
times,
end_time = NULL,
kernel = c("exponential", "weibull", "lomax", "gamma")
)Value
An object of class morie_hawkes_fit: a list with the
parameter estimate, loglik, aic,
branching_ratio, baseline_rate, n_events,
converged and the backend used.
Details
The negative log-likelihood is evaluated by the shared morie C++ core (the same kernels the Python package uses); without a compiled core it falls back to a pure-R \(O(n^2)\) likelihood.
Examples
set.seed(1)
ev <- cumsum(rexp(200, rate = 2))
fit <- morie_hawkes_fit(ev, kernel = "exponential")
print(fit)
#> morie Hawkes fit -- exponential kernel, constant baseline
#> events: 200 horizon: 100 backend: cpp
#> estimate:
#> a0 0.693163
#> eta 1.02736e-06
#> beta 0.0500644
#> baseline rate nu : 2.00003
#> branching ratio : 1.02736e-06
#> logLik: -61.3674 AIC: 128.735 converged: TRUE
#> vs Poisson: logLik -61.3674 (gain -8.165e-08)
#> NOTE: eta collapsed to ~0: data consistent with a homogeneous Poisson process; kernel-shape parameters are NOT identified