Determine Quadrant using Circular Package R -
can explain me how 1 can determine quadrant mean lies in when circular stats function used? example below
> mean(df3[[1]]) circular data: type = angles units = degrees template = geographics modulo = asis 0 = 1.570796 rotation = clock [1] 152.6511
usually quadrant determined mathematically. not sure how apply mathematical understanding (below) circular
function in r
determining quadrant
- sin +, cos + : mean angle computed directly.
- sin +, cos - : mean angle = 180 – θr
- sin -, cos - : mean angle = 180 + θr
- sin -, cos + : mean angle = 360 - θr
basically question this, when follow rules above when number circular
package?
i took example ?mean.circular
, ran code. since that's not reproducible example, posted dput
output below image:
> findinterval( mean(x) , seq(0, 2*pi, by=pi/2) ) [1] 1 > plot(mean(x))
> x <- circular::circular(runif(50, circular(0), pi)) > mean.circular(x) circular data: type = angles units = radians template = none modulo = asis 0 = 0 rotation = counter [1] 1.456398 > x circular data: type = angles units = radians template = none modulo = asis 0 = 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" .. ..$ 0 : 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", 0 = 0, rotation = "counter"), .names = c("type", "units", "template", "modulo", "zero", "rotation")), class = c("circular", "numeric"))
Comments
Post a Comment