0

Can someone explain to me how one can determine the quadrant that the mean lies in when the Circular stats function is used? Example is below

> mean(df3[[1]])
Circular Data: 
Type = angles 
Units = degrees 
Template = geographics 
Modulo = asis 
Zero = 1.570796 
Rotation = clock 
[1] 152.6511

Usually the quadrant is determined by this mathematically. I am not sure how to apply my mathematical understanding (below) to the Circular function in R

Determining the Quadrant

  • Sin +, Cos + : the mean angle is computed directly.
  • Sin +, Cos - : the mean angle = 180 – θr
  • Sin -, Cos - : the mean angle = 180 + θr
  • Sin -, Cos + : the mean angle = 360 - θr

Basically the question is this, when do you follow the rules above when you get a number from the Circular package?

1
  • It would be helpful if you took the time to create a reproducible example with sample input and desired output.
    – MrFlick
    Nov 15, 2014 at 22:26

1 Answer 1

1

I took the example from ?mean.circular and then ran this code. Since that's not a reproducible example, I posted the dput output below the image:

> findInterval( mean(x) , seq(0, 2*pi, by=pi/2) )
[1] 1
> plot(mean(x))

enter image description here

> x <- circular::circular(runif(50, circular(0), pi))
> mean.circular(x)
Circular Data: 
Type = angles 
Units = radians 
Template = none 
Modulo = asis 
Zero = 0 
Rotation = counter 
[1] 1.456398
> x
Circular Data: 
Type = angles 
Units = radians 
Template = none 
Modulo = asis 
Zero = 0 
Rotation = counter 
 [1] 2.327040536 2.785825681 1.308066172 0.465629700 1.591991415
 [6] 2.799895638 0.597101630 1.532398268 2.286539493 2.406796452
[snipped several more lines]
> str(x)
Classes 'circular', 'numeric'  atomic [1:50] 2.327 2.786 1.308 0.466 1.592 ...
  ..- attr(*, "circularp")=List of 6
  .. ..$ type    : chr "angles"
  .. ..$ units   : chr "radians"
  .. ..$ template: chr "none"
  .. ..$ modulo  : chr "asis"
  .. ..$ zero    : num 0
  .. ..$ rotation: chr "counter"

dput output:

> dput(x)
structure(c(2.3270405356074, 2.78582568050163, 1.30806617224081, 
0.46562970044316, 1.59199141527826, 2.79989563818328, 0.5971016303539, 
1.53239826820734, 2.28653949278211, 2.40679645204717, 1.89535428259936, 
2.93137660453899, 0.0177478829505632, 1.42734595196813, 1.87201844464804, 
0.695967970430947, 2.04070832419577, 0.550663977456403, 2.92634734087854, 
0.958306068791458, 2.84969662093696, 2.51629270013684, 2.59782748619366, 
1.02971903657107, 0.561164568631031, 2.23073552882588, 1.22498917136169, 
2.9371640847422, 0.457753977096242, 0.739334808330959, 0.216332478818938, 
0.405318219633614, 1.99178154032455, 0.113127579417766, 0.894931514015444, 
2.35655867340775, 0.246653277344759, 2.70813517178582, 2.18657670803946, 
0.0214119953469805, 0.95793239635793, 2.22692798316346, 0.582003007195641, 
0.611648808005097, 2.67776878946411, 0.00293802811780693, 2.99580227692684, 
0.809807730553898, 0.936388196372667, 0.378983006826294), circularp = structure(list(
    type = "angles", units = "radians", template = "none", modulo = "asis", 
    zero = 0, rotation = "counter"), .Names = c("type", "units", 
"template", "modulo", "zero", "rotation")), class = c("circular", 
"numeric"))

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.