A Scatter Plot in Stata with Reduced Noise
Updated: Feb 22
You can use the binscatter command in Stata to create a scatter plot where the values are separated into bins (similar to a histogram). By placing individual values into bins that each represent a range of values, it allows trends in a scatter plot to be more easily seen and interpretable. The binscatter command also allows you to apply predictive lines (such as linear or quadratic) more easily than a regular scatter. Use the linetype() option with either lfit for linear, qfit for quadratic, or connect to run a line connecting the dots.
To create a binned scatter in Stata, you first need to download the binscatter command from the SSC. You do this in Stata with the following command:
To generate this graph in Stata, use the following commands:
Let's compare this with the original scatter:
To generate this comparison in Stata, use the following commands: