1
$\begingroup$

In some statistics lessons, I have heard that frequency represents area of bars. So I was curious and plotted these numbers:

[1, 2, 1, 3, 3, 4, 5, 1, 4, 6, 7, 3, 7, 5, 7, 2, 8, 9, 10, 8, 10]

The histogram has frequency on y-axis:

enter image description here

This histogram is representing the height as frequency, but if I want areas then width = 2 and heights are 3, 5, 4, 4, 5. Areas would l x b =

  • First bar, 3 x 2 = 6
  • Second bar, 5 x 2 = 10
  • Third bar, 4 x 2 = 8
  • Fourth bar, 4 x 2 = 8
  • Last bar, 5 x 2 = 10

I don't see these 6, 10, 8, 8, 10 numbers anywhere. So, how exactly area is represented by frequency?

$\endgroup$
3
  • 2
    $\begingroup$ The Area of your first bar is computed as follows: Relative frequency is 3 divided by sample size 42. Density is $\frac{3}{42(2)}.$ Area is Density times width (same as relative frequency). Sum of Areas (relative frequencies) is 1. See my Answer for details. (The 'Frequency' label on your histogram seems confusing.) $\endgroup$
    – BruceET
    Commented Aug 1, 2020 at 1:22
  • 2
    $\begingroup$ I think most people would say that the area of the bars represents the frequency, instead of the other way around. The frequency is a "real" concept being represented by the histogram, not the other way around. $\endgroup$ Commented Aug 1, 2020 at 1:34
  • $\begingroup$ You may check this article. $\endgroup$ Commented Aug 3, 2020 at 14:17

1 Answer 1

3
$\begingroup$

Perhaps you're thinking of a 'density' histogram, for which the vertical scale is chosen so that the total area of all of the bars in the histogram is $1.$

Below is such a density histogram from R statistical software. It is based on a dataset of size n = 1000, generated from $\mathsf{Norm}(\mu=50, \sigma=5).$ Bin widths are 5.

 set.seed(2020)
 x = rnorm(1000, 50, 5)
 cutpt = seq(25,70,by=5)
 hist(x, prob=T, lab=T, br=cutpt, ylim=c(0, .1), col="skyblue")
  curve(dnorm(x, 50, 5), col="darkgreen", lwd=2, add=T)

enter image description here

The argument lab=T of the procedure hist causes 'densities' (slightly rounded) to be plotted atop each bar. These are the heights of the bars on the density scale. For reference, the density function of the distribution $\mathsf{Norm}(\mu=50, \sigma=5)$ of the population from which the $n=1000$ observations were sampled, is shown along with the histogram.

In R, output for a 'non-plotted' histogram gives some information about the values used in constructing the histogram. (Only relevant parts of the output are shown here.)

hist(x, prob=T, br=cutpt, plot=F)
$breaks
[1] 25 30 35 40 45 50 55 60 65 70
$counts
[1]   0   4  23 142 355 325 119  30   2
$density
[1] 0.0000 0.0008 0.0046 0.0284 0.0710 0.0650 0.0238 0.0060 0.0004

The relative frequency (proportion of the whole sample) of each bar is its density times its width $5.$ These are the areas of each bar. The sum of the areas is $1.$ For example, in the $4$th bin, the frequency is $142,$ the relative frequency is $142/1000 = 0.142,$ and the density is $0.142/5 = 0.0284.$

den = hist(x, prob=T, br=cutpt, plot=F)$den
sum(5*den)
[1] 1

For a sample size as large as $n=1000,$ we can expect that the histogram will roughly imitate the shape of the population density function. A kernel density estimate (KDE) provides a way to make a curve that may match the population more closely. The KDE uses the data directly and is not influenced by the bins chosen to make the histogram. The area beneath the KDE is also (very nearly) $1.$ In the figure below the KDE is plotted as a dotted red curve.

 set.seed(2020)
 x = rnorm(1000, 50, 5)
 cutpt = seq(25,70,by=5)
 hist(x, prob=T, br=cutpt, ylim=c(0, .1), col="skyblue")
  curve(dnorm(x, 50, 5), col="darkgreen", lwd=2, add=T)
  lines(density(x), lwd=3, col="red", lty="dotted")

enter image description here

Addendum per Comments.

For your data, in R:

x = c(1, 2, 1, 3, 3, 4, 5, 1, 4, 6, 7, 3, 7, 5, 7, 2, 8, 9, 10, 8, 10)

table(x)
x
 1  2  3  4  5  6  7  8  9 10 
 3  2  3  2  2  1  3  2  1  2 

The following gives a 'frequency' histogram as shown. (Parameter labels=T causes frequencies to be printed atop bars; parameter ylim=c(0,6) makes the window large enough to show the frequencies.) The height of each bar simply represents the number of data points within the bin interval for each bar.

hist(x, br=5, ylim=c(0,6),  labels=T)

enter image description here

To emphasize that each observation is represented by "basic unit of area", I now add horizontal reference lines, not normally shown. Ths sample size is $n=21,$ so there are 21 rectangles within the histogram bars.)

 hist(x, br=5, ylim=c(0,6),  labels=T)
  abline(h=1:5, col="green", lty="dotted")

enter image description here

Here is a 'stripchart' (dotplot) of the data, illustrating which points are in which histogram bins.

stripchart(x, meth="stack", pch=20, xlim=c(0,10), offset=.5)
 abline(v=seq(0,10,by=2)+.05, col="green", lty="dotted")

enter image description here

The following R code makes a 'density' histogram (on account of the parameter 'prob=T'). You can multiply the width (2) of each interval by its density to get the area of each bar. The sum of these areas is $1.$

hist(x, prob=T, ylim=c(0,.15), labels=T)

enter image description here

$\endgroup$
8
  • $\begingroup$ I see, that was helpful as well. But my question was different I think. For example, when you plot a histogram with different bin widths, you get different areas in each bar. These areas don't represent the frequency well. Under this context, I wanted to know how frequency is area of a bar? The y-axis is labelled as 'Frequency' but it seems actually to be the height of bar. So, frequency and height should different but it appears they are not. $\endgroup$
    – cpx
    Commented Aug 1, 2020 at 18:20
  • $\begingroup$ Unless you are trying to give a graphical description of a heavily skewed distribution, it is almost always a mistake to make a histogram with unequal bin widths. If you have a specific question about a histogram with unequal bit widths, then please formulate it clearly and post it separately. $\endgroup$
    – BruceET
    Commented Aug 1, 2020 at 18:25
  • $\begingroup$ Sure, I think I would, but in my diagram posted in the question, would say the y-axis is frequency or height of the bar? or, frequency = height? Normally, it is labeled as frequency but it seems the height. $\endgroup$
    – cpx
    Commented Aug 1, 2020 at 18:29
  • $\begingroup$ Did you see my Comment below your Question, where I addressed this? Also, I was gently trying to say the histogram in your question is improperly labeled and badly drawn. If acceptable answers need to justify that histogram, then I think you will have a long wait for an acceptable answer. $\endgroup$
    – BruceET
    Commented Aug 1, 2020 at 18:35
  • 1
    $\begingroup$ Interesting histogram. I thought interval 0 to 2 would only include 0 and 1 values and then next interval 2 to 4 would include 2 and 3 values so on. $\endgroup$
    – cpx
    Commented Aug 3, 2020 at 15:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.