You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
n = 6
Z = 1:n
p = rand(n-2)
p /= sum(p)
p = [0; p; 0]
z = 2
d = 1
zs = [z]
t = 0.0
ts = [t]
iterations = 10000
for iter in 1:iterations
t += randexp()
if p[z+d] > p[z] || rand() < p[z+d]/p[z]
z += d
else
d *= -1
end
push!(zs, z)
push!(ts, t)
end
push!(ts, t[end]+randexp())
using StatsBase
T = ts[end]
Δts = diff(ts)
p̂ = zero(p)
for (Δt, z) in zip(Δts, zs)
p̂[z] += Δt/T
end
[p p̂]
@mschauer Did this end up getting done? Someone on the Slack is looking for discrete mixed/continuous sampling and I want to know whether I should point them at this.
No, we are working on it. Though we have an academic interest here: so while we can't offer an implementation ready to use we are looking for interesting use cases to try out.
Sampling from discrete variables, as shown here.
The text was updated successfully, but these errors were encountered: