[SciPy-User] circular statistic, anybody?
josef.pktd@gmai...
josef.pktd@gmai...
Wed Oct 12 19:28:17 CDT 2011
Some of the few functions in scipy.stats where I have no idea what
they are doing (and whether they are doing the correct thing) are the
circular statistics, circmean, circvar and circstd. (And they are one
of the few ones where I have no interest in figuring it out.)
Test coverage is zero, and they are a bit picky on inputs
http://projects.scipy.org/scipy/ticket/1537
I would like to get some verified results, and improved docstrings
wouldn't hurt either.
I found package circular in R
>>> from scipy import stats
>>> x = np.arange(20)/20.*np.pi
>>> stats.circmean(x)
1.4922565104551515
in R:
> library(circular)
> xc = 0:19
> xc = xc /20 * pi
> mean(circular(xc))
Circular Data:
Type = angles
Units = radians
Template = none
Modulo = asis
Zero = 0
Rotation = counter
[1] 1.492256510455152
That's the only case I managed to match. If xc is in [0, 2*pi], then R
circular produces different results (NaN or a different number with
argument modulo=2pi for example)
>From the R help:
"""
The function circular is used to create circular objects. as.circular
and is.circular coerce an object to a circular and test whether an
object is a circular data.
Usage
circular(x, type = c("angles", "directions"),
units = c("radians", "degrees", "hours"),
template = c("none", "geographics", "clock12", "clock24"), modulo =
c("asis", "2pi", "pi"),
zero = 0, rotation = c("counter", "clock"), names)
"""
Does anybody have an idea what these options mean (I don't), and what
the scipy.stats.circ* functions are actually doing?
Thanks,
Josef
More information about the SciPy-User
mailing list