SPSS tutorial: teach you step by step how to draw a clustered bar chart

SPSS tutorial: teach you step by step how to draw a clustered bar chart

1. Questions and data

A researcher planned to analyze the impact of education level and gender on happiness index and recruited 58 research subjects, including 28 men and 30 women. In each category of gender, the educational level of the research subjects was divided into three categories (high school and below, undergraduate and master's degree and above).

The researcher used a questionnaire to measure the happiness index of the research subjects . The scores of the research subjects were distributed between 0 and 100. The higher the score, the stronger the happiness index. Finally, variable information such as happiness index (Index), gender (gender) and education level (education) of the research subjects were collected. Part of the data is shown in Figure 1. For this data, how to plot the data characteristics? 

 

Figure 1 Part of the data

2. Analysis of the problem

If researchers want to graphically display the mean values ​​of happiness index (continuous variable) in different categories under two categories (education level, gender), they can use clustered bar charts .

Clustered bar charts can visually present a variety of statistical tests or data characteristics. They are usually suitable for the following situations : displaying counts, frequencies, percentages, means, medians and other statistical indicators of continuous variables or ordered categorical variables under different categories. . There are two categorical variables, which can be binary classification, ordered multi-classification or unordered multi-classification.

For example, compare the number of purchases of different brands of ice cream (unordered multi-categorical variables) by customers in different dining places (binary variables: Chinese restaurants and Western restaurants); describe the use of different mobile phone brands (unordered multi-categorical variables: Huawei, Apple , Xiaomi, OPPO) and operators (unordered multi-category variables: China Mobile, China Unicom and Telecom), users’ satisfaction with mobile phone signals (ordered multi-category variables: very satisfied, relatively satisfied, average, relatively dissatisfied and very dissatisfied).

3. SPSS operation

3.1 Clustered bar chart

Click Graphs→Chart Builder on the main interface and select Bar in the Choose from box in the lower left corner, as shown in Figure 2.

 

Figure 2 Chart Builder

After selecting Bar, 8 different bar chart options are displayed on the right side. Drag the second chart in row 1 to the preview pane above (if you hover the mouse over the chart, you will be prompted for Clustered bar, that is, clustered bar graph). Figure 3.

 

Figure 3 Drag the Clustered Bar to the preview window

Drag the variable education from the Variables: box to the "X-Axis?" box, the variable Index to the "Y-Axis?" box, and the variable gender into the "Cluster on X: set color" box. As shown in Figure 4.

 

Figure 4 Drag and drop variables to the Clustered Bar

What needs to be noted here is that although the graph in the preview pane changes when you add a variable, it does not accurately plot based on the data, so don't question yourself for making a mistake, in the end the correct bar chart will be displayed based on the real data. Additionally, the variables for "X-Axis?" and "Cluster on X:set color" are interchangeable. Here we show the differences in happiness index between different gender groups with different education levels.

If you want to show the difference in happiness index between different genders and people with different education levels, drag gender to the "X-Axis?" box and education to the "Cluster on X: set color" box.

3.2 Set error bars

In the Element Properties dialog box, when the Edit Properties of. box selects Bar1 by default, check Display error bars to activate the Error Bars Represent area. Check Confidence intervals and set Level (%) to 95. Figure 5. Checking error bars is not required for Clustered Bar, but it is commonly shown in academic papers.

 

图5 Display error bars

 

3.3 Change the axis properties

If you need to change the Y-axis properties, you can select "Y-Axis (Bar1)" in the Edit Properties of. box, as shown in Figure 6.

Figure 6 Changing Y-axis properties

You can then change the axis label (Axis Label box) or change the axis properties (Scale Range area).

Take changing the minimum value of the Y axis as an example. Uncheck the Minimum option in the Scale Range area, then the custom value (Custom) is highlighted and the default value is 0, as shown in Figure 7.

 

Figure 7 Change Y-axis properties: change Minimum

This step is to display the reasonable numerical range of the Y-axis variable, so the displayed value changes with the data and needs to be adjusted by the researcher. If you cannot confirm the specific values ​​yet, please do not change these values ​​yet and check the resulting bar chart. If necessary, reset the values ​​to generate the bar graph again.

If you need to change the X-axis properties, you can select "X-Axis (Bar1)" in the Edit Properties of. box, change the axis label (Axis Label box), and change the sorting of the X-axis variables (in the Categories box: Sort by, Use the up and down arrows in the Direction or Order box to adjust). As shown in Figure 8.

 

Figure 8 Changing X-axis properties

If you want to change the properties of the variable (gender in this case) in the "Cluster on X: set color" box, you can select "GroupColor (Bar1)" in the Edit Properties of. box and follow the same steps as changing the X-axis properties Just do it. As shown in Figure 9.

 

Figure 9 Changing the variable attributes in the "Cluster on X: set color" box

After all settings are completed, click OK.

4. Drawing results

Figure 10 is the resulting clustered bar chart.

 

Guess you like

Origin blog.csdn.net/m0_72494332/article/details/132737383