Warning: slice sampler reached maximum number of contractions

27 views
Skip to first unread message

Matthijs Hollanders

unread,
Jun 3, 2021, 3:09:15 AMJun 3
to nimble-users
Hello all,

I'm trying to see if I can use NIMBLE for a multinomial mixture model with removal sampling data. I followed AHM1 section 7.6 for the Poisson formulation of the multinomial in JAGS instead of the more 'general' formulation of:

y[i, 1:x] ~ dmulti(probs[i, 1:x], N[i])
N[i] ~ dpois (lambda[i])

because 'this construction does not work in BUGS because a random sample size argument is not allowed in the multinomial distribution.' So, I tried fitting this construction in NIMBLE and had no issues until running the MCMC. A slice sampler is assigned to all latent abundance states N and I get warnings for every single node as follows:

Warning: slice sampler reached maximum number of contractions for 'N[5, 17, 8]'. Current parameter value is 2.

I'm not sure what this means and couldn't find this error on this forum. So the previous steps of building and compiling the model are fine but running the MCMC is giving trouble. Is NIMBLE like JAGS that this formulation won't work, or am I making an error elsewhere? By the way, I am initialising N with the total captures at a given site plus a constant, to make sure the model doesn't initialise N to be less than the total number of captures.

Can provide code of course if necessary.

Regards,
Matt

Daniel Turek

unread,
Jun 3, 2021, 6:38:41 AMJun 3
to Matthijs Hollanders, nimble-users
Matt, good question.  It looks like you're trying to sample the multinomial sample size parameter (N).  The issue I can imagine here is that for:

y[1:x] ~ dmulti( probs[1:x], N )

the necessary condition for this to make sense is that sum(y[1:x]) = N.  That is, the distribution of the N observations across the x categories must sum to N.  As soon as you try to sample N, that is propose and alter the value of N, then this condition fails.  I think that's the issue that the slice sampler is running into, and thus it's unable to sample (propose, or accept a new value for) N.  Does that make sense, or am I missing some part of the problem?

I believe that in the binomial case:

y ~ dbinom(p, N)
N ~ dpois(lambda)

we could in fact sample N, where possible values of N would be N >= y.  But the multinomial case is slightly different as described above.

Does this help?




--
You received this message because you are subscribed to the Google Groups "nimble-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nimble-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/nimble-users/50c48eef-ee2c-42e6-b8f6-ca7f07375e48n%40googlegroups.com.

Matthijs Hollanders

unread,
Jun 3, 2021, 7:13:58 AMJun 3
to db...@williams.edu, nimble-users
Hi Daniel,

Thanks for the quick response. That totally helps and is surely the cause of my issue. Is there any reason that the binomial does allow N > y but the multinomial doesn't?

Loving NIMBLE by the way!

Matt

Daniel Turek

unread,
Jun 3, 2021, 7:28:09 AMJun 3
to Matthijs Hollanders, nimble-users
The short answer would be if we instead defined the binomial (with x=2 categories) as the number of successes *and* the number of failures, as:

y[1:2] ~ dbinom( pSuccess = p, pFailure = 1-p, size = N )

where y[1] + y[2] = N, then it would not work for the binomial, either, since N is subject to this summation constraint again.  But instead, by convention and for simplicity, the binomial is a univariate distribution only giving the number of successes:

y ~ dbinom(pSuccess = p, size = N), 

thus leaving some leeway if you hold y fixed but increased N, and hence we could sample N in this case.
Reply all
Reply to author
Forward
0 new messages