# Analysing a single nominal variable

## visualisation (bar-chart)

**Note: if you prefer to watch a video on bar-charts click here**

In the previous part we got a decent impression of the data for this variable, let’s make a visualization out of it. For a nominal variable a **pie-chart**, **(Cleveland) dotplot**, and bar chart are the most commonly used charts. A bar chart is almost always preferred. In the appendix at the bottom of this page you'll find more information on the Cleveland dot plot and pie-chart, but I'll use a **bar-chart**. A bar-chart is defined as “a graph in which bars of varying height with spaces between them are used to display data for variables defined by qualities or categories” (Zedeck, 2014, p. 20). An example is shown in Figure 1.

*Figure 1*. Results of marital status.

**Click here to see how to create a bar-chart with SPSS, R (Studio), Excel, or Python.**

**with SPSS**

There are a few different ways to obtain a (simple) bar-chart with SPSS. The end result for each will be the same.

*using Chart builder*

Watch the video below, or follow the instructions in this pdf (via bitly, opens in new window/tab).

*using Legacy dialogs*

Watch the video below, or follow the instructions in this pdf (via bitly, opens in new window/tab).

*using Frequencies*

Watch the video below, or follow the instructions in this pdf (via bitly, opens in new window/tab).

*using an existing table*

Watch the video below, or follow the instructions in this pdf (via bitly, opens in new window/tab)

**with R (Studio)**

Download R script from video here.

**with Excel**

Download Excel file from video here.

**with Python**

Download Jupyter Notebook from video here.

When showing a bar-chart it is good to also talk a little bit about it. Usually the peak is mentioned (known as the mode, this term will be discussed later in this section) and perhaps a few of the very low ones. It always depends on the situation, but inform your reader what you notice from the graph or what you want to show.

Note that in a bar-chart each bar has the same width, and also the gaps between the bars is equal. These gaps between bars, are to highlight the nominal nature of the variable.

If you see a bar-chart always check where the vertical axis begins and ends. If it does not start at zero it could be misleading, and if the scale goes far higher than necessary.

Also check what the vertical axis represent. The results will look quite different if you use absolute frequencies or cumulative frequencies.

In the report I recommend using a ‘Introduce – Show – Tell’ approach. So when reporting this graph, it could be for example like this:

The media often reports that people are getting less often married these days. To investigate this claim Figure 1 shows the results of the marital status in the survey.

*Figure 1. *Results of marital status.

As can be seen Figure 1 almost 50% of the respondents is married and only a few were separated.

Depending on which frequency is used in the bar-chart, the visualization might look quite different. A bar-chart showing cumulative frequencies will for example always go up. To avoid misleading charts some statistical measures, try to describe the data. This will be the topic for the next section.

### Appendix

*Some more notes on bar-charts (click to expand)*

As a guideline for the size of the bar there is a rule of thumb known as the 'three quarter high rule' (Pitts, 1971). It means that the height of the vertical axis should be 3/4 of the length of the horizontal axis. So if the horizontal axis is 20 cm long, the vertical axis should be 3/4 * 20 = 15 cm high.

According to Singh (2009) vertical bars (instead of horizontal bars) are preferred since they are easier on the eye. However if you have long category names some names might become unreadable. A bar chart with the bars placed horizontally might then be preferred. One of the earliest found bar-charts from William Playfair (1786) has the bars placed horizontally. There is an earlier bar chart by Oresme (1486), but that is used more for a theoretical concept, than for descriptive statistics.

*Pie chart (click to expand)*

Most definitions of a pie-chart describe the shape. For example one definition is given as “a graphic display in which a circle is cut into wedges with the area of thee each wedge being proportional tot he percentage of cases in the category represented by that wedge” (Zedeck, 2014, p. 260)

The circle diagram is quite popular and often used, but actually has a few disadvantages: It can only show relative frequencies. To show other frequencies the numbers themselves have to be added. A circle has 360 degrees, equal to 100%. So by multiplying the relative frequencies with 360, the degrees for each category can be found. This means that visually the circle diagram can only show the relative frequencies. Another disadvantage is when the relative frequencies are close to each other, the differences are not easily seen in a circle diagram. When there are many categories the circle diagram will look very busy and not easily to read.

People also have more difficulty with comparing areas and angles (what you do when looking at a pie-chart) than comparing heights (what is done with a bar-chart).

Also often a 3D effect is added, but this actually makes comparisons of the slices even more difficult.

The name 'pie chart' might come from a misspelling of the word Pi. Pi is often associated with a circle. It might also simply come from the resemblances with a pie (as in apple-pie). However Srivastava and Rego (2011) put forward another belief that it is named after a royal French cook Pie, who served dishes in a pie-chart shape.

**Click here to see how to create a pie chart with SPSS, R (Studio), or with Excel.**

**with SPSS**

There are a four different ways to create a pie-chart with SPSS. The end result for each will be the same.

*using Chart builder*

watch the video below, or download the pdf instructions (via bitly, opens in new window/tab).

*using legacy dialogs*

watch the video below, or download the pdf instructions (via bitly, opens in new window/tab).

*using an existing table*

watch the video below, or download the pdf instructions (via bitly, opens in new window/tab).

*using Frequencies*

watch the video below, or download the pdf instructions (via bitly, opens in new window/tab).

**with R**

to be uploaded

**with Excel**

to be uploaded

*Dot plot (click to expand)*

A dot plot is a bar chart where instead of bars a dot is placed for each observation. Note that if the frequencies of a category is very high there might not be enough space to show all the dots. It is therefore adviced to only use this type of diagram if you have a limited number of categories. Another solution might be to let one dot then not represent a single observation but for example 1 dot = 10 respondents, or any other conversion

**Click here to see how to create a dot plot with SPSS, with R, or with Excel.**

**with SPSS**

There are a two different ways to obtain a dot plot with SPSS. The end result for each will be the same.

*using Chart builder*

watch the video below, or download the pdf instructions (via bitly, opens in new window/tab).

*using legacy dialogs*

watch the video below, or download the pdf instructions (via bitly, opens in new window/tab).

**with R**

**with Excel**

*Cleveland dotplot (click to expand)*

A Cleveland dot plot (Cleveland & McGill, 1987) is a bar chart where instead of bars a dot is placed at the center of the top of the bar (and then the bars removed). It is a dot plot only showing the top dot.This requires less ink.

**Click here to see how to create a Cleveland dot plot with SPSS, with R, or with Excel.**

**with SPSS**

There are a two different ways to obtain a Cleveland dot plot with SPSS. The end result for each will be the same.

*using Chart builder*

watch the video below, or download the pdf instructions (via bitly, opens in new window/tab).

*from an existing table*

watch the video below, or download the pdf instructions (via bitly, opens in new window/tab).

**with R**

**with Excel**

**Single nominal variable**

Google adds