Circular examples?


Section 19 of the manual discusses directions, rotations & hyperspheres, but isn’t accompanied by any examples. Might there be some somewhere else?


Afraid not. I wrote that chapter, then meant to apply it to movement HMMs in ecology, but never got around to it. Right now, the movement HMM models don’t use circular statistics for the bearings, but they should.

I was hoping that the representation of the unit_vector type (free with a standard normal prior so the implied distribution is uniform on the unit vectors and proper) would actually lead to real locality of things that are close on the circle. It’s not perfect as there’s only a soft constraint on radius, but I still hope it’s better than completely non-local representations like real<lower=-pi(), upper=pi()>.


Ah, I think I understand the unit_vector variable type now! Key to my revelation was realizing that I think it’s intended as a intermediate/helper variable and that you need to transform it to get at quantities of interest. For example, if interested in an angle on a circle, you’d define a unit_vector[2] angle_helper parameter and then compute the angle as a transformed variable: real angle = atan2(angle_helper[1],angle_helper[2]);

Full example is here.


Exactly. I’ll put a note to that effect in the manual chapter.