Menu

#506 wrap kernel functions of angular data with smooth kdensity

None
closed-accepted
nobody
None
5
2022-01-15
2020-07-08
No

Scattered angular data which goes over [0:2pi] is underrepresented at the edges if plotted with smooth kdensity because up to one half of each kernel function lies outside of the range and gets discarded.

 set xrange [0:2*pi]
 set print $dat; do for [i=1:1000] { print rand(0)*2*pi }; set print
 plot $dat us 1:(1) smooth kdensity

There should be an option angular or similar to smooth kdensity to "close the circle", wrapping (is that the right word?) each kernel function over the range limits zero and 2pi.

A similar effect could occur with dgrid3d, if an angle is plotted along a linear axis.

Discussion

  • Ethan Merritt

    Ethan Merritt - 2020-07-10

    Good point, although I think your test case mostly shows that "smoothing" a uniform random distribution has little meaning. I have added a keyword "period" for the kdensity option. The documentation for help kdensity now says:

     Period:
     For periodic data individual Gaussian components should be treated as repeating
     at intervals of one period.  One example is data measured as a function of
     angle, where the period is 2pi.  Another example is data indexed by day-of-year
     and measured over multiple years, where the period is 365.
     In such cases the period should be provided in the plot command:
          plot $ANGULAR_DAT smooth kdensity period 2*pi with lines
    
     
  • Ethan Merritt

    Ethan Merritt - 2020-07-10
    • status: open --> pending-accepted
    • Group: -->
     
  • Karl Ratzsch

    Karl Ratzsch - 2020-08-24

    Finally had a chance to give it a try, many thanks!

     
  • Ethan Merritt

    Ethan Merritt - 2022-01-15
    • status: pending-accepted --> closed-accepted
     

Log in to post a comment.

MongoDB Logo MongoDB