BayesianTools icon indicating copy to clipboard operation
BayesianTools copied to clipboard

Discrete valued parameters in Bayesian Tools

Open florianhartig opened this issue 4 years ago • 2 comments

From a user:

Thank you for developing the Bayesian Tools package with so many powerful and flexible sampling functions and options. Can I sample a binary parameter (0/1) or a discrete valued parameter (as one of other parameters which are treated as continuous valued) using the functions in this package?

florianhartig avatar Jun 03 '20 19:06 florianhartig

At the moment (version 0.1.7), BT doesn't explicitly support discrete or binary parameters.

If this is only about a small number of parameters, you could probably emulate a discrete parameter by adding a round() argument in your likelihood, and sampling continuously. This should give you the correct posterior (assuming all discrete parameters receice the appropriate prior weight), but I would not guarantee that all the functions in BT (e.g. convergence checks, marginal Likelihoods etc) work appropriately when using this hack. In doubt, check if what you want to do works with an example where the posterior is known to you.

florianhartig avatar Jun 03 '20 19:06 florianhartig

I have a similar issue, with (several) discrete parameters, which can only take the values 1, 2, 3, or 4. Can I somehow force a step size of 1 in the proposal generator, so I only move between these values?

peterlevy avatar Aug 16 '22 17:08 peterlevy