Quick facts
Number of variables
One
Scales of variable(s)
Continuous
Information
A histogram is similar to a bar chart but, unlike the bar chart, it is suitable for continuous variables.
The histogram will give us an idea about whether the distribution (of the continuous variable) is normal or skewed.
It is also possible to include a normal curve in the chart in order to see how the data adheres to a normal distribution.
Function
| Basic command |
|
| Useful options |
|
| Explanations | |
| Insert the name of the variable. |
freq | Show frequencies on the y-axis. |
norm | Include a normal curve in the histogram. |
bin(x) | Here you can specify how many bins you want to histogram to show; might require some experimenting. |
d | Specify that data are discrete. |
| Short names | |
freq | frequencies |
norm | normal |
d | discrete |
More informationhelp |
Practical example
| Dataset |
| StataData1.dta |
| Variable name | cognitive |
| Variable label | Cognitive test score (Age 15, Year 1985) |
| Value labels | N/A |
histogram cognitive |

This is a histogram of cognitive.
The default is that the y-axis shows the density of values across the x-axis. Moreover, by default, the bins might represent intervals of values (thus, one bin does not necessarily represent one single value) – this depends on the range of values of the variable.
In this example, we can see that the variable is approximately normally distributed (with a slight negative skew).
We can revise our histogram to display frequency on the y-axis instead of density. Moreover, we can specify that the values are discrete, in order to display one bin per value. And finally, we can add a normal curve on top of our histogram.
histogram cognitive, freq norm d |

| Note You can use the Graph Editor (see Graph) to edit the histogram. |