we learned in school that the rule to determine a mode in a statistical distribution of a continuous variable is Mo=Lower boundary of modal classe+(fmo-fb)/(fmo-f before+fmo-f greater) ×class width. Actually, I wasn't convinced because there is no logical reason for the answer that we get to be the mode. The mode doesn't necessarily belong to the modal class; it may be any number between the least and greatest variable although it is nearly impossible to have two exactly equal variables of same frequency. So the great question is: is the previous rule really correct and makes sense? Why are we interested in determining the exact mode? Isn't what really matters the modal class? Similarly for the median.
1 Answers
Once you sort data into 'bins' (intervals or classes) to make a histogram you have lost information. It is easy to say the mode of the sample is in the modal bin with various rules, depending on author, to say just where within the bin.
Usually, the goal of finding the mode of a sample is to estimate the mode of the population. A modern method of finding the mode of a continuous sample is to use KDE (for kernel density estimation). Roughly, the idea is to fit smooth curves to various small intervals of data and then somehow merge them into one smooth curve that (one hopes) is a good estimate of the density function of the population. Like almost all estimation procedures, this works better if you have a large sample than if you have a small sample.
Suppose we are sampling from the normal population $\mathsf{Norm}(\mu = 100,\, \sigma = 15).$ Then the population mode is at $\mu = 100.$ Let's look at histograms and KDE estimates for samples of sizes $n = 100$ and $n=1000.$ In each case the unknown density function is shown in blue and the density estimator (based on the sample) is shown in red.
For the small sample the modal bin is between 105 and 110, the KDE estimates the mode at about 105, and the population mode is 100. For the large sample the modal bin is between 95 and 100, the KDE estimates the mode at about 198, and the population mode is 100. (In both graphs, small tick marks show the exact locations of the data points.)
Note: The figure was made using R statistical software. In case it is of use, the R code is shown below. To reproduce exactly the same figure, use the seed shown; for
a different illustration omit the set.seed statement.
set.seed(1237)
mu = 100; sg = 15
x.100 = rnorm(100, mu, sg); x.1000 = rnorm(1000, mu, sg)
par(mfrow=c(2,1))
hist(x.100, prob=T, br=20, col="skyblue2", ylim=c(0,.03), main="Small Sample with KDE")
curve(dnorm(x, mu, sg), col="blue", add=T)
lines(density(x.100), col="red", lwd = 2, type="l"); rug(x.100)
hist(x.1000, prob=T, br=20, col="skyblue2", ylim=c(0,.03), main="Large Sample with KDE")
curve(dnorm(x, mu, sg), col="blue", add=T)
lines(density(x.1000), col="red", lwd = 2, type="l"); rug(x.1000)
par(mfrow=c(1,1))
- 51,500
