On 6/21/13 11:56 PM, Ben Goodrich wrote:
> There is an ancient branch called circular where somebody implemented a couple of things.
I think the issue there was that we needed tests and doc.
The implementations looked OK to me the last time I looked.
So you should definitely start from there, Peter.
> As I recall, there was a
> question as to whether to go with the convention that the circular distributions be defined on (0,2 * pi) or (-pi,pi). I
> think it would be best to follow the conventions of the circular R package(s) whatever those are.
Here's the doc for circular:
http://cran.r-project.org/web/packages/circular/circular.pdf
This package is hugely flexible and lets the user define
the units. e.g.,
x <- rvonmises(n=100, mu=circular(0), kappa=1)
where the circular() class is highly configurable. The default
is angle in radians, working modularly, so it's not constrained
to (0, 2*pi) or (-pi, pi) or whatever.
The nice part about working modulo 2*pi is that you get
2*pi == 0 instead of a discontinuity.
Even if we restrict the support of von_mises() to [0,2*pi),
we'll have an option to implement as:
parameters {
real<lower=0, upper=2 * pi()> theta;
}
model {
theta ~ von_mises(kappa);
}
or:
parameters {
real theta_raw;
}
transformed parameters {
real<lower=0,upper=2 * pi()> theta;
theta <- mod(theta_raw, 2 * pi());
}
model {
theta ~ von_mises(kappa);
}
Alternatively, we could have a new data type called "angle".
It could underlyingly be implemented one of the above two
ways.
- Bob