Skip to content

Better methods for simulation #90

Description

@JoseKling

Working on #88 I noticed it might have opened the possibility to make the simulation methods more general and maybe simpler.
The mark distributions have their own sample_mark(md::MarkDistribution, t, h::History) method. The idea is to have a sample_time(pp::PointProcess, h::History) method as well (method names to be defined).
sample_time would return the next event after history h or, if the next event time would fall beyond h.tmax, return nothing. With this, we could define

function simulate(pp::PointProcess, tmin, tmax)
  h = History(tmin, tmax) # Empty history
  t = sample_time(pp, h)
  while t
    m = sample_mark(pp.mark_dist, t, h) # Should probably be implemented for point processes, like `sample_mark(pp, t, h)`
    push!(h, t, m)
    t = sample_time(pp, h)
  end
  return h
end

The advantage being that this works for any point process and any mark distribution, no matter if the mark distribution and event times are dependent.
Additionally, sample_time could have a fallback, which would be basically the algorithm from simulate_ogata, but instead of simulating the whole process, it just simulates the next event.
Another possibility would be to have a method inverse_integrated_ground_intensity (or something similar, but not that long) to implement the fallback for sample_time. This is probably more efficient than sampling multiple times until one can be kept, and since we need an additional method anyway (ground_intensity_bound or inverse_integrated_ground_intensity), might as well use this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions