Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
Mike <mcross@exemail.com.au>: I agree with all Nick's points, but it is true that if you have chosen the kernel width correctly, gaps in the data have estimated density zero and this fact makes it easy to identify boundaries between groups of data. The choice of a different kernel width will produce different group boundaries, of course. clear input sampling_event size 1 94.74 2 94.89 3 94.95 4 94.97 5 95 6 95.05 7 95.08 8 96.11 9 96.22 10 96.24 11 96.27 12 96.27 13 96.27 14 96.32 15 96.34 16 97.19 17 97.26 18 97.26 19 97.32 20 97.34 21 97.39 22 98.41 23 100.62 24 100.69 25 100.69 26 100.76 27 100.76 28 100.76 29 100.84 30 100.91 end twoway__histogram_gen size, width(.1) gen(h z) kdensity size, bw(.1) g(x f) nogr g trough=sum(f==0&f[_n-1]!=0) replace trough=0 if f>0 su trough, mean loc m forv i=1/`r(max)' { qui su x if trough==`i', d loc m `m' `r(p50)' } tw bar h z, barw(.1)||line f x, xli(`m') di "`m'"