Chapter 11. More Types of Graphs

In This Chapter

  • Displaying histograms and area graphs

  • Making use of pie charts and three kinds of boxplots

  • Using dual-axis charts to combine variables with different ranges

SPSS has a number of ways to present data graphically; depending on the characteristics of your data, some graphs are more appropriate than others. Chapter 10 provides an overview of some more common graph types; this chapter discusses some lesser-known ones. Every example in these two chapters is as simple as possible to present a general idea of the types of charts you can choose. To use one with your data, you start by choosing a basic form and then continue by setting options to extend the form so it displays the information in the way that works best for your purposes. The Element Properties window, which appears automatically every time you generate a new chart, provides every possible option that applies to the chart you're building.

Tip

When you use Chart Builder, it's completely safe to drag and drop any variables you want to see in your graph; if the variable won't make sense there, the drop will fail. SPSS does you the kindness of figuring out what will and won't work. Also, no matter what you try to do while building a graph, your data will never be hurt.

Histograms

A histogram represents the number of items that appear within a range of values (or within a bin, statistically speaking — see Chapter 7). You can use a histogram to look at a graphic representation of the frequency distribution of the values of a variable. Histograms are useful for demonstrating the patterns in your data when you want to display information to others rather than discover data patterns for yourself.

Simple histograms

You can use the following steps to create a simple histogram that displays the number of automobiles (in the survey used in the example) that have particular gas mileage capabilities for each of several years:

  1. Choose File

    Simple histograms
    Open
    Simple histograms
    Data and open the
    Cars.sav file, which is in the SPSS installation directory.

  2. Choose Graphs

    Simple histograms
    Chart Builder.

    The Chart Builder dialog box appears.

  3. In the Choose From list, select Histogram.

  4. Drag the first graph diagram (the one with Simple Histogram tooltip) to the panel at the top of the window.

  5. In the Variables list, do the following:

    1. Select the Model Year variable and drag it to the X-Axis rectangle in the panel.

    2. Select Miles Per Gallon and drag it to the Count rectangle on the left side of the panel.

  6. Click the OK button.

    The histogram shown in Figure 11-1 appears.

A histogram displaying the number of cars with various gas mileage values in each year.

Figure 11.1. A histogram displaying the number of cars with various gas mileage values in each year.

The graph in Figure 11-1 looks like a bar chart, but it isn't. The height of each bar does not represent the mean or an average — the height is determined by the largest value.

Tip

The meaning of a graph of this sort is not intuitive; you may want to add a note explaining what it means.

Stacked histograms

You can create a histogram that is more like a bar chart. In a stacked histogram, the overall extent of the bars represents the sum of the values in each category, and different categories of a third variable are indicated by displaying portions of the bars in different colors.

In this type of histogram, the scale on the left can be used to gauge the relative sizes of each of the colored segments of a bar. The overall height of each bar is the sum of the miles per gallon in each model year (as it would be in a bar chart). Here each bar is a stack of rectangles, each one representing a portion of the total number of cars — in this case, cars with a certain number of cylinders. The following steps produce a stacked histogram displaying the same information as shown in the preceding simple histogram, but this one displays sums instead of means:

  1. Choose File

    Stacked histograms
  2. Choose Graphs

    Stacked histograms
    Chart Builder.

  3. In the Choose From list, select Histogram.

  4. Drag the second graph diagram (the one with the Stacked Histogram tooltip) to the panel at the top of the window.

  5. In the Variables list, do the following:

    1. Select the Model Year variable and drag it to the X-Axis rectangle.

    2. Select Miles Per Gallon and drag it to the Count rectangle on the left side of the panel.

    3. Select Number of Cylinders and drag it to the Stack Set Color rectangle, at the upper right.

  6. Click the OK button.

    The histogram shown in Figure 11-2 appears.

A stacked histogram, highlighting the number of cars with specific numbers of cylinders.

Figure 11.2. A stacked histogram, highlighting the number of cars with specific numbers of cylinders.

Frequency polygons

A frequency polygon is a histogram that looks like an area graph (described in the next section) — but it is a histogram, so it works differently. It represents the number of items that appear within a range. The following steps guide you through a procedure that produces a frequency polygon histogram:

  1. Choose File

    Frequency polygons
    Open
    Frequency polygons
    Data and open the
    Cars.sav file.

  2. Choose Graphs

    Frequency polygons
    Chart Builder.

  3. In the Choose From list, select Histogram.

  4. Drag the third graph diagram (the one with the Frequency Polygon tooltip) to the panel at the top of the window.

  5. In the Variables list, do the following:

    1. Select the Model Year variable and drag it to the X-Axis rectangle in the panel.

    2. Select Miles Per Gallon and drag it to the Mean rectangle.

      This is the rectangle that was originally called the Y-Axis.

  6. Click the OK button.

    The histogram shown in Figure 11-3 appears.

A frequency polygon, displaying an increase gas mileage.

Figure 11.3. A frequency polygon, displaying an increase gas mileage.

Population pyramids

A population pyramid provides an immediate comparison of the number of items that fall into categories. It is called a pyramid because it often takes a triangular shape — wide at the bottom and tapering to a point at the top. The following steps can be followed to build an example pyramid histogram chart:

  1. Choose File

    Population pyramids
    Open
    Population pyramids
    Data and open the
    Employee data.sav file, which is in the SPSS installation directory.

  2. Use the tab to switch to Variable View.

  3. Select the Type column of the bdate variable.

  4. Click the button that appears near the variable type name, which is Date.

  5. In the list of date formats, choose mmm yy and then click the OK button.

    This is a matter of personal preference. The chart is produced no matter which format is used to display the dates, but I think this format looks better than most of the others.

  6. Choose Graphs

    Population pyramids
    Chart Builder.

  7. In the Choose From list, select Histogram.

  8. Drag the fourth graph diagram (the one with the Population Pyramid tooltip) to the panel at the top of the window.

  9. In the Variables list, do the following:

    1. Select the Gender variable and drag it to the Split Variable rectangle.

      This is a categorical variable with two possible values, so one category will be placed on each side of the center line.

    2. Select Date of Birth and drag it to the Distribution Variable rectangle.

  10. Click the OK button.

    The chart shown in Figure 11-4 appears.

A population pyramid shows the occurrence of values within categories.

Figure 11.4. A population pyramid shows the occurrence of values within categories.

You can create pyramid histograms based on categorical variables with three, four, or more values. The plot produced will consist of as many pairs as needed (and even a single-sided pyramid for one category, if necessary) to display bars that show the relative number of occurrences of different values in the categories.

Area Graphs

An area graph is really a line graph, or a collection of line graphs, with the areas below the lines filled in to represent the mean of one or more values at the various points.

Simple area graphs

A simple area graph displays the area below a single line. The following steps produce a simple area graph:

  1. Choose File

    Simple area graphs
    Open
    Simple area graphs
    Data and open the
    Employee data.sav file, which is in the SPSS installation directory.

  2. Choose Graphs

    Simple area graphs
    Chart Builder.

  3. In the Choose From list, select Area.

  4. Drag the first graph diagram (the one with the Simple Area tooltip) to the panel at the top of the window.

  5. In the Variables list, do the following:

    1. Select the Educational Level variable and drag it to the X-Axis rectangle.

    2. Select Beginning Salary and drag it to the Count rectangle.

      This is the rectangle that was labeled Y-Axis until the X-Axis became defined.

  6. Click the OK button.

    The area chart shown in Figure 11-5 appears.

An area chart showing the mean starting salary for various levels of education.

Figure 11.5. An area chart showing the mean starting salary for various levels of education.

Stacked area charts

A stacked area chart is a chart with more than one variable being displayed along the X-axis. The values are stacked in such a way that the ups and downs of the lower value in the chart affect the upper values in the chart. That is, the chart is not a group of independent lines; instead, it represents a cumulative total — to which each variable displayed adds a value.

Step 5c of the following procedure can be repeated for the inclusion of two or more variables. They all appear in the legend at the upper right, and each variable provides the value for one layer of the stack.

If you include more than one variable, make sure that the variables you select for stacking have similar ranges of values so the scale on the left side will make sense for all of them. If, for example, one variable ranges into the thousands and the other doesn't go over a hundred, the smaller one will compress itself visually — and come out in the final graph as a line.

Note

When you select multiple variables for stacking, be sure to select them in the order you want them stacked; the first one you select will remain on top. The second one you select will be placed under it, and so on.

Tip

The two types of area charts, simple and stacked, act the same when you construct them. You can select the stacked chart and produce a single-area chart, or you can start with the simple area chart and stack your variables.

Follow these steps to produce a stacked area chart with two stacked variables:

  1. Choose File

    Stacked area charts
  2. Choose Graphs

    Stacked area charts
    Chart Builder.

  3. In the Choose From list, select Area.

  4. Drag the second graph diagram (the one with the Stacked Area tooltip) to the panel at the top of the window.

  5. In the Variables list, do the following:

    1. Select the Educational Level variable and drag it to the X-Axis rectangle.

    2. Select Current Salary and drag it to the Count rectangle.

      This is the rectangle that was originally called the Y-Axis.

    3. Select Beginning Salary and drag it to the plus sign in the Current Salary rectangle.

      Be sure to drag it to the plus sign and not simply to the rectangle in general. (The plus sign appears at the top of the rectangle when you drag the new variable's name across it.)

  6. Click the OK button.

    The area chart shown in Figure 11-6 appears.

A stacked area chart showing one variable being added to another in the display.

Figure 11.6. A stacked area chart showing one variable being added to another in the display.

Pie Charts

Pie charts are the easiest kind to spot — they are the only charts that show up as circles. The purpose of a pie chart is simply to show how something (the "whole") is divided into pieces — whether two, ten, or any other number. Each slice in the pie chart represents its percentage of the whole. For example, if a slice takes up 40 percent of the total pie, that slice represents 40 percent of the total number. A pie chart is also called a polar chart, so SPSS calls this option Pie/Polar.

In the following steps, you construct a simple pie chart:

  1. Choose File

    Pie Charts
    Open
    Pie Charts
    Data and open the
    Employee data.sav file, which is in the SPSS installation directory.

  2. Choose Graphs

    Pie Charts
    Chart Builder.

  3. In the Choose From list, select Pie/Polar.

  4. Drag the pie diagram to the panel at the top of the window.

  5. In the Variables list, drag Educational Level to the Slice By rectangle at the bottom of the panel.

  6. Click the OK button.

    The pie chart shown in Figure 11-7 appears.

A pie chart displaying the number of employees at each education level.

Figure 11.7. A pie chart displaying the number of employees at each education level.

Boxplots

A boxplot uses graphic elements to display five statistics at one time within each categorical value. The statistics are the minimum value, first quartile, median value, third quartile, and maximum value. A boxplot is particularly good for helping you spot values lying well outside the range of normal values.

Simple boxplots

A simple boxplot displays the range of values of a single scale variable for all values of a categorical variable. The following steps guide you through the creation of a simple boxplot:

  1. Choose File

    Simple boxplots
    Open
    Simple boxplots
    Data and open the
    Employee data.sav file, which is in the SPSS installation directory.

  2. Choose Graphs

    Simple boxplots
    Chart Builder.

  3. In the Choose From list, select Boxplot.

  4. Drag the first graph diagram (the one with the Simple Boxplot tooltip) to the panel at the top of the window.

  5. In the Variables list, do the following:

    1. Select the Educational Level variable and drag it to the X-Axis rectangle.

    2. Select the Current Salary variable and drag it to the Y-Axis rectangle.

  6. Click the OK button.

    The boxplot shown in Figure 11-8 appears.

A boxplot displaying the range of values for each value of a categorical variable.

Figure 11.8. A boxplot displaying the range of values for each value of a categorical variable.

In Figure 11-8, each vertical column of graphics represents all the values for a category. Values beyond the extents of the first and third quartiles are marked with circles or stars; those marked with stars represent extremes. You can look at a boxplot of this type to find where your data may be out of whack.

Clustered boxplots

A clustered boxplot displays the values of three variables in one graph. A boxplot displays a lot of information — and if it's displaying three variables, it can get very busy visually. Fortunately, it's easier to read on-screen in color than it is here on this page in shades of gray. The legend in the upper-right corner assigns colors to the categorical values; those colors appear in the boxes to show you which is which. You're also shown the ID numbers of cases with extreme values. Use the following steps to construct a clustered boxplot:

  1. Choose File

    Clustered boxplots
    Open
    Clustered boxplots
    Data and open the
    Employee data.sav file.

  2. Choose Graphs

    Clustered boxplots
    Chart Builder.

  3. In the Choose From list, select Boxplot.

  4. Drag the second graph diagram (the one with the Clustered Boxplot tooltip) to the panel at the top of the window.

  5. In the Variables list, do the following:

    1. Drag the Minority Classification variable to the X-Axis rectangle.

    2. Drag the Current Salary variable to the Y-Axis rectangle.

    3. Drag the Educational Level variable to the Cluster on X rectangle.

  6. Click the OK button.

    The boxplot shown in Figure 11-9 appears.

A clustered boxplot displaying the values of three variables.

Figure 11.9. A clustered boxplot displaying the values of three variables.

One-dimensional boxplots

A one-dimensional boxplot displays one variable in such a way that you can easily see the range of values and spot out-of-range values. The following steps construct an example of a one-dimensional boxplot:

  1. Choose File

    One-dimensional boxplots
    Open
    One-dimensional boxplots
    Data and open the
    Employee data.sav file.

  2. Choose Graphs

    One-dimensional boxplots
    Chart Builder.

  3. In the Choose From list, select Boxplot.

  4. Drag the third graph diagram (the one with the 1-D Boxplot tooltip) to the panel at the top of the window.

  5. Click the Groups/Point ID tab and select the Point To ID Label option.

    A rectangle labeled Point Label Variable appears in the upper-right corner of the preview panel at the top.

  6. In the Variables list, do the following:

    1. Drag the Employee Code variable to the Point Label rectangle in the upper-right of the panel.

    2. Drag the Current Salary variable to the X-Axis rectangle, on the left side of the panel.

  7. Click the OK button.

    The boxplot shown in Figure 11-10 appears.

A one-dimensional boxplot showing extreme values of a variable.

Figure 11.10. A one-dimensional boxplot showing extreme values of a variable.

The boxplot in Figure 11-10 graphically displays values out of the normal range. Each value is tagged with the ID number of its case. The number displayed as the ID is the variable previously chosen as the point ID. If no point ID variable had been chosen, the annotation would show the normal SPSS case numbers.

High-Low Graphs

A high-low chart displays the range of values between specified high and low values. Its purpose is to compare two or three variables.

High-low-close graphs

The high-low-close graph shows how a variable appears when plotted between a high value and a low value. The graph displays the relationships among three sets of values. This example and the one that follows (the simple-range bar graph) display the same information, but with a different look to the graphics. This graph displays the range as a vertical line, and the other graph shows it as a bar.

Follow these steps to create a high-low-close graph:

  1. Choose File

    High-low-close graphs
    Open
    High-low-close graphs
    Data and open the file named
    Home sales [by neighborhood].sav, which is in the SPSS installation directory.

  2. Choose Graphs

    High-low-close graphs
    Chart Builder.

  3. In the Choose From list, select High-Low.

  4. Drag the first graph diagram (the one with the High-Low-Close tooltip) to the panel at the top of the window.

  5. In the Variables list, do the following:

    1. Drag the Total Appraised Value variable to the High Variable rectangle at the top on the left.

    2. Drag the Appraised Land Value variable to the Low Variable rectangle at the center left.

    3. Drag the Sale Price variable to the Close Variable rectangle at the bottom on the left.

    4. Drag the Neighborhood variable to the X-Axis rectangle.

  6. Click the OK button.

    The high-low graph shown in Figure 11-11 appears.

A high-low-close graph, displaying a variable that curves out of its high and low limits.

Figure 11.11. A high-low-close graph, displaying a variable that curves out of its high and low limits.

Simple range bar graphs

The simple range bar graph shows how a variable appears when plotted between high and low values. That is, it displays the relationships among three sets of values. This example and the one before it display the same information, but with a different appearance to the graphics. This graph displays the upper and lower range as a vertical bar.

Do the following to build a simple range bar graph:

  1. Choose File

    Simple range bar graphs
    Open
    Simple range bar graphs
    Data and open the file named
    Home sales [by neighborhood].sav, which is in the SPSS installation directory.

  2. Choose Graphs

    Simple range bar graphs
    Chart Builder.

  3. In the Choose From list, select High-Low.

  4. Drag the second graph diagram (the one with the Simple Range Bar tooltip) to the panel at the top of the window.

  5. In the Variables list, do the following:

    1. Drag the Total Appraised Value variable to the High Variable rectangle at the top on the left.

    2. Drag the Appraised Land Value variable to the Low Variable rectangle at the center left.

    3. Drag the Sale Price variable to the Close Variable rectangle at the bottom on the left.

    4. Drag the Neighborhood variable to the X-Axis rectangle.

  6. Click the OK button.

    The high-low range bar graph shown in Figure 11-12 appears.

A high-low range bar graph, displaying a variable that curves out of its high and low limits.

Figure 11.12. A high-low range bar graph, displaying a variable that curves out of its high and low limits.

Clustered range bar graphs

The clustered range bar graph displays the relationship among five variables. No other chart can be used to so clearly display so many variables. This example demonstrates the relationships among five employee variables: years of employment, income ranges, years with employer, ages, and the years they've lived at their current addresses.

Do the following to build a clustered range bar graph:

  1. Choose File

    Clustered range bar graphs
    Open
    Clustered range bar graphs
    Data and open the file named
    demo.sav, which is in the SPSS installation directory.

  2. Choose Graphs

    Clustered range bar graphs
    Chart Builder.

  3. In the Choose From list, select High-Low.

  4. Drag the third graph diagram (the one with the Clustered Range Bar tooltip) to the panel at the top of the window.

  5. In the Variables list, do the following:

    1. Drag the category Years With Current Employer[empcat] variable to the Cluster on X rectangle in the upper-right corner.

    2. Drag the Income Category variable to the X-Axis rectangle at bottom.

    3. Drag the Age In Years variable to the High Variable rectangle at top left.

    4. Drag the measure Years With Current Employer[employ] variable to the Low Variable rectangle at center left.

    5. Drag the Years At Current Address variable to the Close Variable rectangle at bottom left.

  6. Click the OK button.

    The high-low graph shown in Figure 11-13 appears.

A clustered range bar graph, displaying relationships among five variables.

Figure 11.13. A clustered range bar graph, displaying relationships among five variables.

Differenced area graphs

A differenced area graph provides a pair of line graphs that emphasize the difference between two variables filling the area between them with a solid color. The two graphs are plotted against the points of a categorical variable. The following steps produce a differenced area graph:

  1. Choose File

    Differenced area graphs
    Open
    Differenced area graphs
    Data and open the
    Home sales [by neighborhood].sav file, which is in the SPSS installation directory.

  2. Choose Graphs

    Differenced area graphs
    Chart Builder.

  3. In the Choose From list, select High-Low.

  4. Drag the fourth graph diagram (the one with the Differenced Area tooltip) to the panel at the top of the window.

  5. In the Variables list, do the following:

    1. Drag the Neighborhood variable to the X-Axis rectangle.

    2. Drag the Sale Price variable to either of the Y-Axis rectangles.

    3. Drag the Appraised Value of Improvements variable to the other Y-Axis rectangle.

  6. Click the OK button.

    The differenced area chart shown in Figure 11-14 appears.

In a differenced area chart, the filled region emphasizes the difference between two values.

Figure 11.14. In a differenced area chart, the filled region emphasizes the difference between two values.

Dual-Axis Graphs

Many of the graphic forms allow you to plot two or more variables on the same chart, but they must always be plotted against the same scale. In the dual-axis graph, two variables are plotted — and two different scales are used to plot them. As a result, the values don't require the same ranges (as they do in the other plots); the curves and trends of the two variables can be easily compared, even though they're on different scales.

Dual Y-axes with categorical X-axis

Two variables with different ranges that vary across the same set of categories can be plotted together, as shown in the following example:

  1. Choose File

    Dual Y-axes with categorical X-axis
    Open
    Dual Y-axes with categorical X-axis
    Data and open the
    Cars.sav file, which is in the SPSS installation directory.

  2. Choose Graphs

    Dual Y-axes with categorical X-axis
    Chart Builder.

  3. In the Choose From list, select Dual Axes.

  4. Drag the first diagram (the one with the Dual Y Axes With Categorical X Axis tooltip) to the panel at the top of the window.

  5. In the Variables list, do the following:

    1. Drag the Horsepower variable to the Y-Axis rectangle on the left.

    2. Drag the Miles Per Gallon variable to the Y-Axis rectangle on the right, which is now named Count.

    3. Drag the Number of Cylinders variable to the X-Axis rectangle.

  6. Click the OK button.

    The dual-axis graph shown in Figure 11-15 appears.

A dual-axis graph displaying the curves inscribed by two variables with different ranges.

Figure 11.15. A dual-axis graph displaying the curves inscribed by two variables with different ranges.

Dual Y-axes with scale X-axis

If you don't mind a little complexity, two variables with different ranges that vary according to changes in another value laid out along a third scale can be plotted together, as shown in the following example:

  1. Choose File

    Dual Y-axes with scale X-axis
  2. Choose Graphs

    Dual Y-axes with scale X-axis
    Chart Builder.

  3. In the Choose From list, select Dual Axes.

  4. Drag the second graph diagram (the one with the Dual Y Axes With Scale X Axis) to the panel at the top of the window.

  5. In the Variables list, do the following:

    1. Drag the Miles Per Gallon variable to the Y-Axis rectangle on the left.

    2. Drag the Engine Displacement variable to the Y-Axis rectangle on the right.

    3. Drag the Time to Accelerate 0 to 60 variable to the X-Axis rectangle.

  6. Click the OK button.

    The dual-axis chart shown in Figure 11-16 appears.

A dual-axis graph displaying two variables with different ranges against a scale variable.

Figure 11.16. A dual-axis graph displaying two variables with different ranges against a scale variable.

The graph displayed in Figure 11-16 is a combination of two dot-plot formats, with the dots in different colors. Even on a color screen, the two sets of values — each set plotted on a different Y-axis scale — can be confusing. With this type of plot, you must take care that your data makes sense being displayed this way.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.223.171.51