Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • bounding my violin plot at 1

    Hi there.
    i've run a vioplot on stata, however the plots are lying slightly above the value of one which shouldn't be happening as my variable is a 0-1 variable. is there a way i can bound the command to sit at one?

    the command i used is:

    vioplot eq5d, over(agecategory) bar(color(black)) density(color(ebg)) line(color(midblue)) median(color(red)) title (" Relationship between EQ5D and age") ytitle("EQ5D") xtitle(Age categories)

    Thanks

  • #2
    That is a side-effect of the fact that vioplot (user written and available from SSC) involves smoothing, and bounds are often problems for such algorithms. Maybe stripplot (available from SSC) or qplot (available from SJ) are more appropriate for displaying/comparing your distributions.
    ---------------------------------
    Maarten L. Buis
    University of Konstanz
    Department of history and sociology
    box 40
    78457 Konstanz
    Germany
    http://www.maartenbuis.nl
    ---------------------------------

    Comment


    • #3
      I have to support Maarten's suggestions.

      Truncating the density function estimate may look cleaner and more logical, but in practice that would bias your view of the distribution as some fraction of the probability would just be omitted. So, values near 0 and 1 would appear to be less frequent than they should be.

      In principle it's possible to make the boundaries reflective and fold back the probability that was incorrectly smoothed beyond 0 or 1, by analogy with technique sometimes used for differential equations.

      I wrote Stata code for this reflection ad hoc several years ago for an example in

      Cox, N.J. 2007. Kernel estimation as a basic tool for geomorphological data analysis. Earth Surface Processes and Landforms 32: 1902-1912 (doi:10.1002/esp.1518)

      which may or may not accessible to you via

      http://onlinelibrary.wiley.com/doi/1.../esp.1518/epdf

      The code isn't available usefully: it would just be a short do-file geared to a very specific example. (There's no code in the paper.)

      To do this with vioplot, I think you'd need to clone the program and add a fix yourself.

      Comment

      Working...
      X