Main function to generate a Hawkes process sequence. It allows intermediary saves and continuing a stopped simulation. Creates a CSV file with two columns, each row is an event: (magnitude, time)

generate_series(
  model,
  par,
  model_type,
  sim_no = 1,
  cores = 1,
  Tmax = Inf,
  maxEvents = NULL,
  M = NULL,
  tol = 1e-05,
  return_as_object = F,
  init_history = NULL
)

Arguments

model

A model class object with par and model_type presented. par and model_type are not requird once this is given

par

A named vector of model parameters, K, alpha, beta, mmin, c, theta - parameters of the Hawkes kernel

model_type

Model type

sim_no

The number of simulated cascades

cores

The number of cores (processes) used for simulation

Tmax

Maximum time of simulation.

maxEvents

Maximum number of events to be simulated.

M

Magnitude of the initial event

tol

Simulation stops when intensity smaller than tol.

return_as_object

wether return the cascades within a model object

init_history

If given, the simulation will start after the last event in the given init_history

Value

A list of data.frames where each data.frame is a simulated event cascade with the given model by default. Or a model object with the data.frames if return_as_object is True

Examples

generate_series(model_type = 'EXP', par = c(K = 0.9, theta = 1), sim_no = 10, Tmax = Inf)
#> [[1]] #> magnitude time #> 1 1 0 #> #> [[2]] #> magnitude time #> 1 1 0 #> #> [[3]] #> magnitude time #> 1 1 0.0000000 #> 2 1 0.5555745 #> #> [[4]] #> magnitude time #> 1 1 0 #> #> [[5]] #> magnitude time #> 1 1 0.00000000 #> 2 1 0.02183574 #> #> [[6]] #> magnitude time #> 1 1 0 #> #> [[7]] #> magnitude time #> 1 1 0 #> #> [[8]] #> magnitude time #> 1 1 0 #> #> [[9]] #> magnitude time #> 1 1 0.0000000 #> 2 1 0.8599476 #> #> [[10]] #> magnitude time #> 1 1 0 #>