SPSS Tutorial: How to Draw a Line Chart with Error
1. Questions and data
The researchers wanted to study the relationship between the duration of sitting and blood cholesterol levels among healthy men aged 45-65, so they recruited 100 subjects and asked them about the duration of sitting (time) every day, and tested their blood cholesterol levels (cholesterol). Some of the data are as follows: figure 1. How can researchers plot the relationship between the two?
Figure 1 Part of the data
2. Analysis of the problem
A researcher would like to plot changes in blood cholesterol levels (continuous variable) as a function of sitting time (three categorical variables: "2-4 hours", "4-6 hours" and "6-8 hours") in healthy middle-aged men. They can Use a simple line chart .
A simple line chart can show the trend of the dependent variable changing with the independent variables, where the dependent variable is a continuous variable, and the independent variables are generally continuous or ordered multi-categorical variables.
3. SPSS operation
3.1 Simple line chart
Click Graphs→Chart Builder on the main interface and select Line in the Choose from box in the lower left corner, as shown in Figure 2.
Figure 2 Chart Builder
After selecting Line, 2 options will be displayed on the right side of it. Drag the first graph to the upper preview pane (if you hover the mouse over the graph, Simple Line will be prompted, that is, a simple line graph). Figure 3.
Figure 3 Drag Simple Line to the preview window
Drag the variable cholesterol from the Variables: box to the "Y-Axis?" box and the variable time to the "X-Axis?" box. As shown in Figure 4.
Figure 4 Drag the variable to Simple Line
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.
3.2 Set error bars
In the Element Properties dialog box, Line1 in the Edit Properties of. box is checked by default, Display error bars is checked, and the Error Bars Represent area is activated. Check Confidence intervals and set Level (%) to 95, as shown in Figure 5.
图5 Display error bars
3.3 Change the axis properties
If you need to change the Y-axis properties, you can select "Y-Axis (Line1)" 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).
When drawing a simple line chart, researchers may need to change the scale properties of the continuous variable (that is, the dependent variable on the Y-axis). Therefore, you can uncheck the Minimum option in the Scale Range area, and then the custom value (Custom) is highlighted and the default value is 0. In this example, change the custom value to 4. As shown in Figure 7.
Figure 7 Change Y-axis properties: change Minimum
If you need to change the X-axis properties, select "X-Axis (Line1) in the Edit Properties box, change the axis label (Axis Label box), change the sorting of the X-axis variables (in the Categories box: Sort by, Direction or Order box Use the up and down arrows to adjust). As shown in Figure 8.
Figure 8 Changing X-axis properties
After all settings are completed, click OK.
4. Drawing results
Figure 9 is the final simple line chart generated .
Figure 9 Simple line chart