I am trying to find the mode of various distributions contained in waves (as in, the most frequently occurring value). I don't see that there is an obvious command in Igor Pro 5.05A to find this but maybe I'm missing it. Is there any way to find the mode easily within Igor? Thanks!
ap
Could you calculate a Histogram and then look for the maximum with WaveStats?
Beside the command line both operations can be accessed via Igor's Analysis menu.
A.
Alpha=0.5 is the typical choice. This code then finds the mean of the data in the shortest interval that contains half the data. So it is robust against modes that are not the main mode. This does not return the mode per se, but it is an estimator that asymptotically approaches the mode, and summarizes the data a little bit more cleanly in my opinion.
Histogram
and then look for the maximum withWaveStats
?Beside the command line both operations can be accessed via Igor's Analysis menu.
A.
August 20, 2010 at 08:07 am - Permalink
August 23, 2010 at 08:04 am - Permalink
DF Andrews, “Robust Estimates of Location.” Princeton University Press (1972).
This can be implemented in Igor as follows:
wave data
variable alpha
duplicate /free data,sorted
sort data,sorted
variable n=numpnts(data)
alpha*=n
make /o/n=(n/2) shorths=sorted[p+alpha]-sorted[p]
wavestats /q/m=1 shorths
variable meann=mean(sorted,v_minloc,v_minloc+n/2)
return meann
end
Alpha=0.5 is the typical choice. This code then finds the mean of the data in the shortest interval that contains half the data. So it is robust against modes that are not the main mode. This does not return the mode per se, but it is an estimator that asymptotically approaches the mode, and summarizes the data a little bit more cleanly in my opinion.
Rick
August 23, 2010 at 09:56 pm - Permalink
August 24, 2010 at 01:45 pm - Permalink