• Descriptive
    • Moments
    • Concentration
    • Central Tendency
    • Variability
    • Stem-and-Leaf Plot
    • Histogram & Frequency Table
    • Data Quality Forensics
    • Conditional EDA
    • Quantiles
    • Kernel Density Estimation
    • Normal QQ Plot
    • Bootstrap Plot

    • Multivariate Descriptive Statistics
  • Distributions
    • Binomial Probabilities
    • Geometric Probabilities
    • Negative Binomial Probabilities
    • Hypergeometric Probabilities
    • Multinomial Probabilities
    • Poisson Probabilities

    • Exponential
    • Gamma
    • Erlang
    • Weibull
    • Rayleigh
    • Lognormal
    • Pareto
    • Inverse Gamma

    • Beta
    • Power
    • Beta Prime (Inv. Beta)
    • Triangular

    • Normal (area)
    • Logistic
    • Laplace
    • Cauchy (standard)
    • Cauchy (location-scale)
    • Gumbel

    • Normal RNG
    • ML Fitting
    • Tukey Lambda PPCC
    • Box-Cox Normality Plot
    • Sample Correlation r

    • Empirical Tests
  • Hypotheses
    • Theoretical Aspects of Hypothesis Testing
    • Bayesian Inference
    • Minimum Sample Size

    • Empirical Tests
    • Multivariate (pair-wise) Testing
  • Models
    • Manual Model Building
  • Time Series
    • Time Series Plot
    • Decomposition
    • Exponential Smoothing

    • Blocked Bootstrap Plot
    • Mean Plot
    • (P)ACF
    • VRM
    • Standard Deviation-Mean Plot
    • Spectral Analysis
    • ARIMA

    • Cross Correlation Function
    • Granger Causality
  1. Descriptive Statistics & Exploratory Data Analysis
  2. 54  Histogram
  • Preface
  • Getting Started
    • 1  Introduction
    • 2  Why Do We Need Innovative Technology?
    • 3  Basic Definitions
    • 4  The Big Picture: Why We Analyze Data
  • Introduction to Probability
    • 5  Definitions of Probability
    • 6  Jeffreys’ axiom system
    • 7  Bayes’ Theorem
    • 8  Sensitivity and Specificity
    • 9  Naive Bayes Classifier
    • 10  Law of Large Numbers

    • 11  Problems
  • Probability Distributions
    • 12  Bernoulli Distribution
    • 13  Binomial Distribution
    • 14  Geometric Distribution
    • 15  Negative Binomial Distribution
    • 16  Hypergeometric Distribution
    • 17  Multinomial Distribution
    • 18  Poisson Distribution

    • 19  Uniform Distribution (Rectangular Distribution)
    • 20  Normal Distribution (Gaussian Distribution)
    • 21  Gaussian Naive Bayes Classifier
    • 22  Chi Distribution
    • 23  Chi-squared Distribution (1 parameter)
    • 24  Chi-squared Distribution (2 parameters)
    • 25  Student t-Distribution
    • 26  Fisher F-Distribution
    • 27  Exponential Distribution
    • 28  Lognormal Distribution
    • 29  Gamma Distribution
    • 30  Beta Distribution
    • 31  Weibull Distribution
    • 32  Pareto Distribution
    • 33  Inverse Gamma Distribution
    • 34  Rayleigh Distribution
    • 35  Erlang Distribution
    • 36  Logistic Distribution
    • 37  Laplace Distribution
    • 38  Gumbel Distribution
    • 39  Cauchy Distribution
    • 40  Triangular Distribution
    • 41  Power Distribution
    • 42  Beta Prime Distribution
    • 43  Sample Correlation Distribution

    • 44  Problems
  • Descriptive Statistics & Exploratory Data Analysis
    • 45  Types of Data
    • 46  Datasheets

    • 47  Frequency Plot (Bar Plot)
    • 48  Frequency Table
    • 49  Contingency Table
    • 50  Binomial Classification Metrics
    • 51  Confusion Matrix
    • 52  ROC Analysis

    • 53  Stem-and-Leaf Plot
    • 54  Histogram
    • 55  Data Quality Forensics
    • 56  Quantiles
    • 57  Central Tendency
    • 58  Variability
    • 59  Skewness & Kurtosis
    • 60  Concentration
    • 61  Notched Boxplot
    • 62  Scatterplot
    • 63  Pearson Correlation
    • 64  Rank Correlation
    • 65  Partial Pearson Correlation
    • 66  Simple Linear Regression
    • 67  Moments
    • 68  Quantile-Quantile Plot (QQ Plot)
    • 69  Normal Probability Plot
    • 70  Probability Plot Correlation Coefficient Plot (PPCC Plot)
    • 71  Box-Cox Normality Plot
    • 72  Kernel Density Estimation
    • 73  Bivariate Kernel Density Plot
    • 74  Conditional EDA: Panel Diagnostics
    • 75  Bootstrap Plot (Central Tendency)
    • 76  Survey Scores Rank Order Comparison
    • 77  Cronbach Alpha

    • 78  Equi-distant Time Series
    • 79  Time Series Plot (Run Sequence Plot)
    • 80  Mean Plot
    • 81  Blocked Bootstrap Plot (Central Tendency)
    • 82  Standard Deviation-Mean Plot
    • 83  Variance Reduction Matrix
    • 84  (Partial) Autocorrelation Function
    • 85  Periodogram & Cumulative Periodogram

    • 86  Problems
  • Hypothesis Testing
    • 87  Normal Distributions revisited
    • 88  The Population
    • 89  The Sample
    • 90  The One-Sided Hypothesis Test
    • 91  The Two-Sided Hypothesis Test
    • 92  When to use a one-sided or two-sided test?
    • 93  What if \(\sigma\) is unknown?
    • 94  The Central Limit Theorem (revisited)
    • 95  Statistical Test of the Population Mean with known Variance
    • 96  Statistical Test of the Population Mean with unknown Variance
    • 97  Statistical Test of the Variance
    • 98  Statistical Test of the Population Proportion
    • 99  Statistical Test of the Standard Deviation \(\sigma\)
    • 100  Statistical Test of the difference between Means -- Independent/Unpaired Samples
    • 101  Statistical Test of the difference between Means -- Dependent/Paired Samples
    • 102  Statistical Test of the difference between Variances -- Independent/Unpaired Samples

    • 103  Hypothesis Testing for Research Purposes
    • 104  Decision Thresholds, Alpha, and Confidence Levels
    • 105  Bayesian Inference for Decision-Making
    • 106  One Sample t-Test
    • 107  Skewness & Kurtosis Tests
    • 108  Paired Two Sample t-Test
    • 109  Wilcoxon Signed-Rank Test
    • 110  Unpaired Two Sample t-Test
    • 111  Unpaired Two Sample Welch Test
    • 112  Two One-Sided Tests (TOST) for Equivalence
    • 113  Mann-Whitney U test (Wilcoxon Rank-Sum Test)
    • 114  Bayesian Two Sample Test
    • 115  Median Test based on Notched Boxplots
    • 116  Chi-Squared Tests for Count Data
    • 117  Kolmogorov-Smirnov Test
    • 118  One Way Analysis of Variance (1-way ANOVA)
    • 119  Kruskal-Wallis Test
    • 120  Two Way Analysis of Variance (2-way ANOVA)
    • 121  Repeated Measures ANOVA
    • 122  Friedman Test
    • 123  Testing Correlations
    • 124  A Note on Causality

    • 125  Problems
  • Regression Models
    • 126  Simple Linear Regression Model (SLRM)
    • 127  Multiple Linear Regression Model (MLRM)
    • 128  Logistic Regression
    • 129  Generalized Linear Models
    • 130  Multinomial and Ordinal Logistic Regression
    • 131  Cox Proportional Hazards Regression
    • 132  Conditional Inference Trees
    • 133  Leaf Diagnostics for Conditional Inference Trees
    • 134  Hypothesis Testing with Linear Regression Models (from a Practical Point of View)

    • 135  Problems
  • Introduction to Time Series Analysis
    • 136  Case: the Market of Health and Personal Care Products
    • 137  Decomposition of Time Series
    • 138  Ad hoc Forecasting of Time Series
  • Box-Jenkins Analysis
    • 139  Introduction to Box-Jenkins Analysis
    • 140  Theoretical Concepts
    • 141  Stationarity
    • 142  Identifying ARMA parameters
    • 143  Estimating ARMA Parameters and Residual Diagnostics
    • 144  Forecasting with ARIMA models
    • 145  Intervention Analysis
    • 146  Cross-Correlation Function
    • 147  Transfer Function Noise Models
    • 148  General-to-Specific Modeling
  • References
  • Appendices
    • Appendices
    • A  Method Selection Guide
    • B  Presentations and Teaching Materials
    • C  R Language Concepts for Statistical Computing
    • D  Matrix Algebra
    • E  Standard Normal Table (Gaussian Table)
    • F  Critical values of Student’s \(t\) distribution with \(\nu\) degrees of freedom
    • G  Upper-tail critical values of the \(\chi^2\)-distribution with \(\nu\) degrees of freedom
    • H  Lower-tail critical values of the \(\chi^2\)-distribution with \(\nu\) degrees of freedom

Table of contents

  • 54.1 Definition
  • 54.2 Horizontal axis
  • 54.3 Vertical axis
  • 54.4 Rows of associated Frequency Table
  • 54.5 Column “Midpoint” of associated Frequency Table
  • 54.6 Column “Abs. Freq.” of associated Frequency Table
  • 54.7 Column “Rel. Freq.” of associated Frequency Table
  • 54.8 Column “Cumul. Rel. Freq.” of associated Frequency Table
  • 54.9 Column “Density” of associated Frequency Table
  • 54.10 R Module
    • 54.10.1 Public website
    • 54.10.2 RFC
  • 54.11 Purpose
  • 54.12 Pros & Cons
    • 54.12.1 Pros
    • 54.12.2 Cons
  • 54.13 Examples
  • 54.14 Tasks
    • 54.14.1 Number of bins
    • 54.14.2 Scale of the data
DRAFT This draft is under development — DO NOT CITE OR SHARE.
  1. Descriptive Statistics & Exploratory Data Analysis
  2. 54  Histogram

54  Histogram

54.1 Definition

The Histogram is computed for quantitative data and involves the following steps:

  • the observations are sorted in ascending order
  • the observations are categorized into a number of “bins” (most histograms have bins of equal width)
  • for each bin, the number of observations is counted (absolute frequency)
  • the absolute frequencies are plotted as rectangular shapes for each bin -- the height of the rectangles corresponds to the absolute frequency of the corresponding bin (the width of the rectangles is equal to the width/range of the bins)

54.2 Horizontal axis

The variable under investigation is shown on the horizontal axis. This is always used for quantitative variables (either continuous or discrete).

54.3 Vertical axis

The absolute frequency (of each bin) is displayed on the vertical axis.

54.4 Rows of associated Frequency Table

The rows of the Frequency Table correspond to the bins that have been created to categorize the original observations. Each bin is written as an interval with a lower and upper bound. The bounds can be open-ended or closed: for instance, the bin [1000, 1500[ has an open-ended upper bound (i.e. the value 1500 is not included) and a closed lower bound (i.e. the value 1000 is included).

54.5 Column “Midpoint” of associated Frequency Table

The midpoint is simply the central value of the bin. One can think of the midpoint as the value by which each observation that falls inside the bin is replaced.

54.6 Column “Abs. Freq.” of associated Frequency Table

This column shows the Absolute Frequency (i.e. the count) or the number of observations that are contained in the bin.

54.7 Column “Rel. Freq.” of associated Frequency Table

This column shows the Relative Frequency which is defined as the Absolute Frequency divided by the total number of observations. In other words, the Relative Frequency is the (percentage) share of observations that fall inside the bin.

54.8 Column “Cumul. Rel. Freq.” of associated Frequency Table

The Cumulative Relative Frequency is based on the previous column (Relative Frequency) and represent the share (percentage) of observations that are smaller than the upper bound of the bin that is considered. For instance, the computation of Section 54.13 shows that the Cumulative Relative Frequency of bin ]1000, 1500] is 0.9856115. This implies that about 98.6% of all observations are smaller than (or equal to) 1500.

54.9 Column “Density” of associated Frequency Table

The Density is derived from the Relative Frequency and has a scale which ensures that the surface of the Histogram (i.e. the sum of all bin widths multiplied by their respective Densities) are equal to 1. The Density can be computed by dividing the Relative Frequency by the bin width.

54.10 R Module

54.10.1 Public website

The Histogram can be found on the public website:

  • https://compute.wessa.net/histo.wasp

54.10.2 RFC

The Histogram is available in RFC under the menu “Descriptive / Histogram & Frequency Table”.

If you prefer to compute the Histogram on your local computer, the following code snippet can be used in the R console:

x <- runif(300,30,200)
par1 = 'Sturges' #number of bins
par2 = 'grey' #colour
par3 = FALSE #right-closed intervals
xlab = 'x'
main = 'Histogram'
myhist<-hist(x,breaks=par1,col=par2,main=main,xlab=xlab,right=par3)

myhist
$breaks
 [1]  20  40  60  80 100 120 140 160 180 200

$counts
[1] 23 30 34 38 29 27 37 43 39

$density
[1] 0.003833333 0.005000000 0.005666667 0.006333333 0.004833333 0.004500000
[7] 0.006166667 0.007166667 0.006500000

$mids
[1]  30  50  70  90 110 130 150 170 190

$xname
[1] "x"

$equidist
[1] TRUE

attr(,"class")
[1] "histogram"

To create a Histogram, the R code uses the hist function to produce the plot. The dataset is simulated with the runif function as a series of random numbers (N = 300) from the Uniform Distribution with a lower bound of 30 and an upper bound of 200.

54.11 Purpose

The Histogram can be used to graphically examine the distribution of the data. The following properties of the distribution can be visualized by the histogram: central tendency, variability, skewness, modality, and the presence of outliers.

54.12 Pros & Cons

54.12.1 Pros

The Histogram has the following advantages:

  • It is easy to compute with many software packages (even spreadsheets have functions which allow to create histograms and associated frequency tables).
  • It is relatively easy to interpret and conveys a lot of information in a simple graph.
  • Many readers are familiar with histograms -- therefore it is one of the preferred methods to report information about the distribution of a variable of interest.

54.12.2 Cons

The Histogram has the following disadvantages:

  • The Histogram groups the original observations into bins which implies that some information is lost. In the Histogram each observation is represented by the center of each bin.
  • The amount of information that is conveyed depends on the bin size (and the number of bins). Bad choices for the number of bins may conceal distributional features (such as multi modality, central tendency, variability, etc.). Common rules for choosing the number of bins include Sturges’ rule (Sturges 1926).
  • With discrete variables (such as scores on a Likert scale) one must be careful when interpreting the results (because it is possible that all observations are located on the lower or upper bounds of the bins). It may be beneficial to choose bounds in such a way that the observations are all in the center of bins.
  • In the presence of outliers, the histogram may not be very informative. Trimming the outliers from the dataset may be necessary to solve this problem.

54.13 Examples

The Histogram shown below represents the time that was needed by students to submit a survey (in seconds). This Histogram is not very informative because there are several outliers on the right side of the scale.

Interactive Shiny app (click to load).
Open in new tab

The Histogram shown below represents the scores on a 7-point Likert scale from a survey. The bins have been chosen in such a way that the actual scores (1, 2, 3, 4, 5, 6, and 7) fall exactly in the center of each bin (observe how the field “Scale of data” was set to “7-point Likert”).

Interactive Shiny app (click to load).
Open in new tab

54.14 Tasks

54.14.1 Number of bins

Use the first Histogram of Section 54.13 and identify the average time that is needed to submit the survey. There are (at least) two different ways to do this!

54.14.2 Scale of the data

Use the second Histogram of Section 54.13 and set the “Scale of data” field to “Unknown”. Compare the results with the original ones. Which histogram is easier to interpret? Why? What if you set the number of bins to 6?

Sturges, Herbert A. 1926. “The Choice of a Class Interval.” Journal of the American Statistical Association 21 (153): 65–66. https://doi.org/10.1080/01621459.1926.10502161.
53  Stem-and-Leaf Plot
55  Data Quality Forensics

© 2026 Patrick Wessa. Provided as-is, without warranty.

Feedback: e-mail | Anonymous contributions: click to copy (Sats) | click to copy (XMR)

Cookie Preferences