Fit a single (kernel, baseline) Hawkes specification
Source:R/tps_hawkes_advanced.R
morie_tps_hawkes_advanced_fit.RdCompanion to the Markovian exponential / constant fit in
morie_tps_hawkes_temporal_fit. Supports the four kernels
(exponential, gamma, Weibull, Lomax) and two baselines (constant,
sinusoidal) of Kwan-Chen-Dunsmuir (2024).
Usage
morie_tps_hawkes_advanced_fit(
df,
kernel = "gamma",
baseline = "sinusoidal",
ds_name = "?",
max_n = 5000L
)Arguments
- df
A data frame with an
OCC_DATEorREPORT_DATEcolumn.- kernel
Excitation kernel: one of
"exponential","gamma","weibull","lomax".- baseline
Baseline kind:
"constant"or"sinusoidal".- ds_name
Dataset name used in titles and warnings.
- max_n
Maximum number of events to retain (for tractable O(n^2) MLE on the non-Markovian path).
Value
A morie_rich_result with branching ratio,
stationarity verdict, kernel and baseline parameters,
negative log-likelihood, AIC, BIC, and time-rescaling KS
statistic.
Details
If the optional packages hawkes or emhawkes are available the (exponential, constant) special case can delegate to their compiled likelihood routines; the non-Markovian kernels always use the base-R O(n^2) negative log-likelihood with L-BFGS-B optimisation under explicit box constraints.
Goodness-of-fit is reported via time-rescaling residuals (Brown et al. 2002) and a Kolmogorov-Smirnov test against Uniform(0, 1).
References
Kwan TKJ, Chen F, Dunsmuir WTM (2024). Likelihood inference for non-stationary Hawkes processes. arXiv:2408.09710v1.
Examples
if (FALSE) { # \dontrun{
df <- morie_tps_load_tps_dataset("Assault", nrows = 4000)
rr <- morie_tps_hawkes_advanced_fit(df, kernel = "gamma",
baseline = "sinusoidal",
ds_name = "Assault")
print(rr$summary_lines)
} # }