Download presentation
1
Biostatistics I using SPSS
The Master of Science in Clinical Investigation Program Vanderbilt University Medical Center Date: September 13, 2005 Instructor: Ayumi Shintani, Ph.D., M.P.H. Department of Biostatistics, Vanderbilt University
2
Graphical Display of Data Part 1
Overview: 3.1 Categorical 3.2 Continuous 3.2.1 Histograms 3.2.2 Stem-&-Leaf Plots 3.2.3 Boxplots 3.2.4 Dotplots 3.2.5 Error bar charts 3.2.6 Error bar charts with lines Pie-charts
3
Graphical Display of Data Part 2
Overview: 3.2.8 Simple Scatterplot Labeling points Identifying different groups for scatterplot Representing Multiple Points 3.2.9 Scatterplot Matrix Addling lines into scatter plots Overlay plot with Loess Smoothers Three-dimentional Scatterplot
4
Graphs are pictorial representations of numerical data:
“A picture is worth a thousand t-tests.” Graphical displays should: Easily convey characteristics of the data. Present many numbers in a small space. Make large datasets coherent. Encourage the eye to compare different sections of data. Be closely integrated with the statistical and verbal descriptions of the dataset. Be clearly labeled for easy understanding.
5
Mean log dose of sedative and analgesic medications administered during 24-hour period prior to cognitive assessment * 24-hour Transition N Lorazepam dose +/- SD Fentanyl dose +/- SD Morphine dose +/- SD Propofol dose +/- SD Normal to Normal 97 0.2±4.0 0.1±2.7 0.2±5.7 0.0 Normal to Delirium 17 0.5±7.3 0.1±1.5 0.1±3.1 0.2±9.2 Normal to Coma 3 6.3±1.3 0.4±9.5 0.3±5.8 Delirium to Normal 62 0.2±4.3 0.2±5.8 Delirium to Delirium 197 0.5±8.4 0.2±4.5 0.3±10.5 0.1±5.5 Delirium to Coma 51 1.3±9.1 0.4±7.3 0.5±13.8 Coma to Normal 13 0.6±7.2 0.1±2.8 0.2±18.0 Coma to Delirium 89 0.7±10.4 0.3±11.7 0.1±4.0 Coma to Coma 167 1.4±14.2 0.4±7.4 0.4±11.5 0.2±12.6 Total 696
6
Mean Lorazepam Dose (mg) in 24 hours
30 20 Mean Lorazepam Dose (mg) in 24 hours 10 Current Cognitive Status C D N C D N C D N Coma (C) Delirium (D) Normal (N) Previous Cognitive Status Error Bars show 95.0% Cl of Mean
7
3.1 Graphical Display of Categorical Data
In medical papers, categorical data are very rarely graphically displayed. However, for posters, such graphical displays are typically more eye-catching than a table. A histogram graphically displays the frequency distribution of categorical and continuous data. For categorical data, also called bar diagram, bar chart, or bar graph. The x-axis denotes each value of the categorical variable. A vertical bar is drawn for each category. The bar can denote: Frequency (number of observations having that categorical value). Fraction (proportion of total observations having that categorical value). Cumulative Frequency (each bar represents a total number of patients who falls in the category or categories in lower orders. ) Mean (or other summary measures) of other variable for the category
8
How to obtain Histogram in SPSS using Graph Option (1)
In SPSS, open Rothman.sav then go to Graphs (no interactive), Bar Charts, Select Simple
9
How to obtain Histogram in SPSS using Graph Option (2):
Frequency Frequency distribution is defined when each bar shows the number of observations having that categorical value.
10
SPSS screen shot: Frequency
11
How to obtain Histogram in SPSS using Graph Option (3):
Fraction Fraction is defined when each bar represents proportion of total observations having that categorical value.
12
SPSS screen shot: Fraction
13
How to obtain Histogram in SPSS using Graph Option (4):
Cumulative Frequency Cumulative frequency is defined where each bar represents a total number of patients who falls in the category or categories in lower orders.
14
Cumulative Frequency
15
How to obtain Histogram in SPSS using Graph Option (5):
Group Means Each bar represents mean of another variable (continuous) for the category
16
Group Means
17
How to obtain Histogram in SPSS using Interactive Graph Option (1):
Group Means Bars show counts 60 40 Count 20 n=34 n=42 n=65 n=39 n=12 8th degree or less High School Grad College Grad or above Some High School Some College Education
18
Frequency using Interactive Graph Option
Using Interactive graphics: In SPSS, go to: Graphs, Interactive, Bar, … Frequency using Interactive Graph Option
19
How to obtain Histogram in SPSS using Interactive Graph Option (2):
Group Means with Error Bars 8th degree or less Some High School High School Grad Some College College Grad or above Education 0.0 4.0 8.0 12.0 Baseline HbA1c n=34 n=42 n=65 n=39 n=12 Note: I don’t personally recommend this type of graphs.
20
Group Means with Error Bars (1)
Using Interactive graphics: In SPSS, go to: Graphs, Interactive, Bar, … Group Means with Error Bars (1)
21
Group Means with Error Bars (2)
22
3.2 Graphical Displays of Continuous Data
Histograms Displays frequency distribution for continuous data. However, in contrast to categorical data, continuous data need to be grouped, and the # of groups must be chosen, which is subjective.
23
How to obtain Histogram Continuous Data Histogram using Interactive Graph Option (1): Frequency Distribution
24
Frequency Distribution for Continuous Data (1)
In SPSS, read Rothman.sav, go to: Graphs, Interactive Histogram Frequency Distribution for Continuous Data (1)
25
Frequency Distribution for Continuous Data (2)
26
What kinds of things should I look for in a histogram?
Look for cases with values very different from the rest. Look whether distribution is symmetric (normality). Look for separate clusters of data values. For example, you may see a two clusters, i.e., peaks. One peak may be from male patients, and the other may from female. In such situation, you may want to analyze the data separately for males and females.
27
Editing Histogram (1): Adding normality curve
28
Adding Normal Curve to Histogram
In SPSS, read Rothman.sav, go to: Graphs, Interactive Select Histogram Click on Histogram dialog box Adding Normal Curve to Histogram
29
Editing bin size on histogram (1)
In SPSS, after you create a histogram using interactive graphs, double click on the figure and open Chart Editor. Click Interval Tool.
30
Editing bin size on histogram (2)
NOTE: Without specification, SPSS automatically determines the number of groups (bins).
31
What will happen if you use smaller number of bins?
Which histogram do you find more useful?
32
Whenever you are interested in comparing continuous variable between
Now, consider histograms of age stratified by study arms: Important : Whenever you are interested in comparing continuous variable between groups, you must look at data separately for groups.
33
Histogram of Age Stratified by Status
34
The stem consists of all but the rightmost digits of the data.
Stem-&-Leaf Plots A useful way of tabulating the original data and, at the same time, depicting the general shape of the frequency distribution. The stem consists of all but the rightmost digits of the data. The leaf represents the leftmost digits. A stem-and-leaf plot, like a histogram, shows how many cases have various data values. A stem-and-lead plot preserved more information than a histogram because it does not use the same symbol to represent all cases. Instead, the symboldepents on the actual value for a case. age (yrs) Stem-and-Leaf Plot Frequency Stem & Leaf 2.00 Extremes (=<21) 1.00 Extremes (>=87) Stem width: Each leaf: case(s) Question: What are exact values of age 20 years or older and less than 30 years old?
35
In SPSS, go to: Analyze, Descriptive Statistics, Explore
Stem-&-leaf plot of patient’s age.
36
3.2.3 Box Plots / Box-and-Whisker plot
A graphical summary for continuous data using percentiles Bar charts and histograms are convenient for displaying summary information about data, but they provide very little information about anything other than the values of the measure. Box-plots are popularly used to summarize data, which simultaneously displays the median, the inter-quartile range, and the smallest and largest values of data. A useful application of box plots is to graphically compare the distribution of a continuous measure across different levels of a categorical variable.
37
“Whiskers’ extend to largest
and smallest observed values within 1.5-box lengths 75th percentile 50th percentile / median 25th percentile How do you interpret these box plots?
38
Extreme values: defined by observed value
More than 3 box-lengths from upper (75th) or lower (25th) value. 1.5 Boxes 3 Boxes Outliers: defined by observed value More than 1.5-box and less than 3-box lengths from upper (75th) or lower (25th) value.
39
How to obtain Box-plot using SPSS (1):
40
Then click Boxes to go to the next page.
How to obtain Box-plot using SPSS (2): Then click Boxes to go to the next page.
41
How to obtain Box-plot using SPSS (3):
42
What can you tell from box-plot?
From the median, you can get an idea of the typical value (central tendency) From the length of the box, you can see how much the values vary (data dispersion) If the median line is not in the center of the box, you can tell that distribution of your data blues is no symmetric. If the median is closer to the bottom of the box than to the top, there is a tail toward large values (positive skewness). If the median is closer to the top of the box than to the bottom, there is a tail toward smaller values (negative skewness)..
43
Let’s compare box-plot with other methods.
Using histogram
44
Using bar-chart for mean of 12 month HbA1c
Let’s discuss pros and cons of each method of graphics.
45
Checking for Normality of Data in SPSS
How do we know if data are normally distributed? SPSS has a nice features for testing and visual diagnosis for normality. In SPSS, open Rothman.sav and go to: Analyze, Descriptive Statistics, Explore put ranChisq and ranNorm into dependent list box Click on Plots, In Plots dialog box, select Normality plots with tests
46
Checking Normality (1)
47
Checking Normality (2)
48
Checking Normality (3)
49
SPSS Output from Explore : Skewed Data (1)
ranChisq Stem-and-Leaf Plot Frequency Stem & Leaf & & & & & 12.00 Extremes (>=2.5) Stem width: Each leaf: case(s) & denotes fractional leaves.
50
SPSS Output from Explore : Skewed Data (2)
51
SPSS Output from Explore : Skewed Data (3)
Formal Statistical Test for Normality Tests of Normality for RanChisq .214 193 .000 .729 ranChisq Statistic df Sig. Kolmogorov-Smirnov a Shapiro-Wilk Lilliefors Significance Correction a.
52
SPSS Output from Explore : Normally Distributed Data (1)
ranNorm Stem-and-Leaf Plot Frequency Stem & Leaf Stem width: Each leaf: case(s) Tests of Normality for ranNorm .040 193 .200 * .993 .440 ranNorm Statistic df Sig. Kolmogorov-Smirnov a Shapiro-Wilk This is a lower bound of the true significance. *. Lilliefors Significance Correction a.
53
SPSS Output from Explore : Normally Distributed Data (2)
54
Data transformation to achieve normality
Many types of laboratory data, specifically data in the form of concentrations of one substance, length of duration can be expressed with a skewed distribution. Transformation, such as taking logarithmic some times make these skewed variables to normally (Gaussian) distributed. In SPSS, use Transform, Compute dialog box to transform baseline Hba1c value Into log(e) scale. Then compare distributions of un-transformed and transformed data.
55
Dotplots Similar to a stem-&-leaf plot (or a histogram displayed vertically), but data expressed using dots. Similar to box plots, dotplots are useful for comparing distributions of a continuous measure across different levels of a categorical variable.
56
Dotplots of 12 month HbA1c stratified by Study arm and insulin use:
57
How to obtain dot plot in SPSS (1)
58
How to obtain dot plot in SPSS (2)
59
Error Bar Chart
60
How to obtain Error Bar Chart in SPSS (1)
Read Rothman.sav into SPSS, then go to: Graphs, Interactive, Error bar..
61
How to obtain Error Bar Chart in SPSS (2)
Select a set of Ha1c as Y-axis variable Select Status as X-axis variable Click on Error bars, select Display error bars, OK
62
3.2.6. Error bar chart with line:
63
How to obtain Error Bar Chart with Line in SPSS (1)
64
How to obtain Error Bar Chart with Line in SPSS (2)
65
How to obtain Error Bar Chart with Line in SPSS (3)
66
How to obtain Error Bar Chart with Line in SPSS (4)
67
How to obtain Error Bar Chart with Line in SPSS (5)
68
Editing Error Bar Chart with Lines: Editing Connecting lines (1)
Double click on the error bar chart to open Chart Editor. In Chart Editor, click on the object you want to edit, Here we want to edit Lines, so click on lines. Change Dot and Line size. Click on error bar, in error bar dialog box, click on width to fix the gap between Connecting lines and error bars. Move the cursor for cluster to 10%.
69
Editing Error Bar Chart with Lines: Editing Connecting lines (2)
71
Never use Pie charts. Which category (from 1 to 7) do you think the largest?
72
Redoing the previous page graph pie chart using bar-charts and line chart.
In SPSS, go to: Graphs, Interactive, Bar,
73
Creating a bar graph directly from each data point.
74
Redoing the previous page graph pie chart using line chart.
75
Creating a line graph directly from each data point.
In SPSS, go to: Graphs, Interactive, Bar,
76
Scatterplots One of the best ways to look for relationships and patterns among multiple continuous variables. In previous lecture, you’ve used a variety of graphical displays to summarize single variable. In this lecture, we will learn how to display the values or two variables in meaningful scale. Circles point represents ID=216 Baseline HbA1c=21.1% 12month HbA1c=13.5% Each point represents a pair of values. One variable is represented by the x-axis and the other by the y-axis.
77
How to obtain the scatter plot in SPSS (1)
Read Rothman.sav into SPSS To produce a scatterplot of 12 months HbA1c by baseline HbA1c, from the menus choose: Graphs, Scatter/Dot...{uses non-interactive mode this time} Select simple scatter plot Click Define.
78
How to obtain the scatter plot in SPSS (1)
79
What can you tell from the scatterplot?
Scatterplots are not randomly scattered over the grid. There seems to be a pattern. The points are concentrated in a bottom left to top right, indicating as baseline HbA1c value increases, 12 month value increases. That is, a straight line might be a reasonable summary of the data. You can also determine whether these are cases that have unusual combinations of values for the two variables. You may want to validate the observations on ID=216, is it clinically real to have Baseline HbA1c=21.1% with 12month HbA1c=13.5%.
80
Labeling the Points
81
How to label a point in a scatter plot (1)
In order to add a label for the observed value on the next page, In Simple Scatterplot dialog box, Select 12 Month HbA1c as the y variable and Baseline HbA1c as the x variable. Additionally, set ID under “case labeled by”. Click OK.
82
How to label a point in a scatter plot (2)
Double click on the scatterplot to open Chart Editor. In Chart Editor, click on then click on the point value you want to show ID number.
83
3.2.8.2. Identifying different groups for scatterplot.
84
How to identify different groups for scatterplot
To identify points by study arm, select STATUS for Set Markers by, as shown below.
85
3.2.8.3. Representing Multiple Points
86
How to represent multiple points in scatter plot.
In the Chart Editor, double-click on any point in the figure. In the Properties dialog box, click the Point Bins tab. Under Display At, select Bins. Under Count Indicator, select Marker Size.
87
Scatterplot Matrices. So far, we have looked a the relationship between two variables. What if you want to see how these variables to relate to another variable. A scatterplot matric is a display that contains scatterplots for all possible pairs of variables. Is there any way to help understand relationship between two variables?
88
How to obtain scatterplot matrices.
90
3.2.9.1. Adding Lowess smother to scatterplot
91
How to add Lowess smother to scatterplot (1)
Read Rothman.sav into SPSS Follow the instruction for scatterplots, After you create scatterplot matrices * activate the graph by double-clicking on it. * Highlight all points in the Chart Editor. * Click the Add fit line tool, click on fit line, then chose LOESS with % of points to fit =50
92
How to add Lowess smother to scatterplot (2)
93
A scatteplot matrix of 12 month HbA1c, 12 month systolic blood pressure, age, baseline BMI has the same number of rows and columns as there are variables. In this example, you see 5 row and 5 columns. Each cell of the matrix, except for cells on the diagonal is a plot of a pair of variables. What’s the easiest way to read a scatterplot matrix? Try to scan across an entire row or column. For example, in the previous page Figure, you will see that 12 month HbA1c value correlate to 6 month value but not much with baseline value. Plots symmetric along diagonal line is in fact the same plots, so you may want to ignore one of the plots.
94
Overlay Plots Un-interactive option does not work well for this, so use interactive graphs.
95
How to overlay 2 scatter plots (1)
In SPSS, go to, Graph, Interactive, Scatter… In Scatterplot dialog box, Open “Fit” dialog box by clicking the menu Enter 5 into each bandwidths Choose Subgroup under “Fit lines for”
96
How to overlay 2 scatter plots (2)
97
3.2.10. Three dimensional Scatter Plots
Un-interactive option does not work well for this, so use interactive graphs.
98
How to create three dimensional scatter plots
In SPSS, go to, Graph, Interactive, Scatter… In Scatterplot dialog box, Select, 3-D coordinate, which will give you an option to add the third coordinate
99
Compare the figures below
Compare the figures below. You may realize that it is very hard to understand relationship between variables from the 3 dimensional figure, You may rather want to show each pair wise relationship to describe the dynamic relationship. I recommend “never” use 3 dimensional graphs. Use scatter plot matrices instead.
100
Example from a real practice: (Before paper revision)
The prevalence of coronary-artery calcification among patients with rheumatoid arthritis and control subjects, according to age. >=60 years < 50 years 50-59 years 90 90 25/29 90 29/35 80 80 80 14/19 70 70 70 60 19/33 60 60 16/30 8/16 50 50 Percentage 50 12/25 Percentage 9/21 Percentage 8/19 8/21 40 40 12/30 9/25 40 5/16 6/19 30 30 30 5/19 8/33 4/21 3/16 6/33 20 20 5/35 4/29 3/19 20 4/25 2/19 10 10 2/30 10 1/35 0/29 Control subjects Early RA Established RA Control subjects Control subjects Early RA Established RA Early RA Established RA Agatston score = 0 Agatston score = 1-109 Agatston score >109
101
Example from a real practice: (After paper revision)
The prevalence of coronary-artery calcification among patients with rheumatoid arthritis and control subjects, according to age. <50 years 50-59 years >60 years 10 20 30 40 50 60 70 80 90 Controls Early RA Established RA Age Prevalence of coronary-artery calcification (%) There was a significant interaction between age and disease-status (P-value for interaction <0.05). For age < 50 years and years the prevalence of coronary calcification was increased in patients with established RA compared to controls (both P<0.05) but this was not significant in subjects > 60 years.
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.