if (FALSE) {
## define custom dmy_categorical distribution as a nimbleFunction
dmy_categorical <- nimbleFunction(...)
## nimble model code, using custom-written dmy_categorical distribution
code <- nimbleCode({
x ~ dmy_categorical(...)
})
## create NIMBLE model object
Rmodel <- nimbleModel(code)
## create MCMC configuration object with no samplers
conf <- configureMCMC(Rmodel, nodes = NULL)
## add categorical_general sampler to MCMC configuration
conf$addSampler(target = 'x', type = 'categorical_general', control = list(numCategories = 10))
## build MCMC algorithm
Rmcmc <- buildMCMC(conf)
## compile model and MCMC, run MCMC algorithm
}
Run the code above in your browser using DataLab