Basic Biostatistics Part 1
Wednesday 27th February, 2013
Content
Types of Data Descriptive/Summary Statistics
Frequency Distributions and Contingency
Tables
Graphical Presentations
Types of Data
Variables
Variables
Numerical counted or measured on a numerical scale
Categorical nonnumerical, classification into categories
Continuous measured on a scale; e.g. height
Discrete counts, whole numbers; e.g. number of patients
Nominal categories; e.g. cause of death
Ordinal ordered categories; e.g. level of pain
Exercise
Consider the following variables and decide if they are
Numerical or Categorical; continuous, discrete, nominal or ordinal Gender Height Number of staff in a department Length of psychiatric inpatient treatment Preferred strength of coffee Organisational size Types of anxiety disorder Levels of anxiety Types of medication
Derived data
In the medical field, other types of data may be
encountered
Percentages e.g. % of operational interactions Ratios or quotients e.g. Body Mass Index (BMI), kg/m2 Rates e.g. number of disease events/total number of
years of follow-up Scores e.g. quality of life scores
In most analyses these can be treated as numerical
variables
Descriptive/Summary Statistics
Measures of location
Measures of location summarise data with a
single number
There are three common measures of location
- Mean - Mode - Median
Quartiles/Percentiles are another measure
Mean
The mean (more precisely, the arithmetic mean) is
commonly called the average
In formulas the mean is usually represented by x
read as x-bar.
The formula is;
x x n
All the values (x) are added together and the sum divided by the number of observations (n)
Mode
The mode represents the most commonly occurring
value within a dataset
The mode can found by creating a frequency
distribution in which how often each value occurs is counted
If every value occurs only once, the distribution has no mode.
If two or more values are tied as the most common value then the distribution has more than one mode
Median
Median means middle, and the median is the middle of
a set of data that has been put into rank order
Specifically, it is the value that divides a set of data into
two halves, with one half of the observations being larger than the median value, and one half smaller
Half the data < 29 Half the data > 29
18
24
29
30
32
Quartiles
Are a subset of percentiles
Lower quartile - 25% of the data is below this
value
Upper quartile 75% of the data is below
this value
Measures of Dispersion
The dispersion in a set of data is the variation among
the set of data values
It measures whether they are all close together, or
more scattered
4 6 8 10 12 14 16 No. of days to receive treatment
2 4 6 8 10 12 No. of days to receive treatment
Common Measures of Dispersion
Four common measures of spread are
- the range - the inter-quartile range - the variance
- the standard deviation
Range
The range is the difference between the largest and the
smallest values in the dataset
It is sensitive to extreme values The range of a list is 0 if and only if all the data values
are equal
4 Range
16
Days
Inter-quartile Range
Upper Quartile Lower Quartile Describes how much the middle 50% of the dataset
varies
- example: if all patients at a clinic took more-or-less the same time to be treated with only one or two exceptionally quick or long appointments you would expect the inter-quartile range to be very small - but if all appointments were either very quick or very long, with few in between then the inter-quartile range would be larger
Variance and Standard Deviation
(s2, s2) =(population notation, sample notation)
The variance (s2, s2) and standard deviation (s, s)
are measures of the deviation or dispersion of observations (x) around the mean (m) of a distribution
Variance is an average deviation from the mean,
squared
Variance and Standard Deviation
The standard deviation (SD) is the square root of the
variance
- small SD = values cluster closely around the mean - large SD = values are scattered
1 SD Mean 1 SD
1 SD
Mean
1 SD
10
12
14
16
Days
10
12
Variance and Standard Deviation
The following formulae define these measures
Population
Variance s 2
2 ) x m
Sample
N Variance s 2
x x)
n 1
StandardDeviation s s 2
StandardDeviation s s 2
Measures of Distribution
Measures of distribution are
- Skewness - Kurtosis
The terms Skewness and Kurtosis refer to
distribution shapes that deviate from the shape of a normal distribution
Skewness
A skewed distribution is characterised by a tail off
towards the high end of the scale (a positive skew) or towards the low end of the scale (a negative skew)
Normal Distribution
Skewness statistic ~ 0
Positive Skew
Skewness statistic > 0
Negative Skew
Skewness statistic < 0
Skewness
If the distribution has no skewness, then the
skewness statistic will be zero
If the distribution has positive skewness, then
the skewness statistic will be positive
If the distribution has negative skewness, then
the skewness statistic will be negative
Kurtosis
A distribution with kurtosis is characterised by the
distribution being too narrow and peaked (a positive kurtosis) or too wide and flat (a negative kurtosis)
Normal Distribution
Kurtosis statistic ~ 0
Positive Kurtosis
Kurtosis statistic > 0
Negative Kurtosis
Kurtosis statistic < 0
Frequency Distributions and Contingency Tables
Definition of a Frequency Distribution
A few examples:
a representation, either in a graphical or tabular format,
which displays the number of observations within a given interval a mathematical function showing the number of instances in which a variable takes each of its possible values an arrangement of statistical data that exhibits the frequency of the occurrence of the values of a variable
Contingency Table
A table in which the entries are frequencies
A matrix format that displays the frequency
distribution of the variables
If there are 2 rows and 2 columns it is called a 2x2
contingency table
Often used in conjunction with statistical tests e.g.
Chi-squared test, Diagnostic test
Example: Contingency table
Contingency table: 2 x 2
Characteristic Group 1 Group 2 Total Present a b a+b Absent c d c+d Total a+c b+d n=a+b+c+d
Use in Diagnostic Testing
Gold Standard Test Characteristic Disease No disease Total Positive a b a+b Negative c d c+d Total a+c b+d n=a+b+c+d
How many individuals have the disease? What proportion have the disease (the prevalence)?
True/False Positive/Negative
Of the a + c individuals who have the disease, how
many have positive test results (true positives)?
Of the a + c individuals who have the disease, how
many have negative test results (false negatives)
Of the b + d individuals who do not have the disease,
how many have negative test results (true negatives)?
Of the b + d individuals who do not have the disease,
how many have positive test results (false positives)?
Sensitivity and Specificity
The proportion of individuals with the disease
who are correctly identified by the test = Sensitivity
a a c )
The proportion of individuals without the
disease who are correctly identified by the test
= Specificity
d b d )
Graphical Presentations
Typical graphs
Bar Chart Pareto Chart Pie Chart Box Plot Histogram
Useful for getting an initial feel for the data Useful for explaining/presenting results to others Useful for identifying outliers
Displaying Frequency Distributions
Categorical or some Discrete Numerical data can be
displayed visually in a:
Bar (or Column) Chart Pareto Chart Pie Chart Continuous Numerical data (and some Discrete
Numerical data) can be displayed visually in a:
Box Plot Histogram
Bar chart
Why use it?
to count the number of occurrences of
categorical or discrete data
Example: Bar Chart
Bar chart - the number of different types of patient in a study
20
15
Frequency
10
g Type of patient
Pareto chart: 80 / 20 rule
Vilfredo Pareto (Italian economist), studied the
distributions of wealth in different countries
Concluded that a fairly consistent minority (about
20%) of people controlled the large majority (about 80%) of a society's wealth from 20% of the causes (Pareto effect)
Often said that that 80% of problems usually stem
Pareto chart
Why use it?
Identifies areas that provide the greatest
potential for improvement
Pareto chart
What does it do?
helps a team to focus on the problems that have
most impact displays the relevant importance of problems allows progress to be measured in a visible format
Frequency vs. Cost
The most frequent problems may not always
have the largest impact in terms of quality, time or costs In these situations it may be best to use two Pareto charts:
one for frequency/count one for impact (cost)
both?
Obvious Pareto effect
Obvious Pareto effect
Project focus
80 70 60
100 80 60 40 20 0
Frequency
40 30 20 10 0 Cause Count Percent Cum % A 30 41.7 41.7 B 25 34.7 76.4 C D E Other 3 4.2 100.0
6 8.3 84.7
5 6.9 91.7
3 4.2 95.8
Percent
50
No Pareto effect
No Pareto effect
70 60 80 50 100
Frequency
40 30 20 10 0 Cause Count Percent Cum % A 18 26.5 26.5 B 15 22.1 48.5 C 14 20.6 69.1 D 10 14.7 83.8 E other 5 7.4 100.0
40 20 0
6 8.8 92.6
Percent
60
Causes of medication errors
Causes of medication errors
60
Project focus
50
100
Frequency
30 20 10 Cause
60 40 20
g g g ly in g in in l t r n i r du ro a de w g e r v w n o a ch nd d e ro s a e un s H w o n ct ck d o n e o i i r t t t s or ec ca ed d c i r e M In or ed M c M In Count 21 8 6 6 5 5 Percent 39.6 15.1 11.3 11.3 9.4 9.4 Cum % 39.6 54.7 66.0 77.4 86.8 96.2 e bl a il e ac l p
er h Ot
2 3.8 100.0
Percent
40
80
Pie chart
Why use it?
to evaluate the percentage/proportion
contribution of categories of data
Example: Pie Chart
Pie Chart - type of patients in a study
Category dental insurance gov ernment healthcare priv ate 15, 30.0% 15, 30.0%
What could improve this chart?
20, 40.0%
Box (and Whisker) plot
Why use it?
to provide an instant picture of variation in a
data set
to compare multiple data sets
to identify outliers
Box plot
What does it do?
allows visualisation of the distribution and variation of a data set
allows a comparison to be made before and after interventions graphically shows key statistics such as the Median, Inter-quartile Range (IQR) and Quartiles
Box Plot
Whisker extends to this adjacent value the highest value within the upper limit
Third Quartile (Q3) Median
First Quartile (Q1) Whisker extends to this adjacent value the lowest value within the lower limit Outliers *
Box Plot: Example 1
Reaction Time (s) Reaction times of 2 groups
0 Group A Group B
Box Plot: Example 2
Histogram
Why use it?
- to evaluate the distribution of a data set
- to evaluate whether certain statistical tests
can be applied
Histogram
What does it do? Displays bars representing the count within different intervals of data Allows visualisation of the shape and spread of a data set Allows patterns to be identified Provides an indication of where the mean lies
Normal Distribution
Normal Distribution
25
20
Data symmetrical about the mean
Frequency
15
10
45.0
46.5
48.0
49.5 Data
51.0
52.5
54.0
Bimodal distribution
Bimodal distribution
40
30
Frequency
20
10
44
48
52 data
56
60
64
Skewed distribution
Skewed distribution
60 50 40
Frequency
30 20 10 0
40
80
120 Data
160
200
240
Histogram: Example 1
Histogram: Example 2
Exercise
Identify situations in your research/work
environment where Bar charts, Pareto charts, Pie charts, Box plots, and Histograms could be used
For each situation:
describe the situation identify the type of data determine the x and y axis variables describe typical visual output
Summary
Types of Data Descriptive/Summary Statistics
Frequency Distributions and Contingency
Tables
Graphical Presentations