[SciPy-User] circular statistic, anybody?
Sun Oct 16 10:25:28 CDT 2011
The functions are fairly straightforward implementations of the concepts discussed here:
The range [low,high] is assumed to be periodic and linearly mapable to [0, 2*pi]. These numbers are then interpreted as angles, converted to complex numbers on the unit circle and the standard mean of the complex number computed.
The angle of this mean-value complex number is the returned mean (mapped back to the range [low, high])
The magnitude of this mean-value complex number is used to calculate the variance (scaled by the mapping coefficient).
More tests and a link to the wiki-pedia article would be useful in the documentation.
I am not familiar with the CircStats package in R but it looks to have nice specialization to particular domains where circular statistics are relevant (time periods, and angles).
On Oct 12, 2011, at 7:28 PM, firstname.lastname@example.org wrote:
> 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
> 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
> in R:
>> xc = 0:19
>> xc = xc /20 * pi
> Circular Data:
> Type = angles
> Units = radians
> Template = none
> Modulo = asis
> Zero = 0
> Rotation = counter
>  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.
> 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?
> SciPy-User mailing list
More information about the SciPy-User