API reference
PointProcesses
— ModulePointProcesses
A package for temporal point process modeling, simulation and inference.
Histories
PointProcesses.History
— TypeHistory{M,T<:Real}
Linear event histories with marks of type M
and temporal locations of type T
.
Fields
times::Vector{T}
: sorted vector of event timesmarks::Vector{M}
: associated vector of event markstmin::T
: start timetmax::T
: end time
Analysis
PointProcesses.event_marks
— Functionevent_marks(h)
Return the vector of event marks for h
, sorted according to their event times.
PointProcesses.event_times
— Functionevent_times(h)
Return the sorted vector of event times for h
.
PointProcesses.min_time
— Functionmin_time(h)
Return the starting time of h
(not the same as the first event time).
PointProcesses.max_time
— Functionmax_time(h)
Return the end time of h
(not the same as the last event time).
PointProcesses.nb_events
— Functionnb_events(h)
Count events in h
.
nb_events(h, tmin, tmax)
Count events in h
during the interval [tmin, tmax)
.
PointProcesses.has_events
— Functionhas_events(h)
Check the presence of events in h
.
has_events(h, tmin, tmax)
Check the presence of events in h
during the interval [tmin, tmax)
.
Base.length
— Functionlength(h)
Alias for nb_events(h)
.
PointProcesses.duration
— Functionduration(h)
Compute the difference h.tmax - h.tmin
.
PointProcesses.min_mark
— Functionmin_mark(h; [init])
Return the smallest event mark if it is smaller than init
, and init
otherwise.
PointProcesses.max_mark
— Functionmax_mark(h; [init])
Return the largest event mark if it is larger than init
, and init
otherwise.
Modification
Base.push!
— Functionpush!(h, t, m)
Add event (t, m)
at the end of history h
.
Base.append!
— Functionappend!(h1, h2)
Add all the events of h2
at the end of h1
.
PointProcesses.time_change
— Functiontime_change(h, Λ)
Apply the time rescaling t -> Λ(t)
to history h
.
PointProcesses.split_into_chunks
— Functionsplit_into_chunks(h, chunk_duration)
Split h
into a vector of consecutive histories with individual duration chunk_duration
.
Point processes
PointProcesses.AbstractPointProcess
— TypeAbstractPointProcess{M}
Common interface for all temporal point processes with mark type M
.
PointProcesses.BoundedPointProcess
— TypeBoundedPointProcess{M,P,T} <: AbstractPointProcess{M}
Temporal point process P
with pre-defined start and end times.
Implements some fallbacks for the AbstractPointProcess
interface which accept fewer arguments.
Fields
pp::P
: underlying point processtmin::T
: start timetmax::T
: end time
Intensity
PointProcesses.intensity
— Functionintensity(pp, m, t, h)
Compute the conditional intensity for a temporal point process pp
applied to history h
and event (t, m)
.
The conditional intensity function λ(t,m|h)
quantifies the instantaneous risk of an event with mark m
occurring at time t
after history h
.
PointProcesses.ground_intensity
— Functionground_intensity(pp, h, t)
Compute the ground intensity for a temporal point process pp
applied to history h
at time t
.
The ground intensity quantifies the instantaneous risk of an event with any mark occurring at time t
after history h
:
λg(t|h) = Σₘ λ(t,m|h)
PointProcesses.log_intensity
— Functionlog_intensity(pp, m, t, h)
Compute the logarithm of the conditional intensity for a temporal point process pp
applied to history h
and event (t, m)
.
Marks
PointProcesses.mark_distribution
— Functionmark_distribution(pp, t, h)
Compute the distribution of marks for a temporal point process pp
knowing that an event takes place at time t
after history h
.
Simulation
PointProcesses.simulate_ogata
— Functionsimulate_ogata(rng, pp, tmin, tmax)
Simulate a temporal point process pp
on interval [tmin, tmax)
using Ogata's algorithm.
Base.rand
— Functionrand([rng,] pp, tmin, tmax)
Alias for simulate_ogata
.
rand([rng,], bpp::BoundedPointProcess)
Simulate a point process on a predefined time interval.
Inference
DensityInterface.logdensityof
— Functionlogdensityof(pp, h)
Compute the log probability density function for a temporal point process pp
applied to history h
:
ℓ(h) = Σₖ log λ(tₖ|hₖ) - Λ(h)
The default method uses a loop over events combined with integrated_ground_intensity
, but it should be reimplemented for specific processes if faster computation is possible.
Learning
PointProcesses.integrated_ground_intensity
— Functionintegrated_ground_intensity(pp, h, a, b)
Compute the integrated ground intensity (or compensator) Λ(t|h)
for a temporal point process pp
applied to history h
on interval [a, b)
:
Λ(h) = ∫ λg(t|h) dt
PointProcesses.ground_intensity_bound
— Functionground_intensity_bound(pp, t, h)
Compute a local upper bound on the ground intensity for a temporal point process pp
applied to history h
at time t
.
Return a tuple of the form (B, L)
satisfying λg(t|h) ≤ B
for all u ∈ [t, t+L)
.
StatsAPI.fit
— Functionfit(::Type{PP}, h)
fit(::Type{PP}, histories)
Fit a point process of type PP
to one or several histories.
Not implemented by default.
PointProcesses.fit_map
— Functionfit_map(::Type{PP}, h, prior)
fit_map(::Type{PP}, histories, prior)
Fit a point process of type PP
to one or several histories using maximum a posteriori with a prior
.
Not implemented by default.
Poisson processes
PointProcesses.AbstractPoissonProcess
— TypeAbstractPoissonProcess{M} <: AbstractPointProcess{M}
Common interface for all temporal Poisson processes, that is, temporal point processes for which the intensity is not a function of past history.
Implements some fallbacks for the AbstractPointProcess
interface which accept fewer arguments.
Multivariate
PointProcesses.MultivariatePoissonProcess
— TypeMultivariatePoissonProcess{R}
Multivariate homogeneous temporal Poisson process.
Fields
λ::Vector{R}
: event rates.
PointProcesses.MultivariatePoissonProcessPrior
— TypeMultivariatePoissonProcessPrior{R1,R2}
Gamma prior on all the event rates of a MultivariatePoissonProcess
.
Fields
λ_α::Vector{R1}
λ_β::R2
Marked
PointProcesses.MarkedPoissonProcess
— TypeMarkedPoissonProcess{M,R,D}
Homogeneous temporal Poisson process with arbitrary mark distribution.
Fields
λ::R
: event rate.mark_dist::D
: mark distribution with sample typeM
.
Constructor
MarkedPoissonProcess{M}(λ, mark_dist)
Index
PointProcesses.AbstractPointProcess
PointProcesses.AbstractPoissonProcess
PointProcesses.BoundedPointProcess
PointProcesses.History
PointProcesses.MarkedPoissonProcess
PointProcesses.MultivariatePoissonProcess
PointProcesses.MultivariatePoissonProcessPrior
PointProcesses.duration
PointProcesses.event_marks
PointProcesses.event_times
PointProcesses.fit_map
PointProcesses.ground_intensity
PointProcesses.ground_intensity_bound
PointProcesses.has_events
PointProcesses.integrated_ground_intensity
PointProcesses.intensity
PointProcesses.log_intensity
PointProcesses.mark_distribution
PointProcesses.max_mark
PointProcesses.max_time
PointProcesses.min_mark
PointProcesses.min_time
PointProcesses.nb_events
PointProcesses.simulate_ogata
PointProcesses.split_into_chunks
PointProcesses.time_change