circstat / pycircstat

Toolbox for circular statistics with Python
MIT License
157 stars 42 forks source link

Skewness of Von mises distribution using two different methods (New) #77

Open A-ep93 opened 2 years ago

A-ep93 commented 2 years ago

I asked a question and received an answer from @philippberens. Thanks for your response @philippberens. However something is still not clear to me and I am creating this issue to ask about it. The previous issue was closed and I think cannot ask there anymore. I appreciate if you can help me solve my problem.

Can you please let me know what do you mean by " The field is much less standardized" in you response? The reason that I am finding this a problem is this: Given the fact that the input distribution is symmetric therefore skewness, by its definition, should be zero I think. It is weird that I get two different values using these two methods. It is true that these measures are different, but I think that the concept of skewness should be the same for both, isn't it true? I greatly appreciate it if you can help me understand this problem.

philippberens commented 2 years ago

What is meant is that there are two different definitions around, like for circular variance. For classical non-circular statistics, everybody agreed on what to call variance long ago, for circular statistics, there are still different options. Therefore the code implements both.

A-ep93 commented 2 years ago

Thank you for your response @philippberens. I think maybe there is a bug in the skewness value calculated by the Fisher method. Please consider this vecotr (values are in radians): b=[0.8149,0.8456,0.3600,0.6513,0.9229,1.3470,0.5658,1.3099,1.1366,0.6194] Your code gives a value of -78.8672 for the Fisher method.

However, I could find the R code below which gives a different result (-0.6). I found the code from here:

cmoment <- function(a, k=1) { c.k <- mean(cos(k * a)); s.k <- mean(sin(k * a)); r.k <- sqrt(c.k^2 + s.k^2); t.k <- (atan2(s.k, c.k) + 2*pi) %% (2*pi); c(c=c.k, s=s.k, r=r.k, t=t.k) }; cskew <- function(a) { m.1 <- cmoment(a, 1); m.2 <- cmoment(a, 2); m.2["r"] * sin(m.2["t"] - 2*m.1["t"]) / (1 - m.1["r"])^(3/2) }

cc <- c(0.8149,0.8456,0.3600, 0.6513,0.9229,1.3470,0.5658,1.3099,1.1366,0.6194)

cskew(cc %% (2*pi))

It think the value that I get from your code is not reasonable and maybe there is a bug in your code. Can you please check to see whether you agree with me on this?