| 
  • If you are citizen of an European Union member nation, you may not use this service unless you are at least 16 years old.

  • You already know Dokkio is an AI-powered assistant to organize & manage your digital files & messages. Very soon, Dokkio will support Outlook as well as One Drive. Check it out today!

View
 

Stacked histogram

Page history last edited by Leah Scott 9 years, 11 months ago

A stacked histogram is two or more histograms displayed on the same scale and used to compare one categorical variable and one quantitative variable. Unlike a single histogram, which only allows for analysis of a single quantitative variable, each histogram that is part of a stacked histogram takes a categorical variable into account, allowing for direct comparison. The categorical variable is taken into account by creating a separate histogram for each category, allowing for the quantitative data from each category to be displayed within its own histogram. The scale is the same throughout each category's histogram, making them easily comparable. The shape, center, and spread of each histogram can be used for analysis of the data.

 

A stacked histogram is one of two popular ways to display data for a single categorical variable and a single quantitative variable. Another possibility is a side by side box plot

 

For example, suppose that we have data on gas mileage in the United States and gas mileage in other countries. The categorical variable is the country, either the U.S. or other, and the quantitative variable is the gas mileage for vehicles in their respective countries. If we want to compare gas mileage for vehicles in the U.S. to the gas mileage of vehicles in other countries we can use a stacked histogram. The gas mileage goes on the x-axis since it is the quantitative variable and the country goes into the panel because it is our categorical variable. This creates two separate histograms, one on top of the other, on the same scale, making it easy to compare.


One can see that the gas mileage in the U.S. is similar to gas mileage in other countries. The center for both histograms is similar, being between 20 mpg and 30 mpg. It is also easy to see that both categories have a similar spread of data, with other countries having a possible outlier off to the right.

 

It is possible to use counts instead of percentages but percentages usually make it easier to compare groups, especially if the groups are of different sizes. These are not "grand total" percentages, but rather are scaled so that each group adds up to 100%, equalizing the groups for comparative purposes.

 

Generating a stacked histogram in SPSS

  • Go to the “Graphs” menu and select “Chart Builder”.

  • In the gallery, under "Histogram", the first graph type is the “Simple Histogram”. Drag it to the preview window.

  • On the third tab, select “Groups/Point ID” and check “Rows Panel Variable”.

  • Drag the quantitative variable onto the X-Axis.

  • Drag the categorical variable into the box on the right side of the preview called "Panel".

  • In the Element Properties window, under "Statistic" change "Count" to "Histogram Percent".

  • Click the "Set Parameters" button right below that.

  • Change from "Grand Total" to "Total for Each Panel".

  • Click "Continue".

  • Click "Apply" in the Element Properties window.

  • Click "OK". The stacked histogram will appear in the Output window.

 

The following video illustrates these steps:

Unable to display content. Adobe Flash is required.

Comments (0)

You don't have permission to comment on this page.