2

I'm new to JAGS (Just Another Gibbs Sampler) and I was wondering if it is possible to extend it to sample from a space of random permutations?

The reason I ask is that I came across this tutorial on extending JAGS, and one fo the required functions "logDensity" has a required input as a double however to work with permutations I would need to input a double.

http://www.cidlab.com/prints/wabersich2013extending.pdf

Also I don't have to work with just JAGS, if anyone has another suggestion that would work I would appreciate any input.

steve3051980
  • 129
  • 3
  • I could code the sampler myself, I realize this is a simple task however, I wanted to use dclone (R library that uses R with Jags) to make the process parallel. – steve3051980 Feb 26 '16 at 16:24

1 Answers1

0

If the permutations are over 18 or fewer elements, you can represent a permutation as a double by computing its lexicographic rank. (It's possible to squeeze out a couple more elements by computing the rank as a 64-bit integer and then reinterpreting the bits as a double.)

Community
  • 1
  • 1
David Eisenstat
  • 64,237
  • 7
  • 60
  • 120