nimbleEcology icon indicating copy to clipboard operation
nimbleEcology copied to clipboard

`nimbleOccu` use of `nimbleHMC` via `suggests`

Open paciorek opened this issue 4 months ago • 1 comments

We're currently planning to include a wrapper function, nimbleOccu, to provide lme4-like interface for setting up occupancy models using macros and (optionally) running MCMC.

If we try to use nimbleHMC via suggests, sampler_NUTS is not found when invoking configureHMC.

@kenkellner I think a work-around is to do this (avoiding configureHMC, which is just a convenience wrapper):

    conf <- configureMCMC(mod, nodes = NULL, print = FALSE)
    conf$addSampler(nimbleHMC::sampler_NUTS, target = 'mu',
                    control = list(warmupMode = "iterations", warmup=100))

That way sampler_NUTS is found via namespace resolution within nimbleOccu and passed in, so that we're not trying to find it from within nimble's MCMC configuration code, which does not know about nimbleHMC namespace objects.

I'm going to file an issue on nimbleHMC to consider the more general issue that this reveals.

paciorek avatar Oct 05 '24 20:10 paciorek