I needed to use Stan with an unknown but doubly stochastic matrix, so I implemented the transformation described in
in the attached Stan program (2.9 KB) . You have to do the transformation again outside of Stan due to the inability to call functions that modify the target keyword outside the model block.
Thanks for implementing this. It’s been very helpful to me for one of my projects.
I have a question regarding this. The doubly stochastic matrix ‘X’ is a local variable in the model block. Is there any way I can get extract the estimates for this matrix?
Not tested but it may be sufficient to add another function that copies all the stick_breaking_lp function code but with commenting out the target line and then using it in the generated quantities block on matrix B.