Skip to content
This repository was archived by the owner on Nov 6, 2023. It is now read-only.

Commit 4439258

Browse files
committed
Implement RandomThinning for PoissonProcess
1 parent a75e966 commit 4439258

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

src/thinning/random.jl

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,18 @@
77
88
Random thining with retention probability `p`.
99
"""
10-
struct RandomThinning{T<:Real} <: AbstractThinning
11-
p::T
10+
struct RandomThinning{P<:Union{Real,Function}} <: AbstractThinning
11+
p::P
1212
end
1313

14-
function thin(p::PointProcess, t::RandomThinning)
15-
# TODO
16-
end
14+
thin(p::PoissonProcess{<:Real}, t::RandomThinning{<:Real}) =
15+
PoissonProcess(t.p * p.λ)
16+
17+
thin(p::PoissonProcess{<:Function}, t::RandomThinning{<:Function}) =
18+
PoissonProcess(u -> t.p(u) * p.λ(u))
19+
20+
thin(p::PoissonProcess{<:Real}, t::RandomThinning{<:Function}) =
21+
PoissonProcess(u -> t.p(u) * p.λ)
22+
23+
thin(p::PoissonProcess{<:Function}, t::RandomThinning{<:Real}) =
24+
PoissonProcess(u -> t.p * p.λ(u))

0 commit comments

Comments
 (0)