# [R] Circular Mean Question

Date: Wed 29 Jun 2005 - 03:34:33 EST

Hi, a question about the circular mean function in the package CircStats:

Can anyone shed some light on why the circ mean function seems to make sense for the first 2 set of bearings and then the mean of 225 and 45 degrees gives an unexpected 180 deg.

 133.5
 134.5
 180
 315.5

Can anyone explain this???

This problem was first detected when I was trying to take the circ weighted means of my data:

With 2 groups of bearings:
x <- c(270,180)
y <- c(45,270)

the circular mean of these bearings gives:
 257.2356

When finding the weighted means I get this:

> deg(circ.weighted.mean(c(meanx,meany),c(2,2)))%%360
 281.25

The function for weighted mean I am using:

circ.weighted.mean <- function (x,w)
{

sinr <- sum(w*sin(x))
cosr <- sum(w*cos(x))
circmean <- atan(sinr, cosr)
circmean
}

I am assuming that the problem that mention above is the cause of the different mean bearings.

Am I missing something fundamental here?

Thanks,
Mike

R-help@stat.math.ethz.ch mailing list