# Creating clustered bar charts

## Video: Creating clustered bar charts

The last several sections of movies have dealt with methods for examining one variable at a time with graphs, descriptives, statistics, and inferential procedures. These kinds of univariate analyses can be very interesting in their own right, such as the number of people to vote for a particular political candidate or the amount of money spent on chewing gum in the US each year, which I've heard once is \$500 million per year. And they form a truly essential part of any further analysis. That is they are foundational essential background pieces of an analysis.

## Creating clustered bar charts

The last several sections of movies have dealt with methods for examining one variable at a time with graphs, descriptives, statistics, and inferential procedures. These kinds of univariate analyses can be very interesting in their own right, such as the number of people to vote for a particular political candidate or the amount of money spent on chewing gum in the US each year, which I've heard once is \$500 million per year. And they form a truly essential part of any further analysis. That is they are foundational essential background pieces of an analysis.

So before you look at any combinations of variables you need to understand each variable on its own. But with that said, it's the associations between variables that are often of the most interest to people. For example, I am also told that people chew gum more often during times of social unrest. Now, you can make with that what you will, but it gets at the heart of the great majority of real world data analysis. How can you predict or explain one thing based on another? And as a first step to understanding associations, like we did with univariates, we're going to start where you should always start in an analysis: with a picture.

One of the easiest kinds of charts for showing associations is the clustered bar chart, which is particularly well suited for showing the relationship between two categorical variables. For instance, Normal or Ordinal variables. We covered simple bar charts earlier when we looked at univariate charts and they can be just as useful here. In fact, the only real difference is that we will now cluster variables by grouping them on the axis across the bottom. While the difference may seem small, it really opens up a lot of analytical possibilities in SPSS.

Now, to demonstrate this, I am going to be using the data set Searches.sav, about Google searches, and how they vary from state to state. In this particular example I am going to look at two variables that are near the end on the right. What I am going to look at, whether a state has an outline for a high school statistics class and I am going to compare that to the region of the country that they are in. There are four regions. So that's a categorical variable with four categories and statistics education is a dichotomous yes/no.

And I am going to look and see if the proportion of states with statistics curriculum varies from one region to another. Now, to do that, I am going to go up to Graphs, to the Chart Builder, and I am going to come down to Bar chart and choose clustered bar charts. I am going to drag that up to the canvas and then I need to take one variable and put it in the X-axis and the other variable to set the colors of the bars. What I am going to do is I am going to put the region in the X-axis, and for no other reason I have four regions and I don't want to have four different colors in my chart, but also you're going to see how this allows me to make a yes/no comparison more easily between each group.

What I am going to do is I am going to get the region variable, which is near the bottom of the dataset. That's this one right here, the Census Bureau Region. I am going to drag that down to X-axis and then for this one on the top-right that says Cluster on X: set color, I am going to take whether they have an outline for high school statistics. That's this variable right here. So I am going to drag that over to cluster, and I think that's all I really need right here. So I am going to come down and click OK. When we first get the output, we get a lot of text.

This is the command that you could write to produce this chart. Beneath that is the chart itself. It's just blue and green bars, and what it has is a pair of bars for each Census Bureau Region from the Northeast, and the Midwest, the South ,to the West, and the blue bar means that the state does not have an outline for high school statistics class, but a green bar means that it does. There are a couple of things that jump out immediately. First, is that in the Northeast not a single state has an outline for a high school statistics class.

The Midwest has just one, and the West has just three, but the Southern region, there are more states that have outlines or high school statistics, than there are without them. That's extraordinarily unusual. That's a very different pattern. Now there is one challenge with this particular chart and that is that there is not the same number of states in each region, and so it can make it a little difficult to compare from one to the other. Fortunately, the Bar Chart command lets us do something significant here.

What I am charting right now on the side is the counts. That's the number of states that do or do not have an outline for a high school statistics class. I am going to change that though to be a percentage and here's how we're going to work. I am going to go back to Graphs, to the Chart Builder, and I am going to pick up where I left off, except right here it says Count on the side, and if I go over to the Element Properties window where it says Bar, right here under statistics it says Count.

If I click on that, I actually have a huge number of options. I can specify tremendous number of things. What I am going to do is I am going to click Percentage. Now the reason that has a question mark in parenthesis is because I need to set the parameters for the percentage. It's asking me a percentage of what? I click on that. I don't want the grand total. What I do want is each X-axis category, that is, each region. I want to know what percentage of the schools in each region do or do not have a high school statistics curriculum.

So I am going to click on that one and press Continue, then I come down to the bottom of the Elements window and press Apply, then back over to the main window and press OK. We get the text output and then I scroll down and I have another chart. And you can see this one looks slightly different and it's because it's adjusting it for the differences in the sizes of the regions. We still see that in the Northeast none of the schools have an outline for = high school statistics class. That's why the blue line, the No, goes all the way up to 100%. In the Midwest, only 10% of the schools, in the South, over 50% have a curriculum, and in the West, it's just over 20%, and that's another way of adjusting for differences to make a little easier to interpret. You usually want to compensate for the differences in the sample sizes and look at the percentages or the rates in a particular area, and that's one of the beautiful things about SPSS, is how easy it makes that particular procedure.

So the first kind of association chart that we've covered, the clustered bar chart, is a small variation on a univariate bar chart, and it's a great way of showing the association between two categorical variables. This command makes a very clean, simple, and easy to interpret chart, which is the real goal of data visualization, is statistical graphics. In the next movie, we will look at using scatter plots to show the associations between two scale variables.

Show transcript

#### This video is part of

SPSS Statistics Essential Training (2011)

52 video lessons · 20187 viewers

Author

Expand all | Collapse all
1. ### Introduction

2m 58s
1. Welcome
1m 5s
2. Using the exercise files
40s
3. Using a different version of the software
1m 13s
2. ### 1. Getting Started

19m 0s
1. Taking a first look at the interface
11m 49s
7m 11s
3. ### 2. Charts for One Variable

21m 54s
1. Creating bar charts for categorical variables
7m 18s
2. Creating pie charts for categorical variables
2m 54s
3. Creating histograms for quantitative variables
5m 45s
4. Creating box plots for quantitative variables
5m 57s
4. ### 3. Modifying Data

33m 10s
1. Recoding variables
5m 33s
2. Recoding with visual binning
5m 33s
3. Recoding by ranking cases
5m 26s
4. Computing new variables
5m 37s
5. Combining or excluding outliers
5m 21s
6. Transforming outliers
5m 40s
5. ### 4. Working with the Data File

28m 12s
1. Selecting cases
6m 44s
2. Using the Split File command
5m 12s
3. Merging files
5m 33s
4. Using the Multiple Response command
10m 43s
6. ### 5. Descriptive Statistics for One Variable

22m 14s
1. Calculating frequencies
8m 43s
2. Calculating descriptives
5m 31s
3. Using the Explore command
8m 0s
7. ### 6. Inferential Statistics for One Variable

16m 3s
1. Calculating inferential statistics for a single proportion
6m 6s
2. Calculating inferential statistics for a single mean
5m 39s
3. Calculating inferential statistics for a single categorical variable
4m 18s
8. ### 7. Charts for Two Variables

30m 43s
1. Creating clustered bar charts
7m 10s
2. Creating scatterplots
5m 8s
3. Creating time series
3m 24s
4. Creating simple bar charts of group means
4m 17s
5. Creating population pyramids
3m 0s
6. Creating simple boxplots for groups
3m 3s
7. Creating side-by-side boxplots
4m 41s
9. ### 8. Descriptive and Inferential Statistics for Two Variables

45m 28s
1. Calculating correlations
8m 17s
2. Computing a bivariate regression
6m 27s
3. Creating crosstabs for categorical variables
6m 34s
4. Comparing means with the Means procedure
6m 33s
5. Comparing means with the t-test
6m 4s
6. Comparing means with a one-way ANOVA
6m 30s
7. Comparing paired means
5m 3s
10. ### 9. Charts for Three or More Variables

24m 30s
1. Creating clustered bar charts for frequencies
6m 34s
2. Creating clustered bar charts for means
3m 45s
3. Creating scatterplots by group
4m 13s
4. Creating 3-D scatterplots
4m 25s
5. Creating scatterplot matrices
5m 33s
11. ### 10. Descriptive Statistics for Three or More Variables

30m 57s
1. Using Automatic Linear Models
11m 52s
2. Calculating multiple regression
9m 3s
3. Comparing means with a two-factor ANOVA
10m 2s
12. ### 11. Formatting and Exporting Tables and Charts

29m 29s
1. Formatting descriptive statistics
6m 1s
2. Formatting correlations
7m 49s
3. Formatting regression
10m 19s
4. Exporting charts and tables
5m 20s
13. ### Conclusion

51s
1. What's next
51s

### Start learning today

Get unlimited access to all courses for just \$25/month.

Sometimes @lynda teaches me how to use a program and sometimes Lynda.com changes my life forever. @JosefShutter
@lynda lynda.com is an absolute life saver when it comes to learning todays software. Definitely recommend it! #higherlearning @Michael_Caraway
@lynda The best thing online! Your database of courses is great! To the mark and very helpful. Thanks! @ru22more
Got to create something yesterday I never thought I could do. #thanks @lynda @Ngventurella
I really do love @lynda as a learning platform. Never stop learning and developing, it’s probably our greatest gift as a species! @soundslikedavid
@lynda just subscribed to lynda.com all I can say its brilliant join now trust me @ButchSamurai
@lynda is an awesome resource. The membership is priceless if you take advantage of it. @diabetic_techie
One of the best decision I made this year. Buy a 1yr subscription to @lynda @cybercaptive
guys lynda.com (@lynda) is the best. So far I’ve learned Java, principles of OO programming, and now learning about MS project @lucasmitchell
Signed back up to @lynda dot com. I’ve missed it!! Proper geeking out right now! #timetolearn #geek @JayGodbold
Share a link to this course

### What are exercise files?

Exercise files are the same files the author uses in the course. Save time by downloading the author's files instead of setting up your own files, and learn by following along with the instructor.

### Can I take this course without the exercise files?

Yes! If you decide you would like the exercise files later, you can upgrade to a premium account any time.

How to use exercise files.

Learn by watching, listening, and doing, Exercise files are the same files the author uses in the course, so you can download them and follow along Premium memberships include access to all exercise files in the library.

Exercise files

How to use exercise files.

For additional information on downloading and using exercise files, watch our instructional video or read the instructions in the FAQ.

This course includes free exercise files, so you can practice while you watch the course. To access all the exercise files in our library, become a Premium Member.

Are you sure you want to mark all the videos in this course as unwatched?

This will not affect your course history, your reports, or your certificates of completion for this course.

Congratulations

You have completed SPSS Statistics Essential Training (2011).

Become a member to add this course to a playlist

Join today and get unlimited access to the entire library of video courses—and create as many playlists as you like.

### Already a member?

Become a member to like this course.

Join today and get unlimited access to the entire library of video courses.

### Already a member?

Exercise files

Learn by watching, listening, and doing! Exercise files are the same files the author uses in the course, so you can download them and follow along. Exercise files are available with all Premium memberships. Learn more

How to use exercise files.

Thanks for contacting us.
You’ll hear from our Customer Service team within 24 hours.

Please enter the text shown below:

The classic layout automatically defaults to the latest Flash Player.

To choose a different player, hold the cursor over your name at the top right of any lynda.com page and choose Site preferencesfrom the dropdown menu.

• Mark video as unwatched
• Mark ALL videos as unwatched
Exercise files

Access exercise files from a button right under the course name.

Mark videos as unwatched

Remove icons showing you already watched videos if you want to start over.

Control your viewing experience

Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.

Interactive transcripts

Click on text in the transcript to jump to that spot in the video. As the video plays, the relevant spot in the transcript will be highlighted.

## Are you sure you want to delete this note?

Thanks for signing up.

We’ll send you a confirmation email shortly.

• new course releases
• general communications
• special notices

Keep up with news, tips, and latest courses with emails from lynda.com.

• new course releases