Skip to contents

Maximum-likelihood fit of a temporal-only exponential Hawkes process to incident times. Optimisation runs in base R (stats::optim, Nelder-Mead). Reports background rate mu, branching ratio kappa, decay omega, and the AIC / BIC of the fit.

Usage

morie_tps_hawkes_temporal_fit(df, ds_name = "?", max_n = 5000L)

Arguments

df

A data.frame with TPS-shaped date columns.

ds_name

Character label for the dataset.

max_n

Maximum number of incident times to fit (random subsample seeded with 42 if exceeded).

Value

A morie_rich_result list with mu, kappa, omega, branching, nll, aic, bic.

Examples

set.seed(1)
df <- data.frame(OCC_YEAR = rep(2014:2023, each = 30),
                 OCC_MONTH = sample(month.name, 300, TRUE),
                 HOOD_158 = sample(sprintf("%03d", 1:20), 300, TRUE),
                 LAT_WGS84 = runif(300, 43.6, 43.8),
                 LONG_WGS84 = runif(300, -79.5, -79.2))
res <- try(morie_tps_hawkes_temporal_fit(df, ds_name = "synthetic"))
if (!inherits(res, "try-error")) str(res, max.level = 1)
#> List of 5
#>  $ title         : chr "Hawkes -- synthetic"
#>  $ call          : chr "morie_tps_hawkes_temporal_fit(df=<300r>, max_n=5000)"
#>  $ summary_lines : list()
#>  $ warnings      : chr "only 0 timestamps"
#>  $ interpretation: chr "No analysis: at least 100 timestamps required."
#>  - attr(*, "class")= chr [1:3] "morie_tps_stochastic_result" "morie_rich_result" "list"