# Problem With Calculating a Circular Mean

Hello all,

For some reason, I get a negative mean angle from this circular dataset. The true mean angle should be 198°. What am I doing wrong here, thanks.

library(circular)
#>
#> Attaching package: 'circular'
#> The following objects are masked from 'package:stats':
#>
#>     sd, var
library(knitr)
library(tidyverse)

FBD1E <- data_frame(c(228,64,259,124,150,152,309,335,256,242,233,334,34,198,229,225,105,203, 260, 134, 231, 143, 165, 166, 156, 227, 317, 154, 102, 208, 191, 15, 144, 329, 184, 321, 230, 276, 155, 73, 289, 204, 201, 5, 246, 179, 301, 208, 202, 55, 223, 159, 112, 276, 85, 137, 226, 174, 158, 155))
#> Warning: data_frame() is deprecated, use tibble().
#> This warning is displayed once per session.

FBD1E.cir <- circular(FBD1E, units = "degrees", template = "geographics")
mean(FBD1E.cir)
#> Circular Data:
#> Type = angles
#> Units = degrees
#> Template = geographics
#> Modulo = asis
#> Zero = 1.570796
#> Rotation = clock
#> [1] -162.3523


I haven't worked with the circular package, but note that 198^\circ and -162^\circ are the same angle because 360 - 162 = 198.

Ahh, I know why they did this. Becuase of where the mean angle is, it sometimes computes the exact angle or you have to subtract it from 360 or 180.

Dang im sooo dumb.

Still, that's not all that helpful unless you know what quadrant (i.e., 180<x<270) the mean angle is right?

You can always convert to the "standard" angle with the modulo operator:

 -162 %% 360


[1] 198

x \hspace{0.15cm} \%\% \hspace{0.15cm} y returns the remainder of x \div y

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.