Hello I have a model which has an array of discrete binary parameters J[t]

and an array of continuous parameters X[t]. I want to use NUTS() or

HMC() updates for the continuous variables and MH() updates

for the discrete parameters in the McMC. It should be possible

by using GIbbs(), however it is not clear how

to use it when the random variables are indexed arrays, I could not find

not such examples in the documentation.

Here is the changepoint model

Turing.@model function poisson_model(N,T,p,rho)

J = tzeros(Int,T)

X = tzeros(Real,T)

J[1] ~ Dirac(1)

X[1] ~ Exponential(rho)

theta0= X[1]

N[1] ~ Poisson(theta0)

for t in 2:T

J[t] ~ Bernoulli(p)

X[t] ~ Laplace(0,rho)

theta = sum( (J[s]*X[s]) for s in 1:t)

if theta < 0.0

Turing.@addlogprob! -Inf

return

end

N[t] ~ Poisson(theta)

end

return(J,X)

end

poisson_posterior= poisson_model(N,T,p,rho)

chain = Turing.sample(poisson_posterior,MH( ),nMcMC)

works but it is mixing very slowly. Then if I try to combine

different updates using GIbbs()

chain = Turing.sample(poisson_posterior,Gibbs(HMC(0.1,5,:X),MH(:J)),nMcMC)

the last command gives errors, while it should work when X and J are scalars.

Thanks !