0% found this document useful (0 votes)
8 views25 pages

Visualizing and Summarizing Data

Module 2-2 covers the display and summarization of quantitative data using various graphical methods such as histograms, dotplots, and boxplots, as well as measures of center (mean, median, mode) and spread (range, standard deviation, interquartile range). It explains how to describe the shape of distributions, including modes, symmetry, and deviations like outliers and gaps. The module also details the construction and interpretation of boxplots and emphasizes the importance of reporting both resistant and non-resistant statistics.

Uploaded by

tuckerchinchilla
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views25 pages

Visualizing and Summarizing Data

Module 2-2 covers the display and summarization of quantitative data using various graphical methods such as histograms, dotplots, and boxplots, as well as measures of center (mean, median, mode) and spread (range, standard deviation, interquartile range). It explains how to describe the shape of distributions, including modes, symmetry, and deviations like outliers and gaps. The module also details the construction and interpretation of boxplots and emphasizes the importance of reporting both resistant and non-resistant statistics.

Uploaded by

tuckerchinchilla
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Module 2-2: Displaying and Summarizing Quantitative

Data

Displaying Quantitative Variables with Graphs:

ˆ Histograms
ˆ Dotplots
ˆ Stem-and-Leaf Displays
ˆ Boxplots
ˆ Timeplots
ˆ Scatterplots

To describe the distribution of a data set of a quantitative variable, we


consider its:

ˆ shape
ˆ centre
ˆ spread

Shape

To describe the shape of a distribution, we will consider:


a) number of modes
b) symmetry
c) unusual values / deviations from overall pattern: outliers and gaps

A mode is a hump or local high point in the shape of the distribution of


a variable.

Module 2-2 Page 1 of 25


a) Number of Modes: a distribution / plot is said to be
ˆ uniform, if it appears flat, without any clear modes.

ˆ unimodal, if it has one mode.

ˆ bimodal, if it has two modes.

ˆ multimodal, if it has more than two modes.

b) Symmetry: a distribution / plot is said to be


ˆ symmetric if the two halves on either side of the “centre” resemble
mirror images of each other.
ˆ skewed if it is not symmetric and one tail stretches out farther than
the other.
– left-skewed (negatively skewed): tail stretches to the left.
– right-skewed (positively skewed): tail stretches to the right.

c) Deviations from Overall Pattern:


An outlier is a value that falls well above or well below the bulk of the
data. It falls outside the overall pattern of the data.
ˆ might be an error.
ˆ might be an unusual value to investigate.

A gap is a region of the distribution / plot where there are no values.

Module 2-2 Page 2 of 25


Histogram: a bargraph for a quantitative variable. The set of obser-
vations lies in some interval. This interval is partitioned into equal-width
subintervals called bins. The height of each bar represent the number of
observations that fall within the corresponding bin.

(Source: StatCrunch)

Module 2-2 Page 3 of 25


Example: Heights of Stats 151 Students

Note: Changing the number of bins (the width of the bins) may change
the shape of the histogram.

ˆ using too many may make unimportant features too prominent.


ˆ using too few may hide detail.

Module 2-2 Page 4 of 25


Dotplot: shows a dot for each observation, which is placed just above the
value of that observation on the number line. The dots are stacked in a
column over a value, so that the number of dots in the column represents
the frequency of that value.

ˆ effective for small data sets


ˆ reconstruct the data set

Example: Final exams scores of 129 Math 125 students.

Module 2-2 Page 5 of 25


Stem-and-Leaf Display: presents a graphical display of the data using
the actual value of each observation.

ˆ effective for small data sets


ˆ reconstruct the data set

Example: Final exams scores of 129 Math 125 students.

Module 2-2 Page 6 of 25


Example: Heights of 50 Waterfalls

Module 2-2 Page 7 of 25


Numerical Summaries of Quantitative Data: Centre

Centre: a typical or representative value.

Measures of centre for data sets of quantitative variables:

(a) Mean: The mean of a set of observations of a quantitative variable is


the sum of the observations divided by the number of observations.
– If you have a sample of n observations y1, y2, . . . , yn, then the mean
ȳ of these values is:
n
X
yi
i=1
ȳ =
n

(b) Median: The median, M , of a set of observations of a quantita-


tive variable is the middle value (midpoint) when the observations are
ordered from smallest to largest.
– To compute the median order the n observations from smallest to
largest.
n+1
* if n is odd, the median is the value in position .
2
* if n is even, the median is the average of the values in positions
n n
and + 1.
2 2

(c) Mode: the mode of a set of observations of a quantitative variable is


the value in the set that occur with the highest frequency.
– if no value occurs more than once, then the data set has no mode.
– a data set may have more than one mode.

Module 2-2 Page 8 of 25


Example: Compute the mode of the given samples:

The mode of {1, 1, 2, 2, 2, 3, 3, 4} is

The modes of {15, 17, 17, 18, 20, 21, 21, 22} are

The sample {100, 102, 104, 110}

Example: Compute the mean and median of the given samples.

(a) {1, 1, 2, 3, 5, 8, 13}

mean:

median: {1, 1, 2, 3, 5, 8, 13}

(b) {1, 1, 2, 3, 5, 8, 13, 21}

mean:

median: {1, 1, 2, 3, 5, 8, 13, 21}

Module 2-2 Page 9 of 25


(c) {1, 1, 2, 3, 5, 8, 13, 500}

mean:

median: {1, 1, 2, 3, 5, 8, 13, 500}

(d) {2, 3, 5, 3, 2, 3, 4, 3, 5, 1, 2, 3, 4}

mean:

median:

(e) {51, 50, 47, 50, 48, 41, 59, 68, 45, 37}

mean:

median:

Note: The mean is not resistant to outliers.


Module 2-2 Page 10 of 25
Shape vs. Centre
In a symmetric distribution
mean = median = mode

In a left-skewed distribution

mean < median < mode

In a right-skewed distribution

mode < median < mean

Module 2-2 Page 11 of 25


Note: If y1, y2, . . . , yk are the distinct observations of y and their respec-
tive frequencies are f1, f2, . . . fk , then the sample mean can be computed
using the formula
k
X
f i yi
i=1
ȳ =
n
k
X
Note: fi = n
i=1

Example: Number of siblings of students in this class:

# of Siblings 0 1 2 3 4 5 6 7 8 Total
Frequency 29 77 46 17 9 6 1 0 2 187

What are the mean, median, and mode of this sample?

Module 2-2 Page 12 of 25


Spread

Measures of spread for data sets of quantitative variables:


(a) range
(b) standard deviation / variance
(c) interquartile range (IQR)

(a) Range: the difference between the largest (maximum) observation


and the smallest (minimum) observation.

Range = Max − Min

Example: The range of {5, 8, 8, 10, 15, 19, 25, 31} is

Module 2-2 Page 13 of 25


(b) Standard Deviation: a measure of how far the observations fall
from the mean.

The deviation of an observation yi from the sample mean ȳ is


yi − ȳ
The variance of a data set, denoted s2, is the “average” of the squared
deviations:
n
X
(yi − ȳ)2
i=1
s2 =
n−1

The standard deviation of a data set, denoted s, is the square root of


the variance: v
u
u n
X
u
u (yi − ȳ)2
i=1
t
s=
n−1

Example: {1, 3, 3, 4, 5, 8}

Module 2-2 Page 14 of 25


Exercise: Find the variance and standard deviation of this sample
{51, 50, 47, 50, 48, 41, 59, 68, 45, 37}

Note: Facts about standard deviation:


ˆ It has the same units as the data.
ˆ Both ȳ and s are sample statistics, since they are computed from
sample data (not population data).
ˆ It represents the size of a “typical” deviation from the mean.
ˆ It indicates how closely the observations in a data set are gathered
around the mean.
ˆs≥0
ˆ s = 0 if and only if all observations are the same (there is no spread/variation
in the data).
ˆ The larger the value of s, the more spread out the data.
ˆ It is not resistant to outliers and skewness.

Example: Each of these samples of size n = 9 has a sample mean of 20.


Match each sample with its standard deviation, without performing any
computations.
s = 0.367 s = 6.595 s = 14.671

{10, 14, 15, 17, 20, 22, 25, 27, 30}

{19.4, 19.5, 19.8, 20, 20.1, 20.2, 20.2, 20.3, 20.5}

{1, 6, 9, 12, 16, 25, 31, 37, 43}

Module 2-2 Page 15 of 25


c) Interquartile Range (IQR)

For each real number p between 0 and 100, the pth percentile of a data
set is a number such that p% of the data lies at or below that value and
(100 − p)% of the data lies at or above that value.

Quartiles: divide the data into four parts.


ˆ The lower (first) quartile of a data set, denoted Q1 , is the 25th
percentile.
ˆ The second quartile of a data set, denoted Q2 , is the median.
ˆ The upper (third) quartile of a data set, denoted Q3 , is the 75th
percentile.

Note: 50% of the data lies between Q1 and Q3.

The interquartile range of a data set, denoted IQR, is the difference


between the upper quartile and the lower quartile:

IQR = Q3 − Q1

Module 2-2 Page 16 of 25


The 5-number summary of a data set consists of:
ˆ the minimum value
ˆ the lower quartile Q1
ˆ the median
ˆ the upper quartile Q3
ˆ the maximum value

To compute the upper and lower quartiles:


ˆ Order the observations from smallest to largest.
ˆ Compute the median of the data set. Call this the “overall median”.
– Q1 is the median of those observations that lie below the overall
median.
– Q3 is the median of those observations that lie above the overall
median.
Note: The overall median of the data set is not included in the two halves
used to compute the quartiles.

Example: {1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610}

Example: {1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610, 987}

Module 2-2 Page 17 of 25


Boxplot: a graphical display of a data set which uses the 5-number sum-
mary. Boxplots give us information about the center, spread, and shape
(symmetry vs. skewness) of the data, and the presence of outliers in the
data set.

Q1 Q2 Q3

=
median

Example: A sample of the weekly TV-viewing times, in hours, for 20


people is given below
5 15 16 20 21 25 26 27 30 30 31 32 32 34 35 38 38 41 43 66
The 5-number summary for this sample is
min = 5 Q1 = 23 median = 30.5 Q3 = 36.5 max = 66

IQR =

lower fence: Q1 − 1.5(IQR) =

upper fence: Q3 + 1.5(IQR) =

0 4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72
TV-viewing times (hrs)

Module 2-2 Page 18 of 25


To construct a (horizontal) boxplot:
1) Calculate the median, the quartiles (Q1 and Q3), and the IQR for the
data set.
2) Draw a horizontal line which represents the scale of measurement.
3) Above this line, draw a box with the left end at Q1 and the right end
at Q3. Draw a vertical line through the box at the median.
4) Compute
i) the lower fence Q1 − 1.5(IQR), and
ii) the upper fence Q3 + 1.5(IQR).
The fences are not part of the boxplot display and are only used in its
construction.
5) Draw vertical dotted lines on the display to mark the fences. Draw a
horizontal line from the left end of the box to the smallest data value
between the fences and draw a horizontal line from the right end of
the box to the largest data value between the fences. These horizontal
lines are called whiskers.
6) Mark any data value outside of the fences with a special symbol. These
data values are outliers.
7) Remove the fences from the display.

Note: Any data value which lies


ˆ below Q1 − 3(IQR) or
ˆ above Q3 + 3(IQR)
is called an extreme outlier. We often use different symbols to distin-
guish extreme outliers from the other outliers.

Module 2-2 Page 19 of 25


Example: Match each boxplot with its 5-number summary.

Module 2-2 Page 20 of 25


Boxplots and Distribution Shape: From a boxplot, we can describe
the shape of a distribution by looking at the position of the median line in
the box (compared to Q1 and Q3) and the lengths of the whiskers.

For a symmetric distribution:


ˆ the median line is in the centre of the box
(half way between Q1 and Q3).
ˆ the whiskers are the same length.
For a left-skewed distribution:
ˆ the median line is right of centre (closer to Q3 than to Q1 ).
ˆ the whisker is longer on left side of box.
For a right-skewed distribution:
ˆ the median line is left of centre (closer to Q1 than to Q3 ).
ˆ the whisker is longer on right side of box.

Module 2-2 Page 21 of 25


Note:
ˆ Report the mean and standard deviation together and report the me-
dian and IQR together.
ˆ The mean and standard deviation are not resistant to skewness and
outliers.
ˆ The median and IQR are resistant to skewness and outliers.
ˆ Always graph a distribution: consider graphing both a histogram and
a boxplot.
ˆ If a distribution is roughly symmetric, use the mean and standard
deviation as measures of center and spread.
ˆ If a distribution is skewed or has outliers, use the median and
IQR (or 5-number summary) as measures of center and spread.

Example:

Module 2-2 Page 22 of 25


Timeplot or Time Series Plot: a display of values against time.

Consider:
ˆ trend over time (increasing, decreasing)
ˆ cycles or repeating patterns

Example: Average Daily Temperature in Edmonton in 2019

Exercises (Solutions will be posted in the annotated lecture notes.)

1. In a class, 73 students wrote the final exam and had a mean score of
63%. Five students missed the final exam, but were granted a deferred
final exam. Their scores were 88%, 71%, 85%, 74%, 96%. What is the
mean of the scores for the entire class of 78 students?

Module 2-2 Page 23 of 25


2. A class of 107 students had a mean score of 68% on their midterm
exam. If 15 students with a mean score of 39% fail and withdraw from
the class, what is the mean score of the remaining 92 students?

3. Suppose we have a sample of people in which 4 sleep for five hours a


night, 13 sleep for six hours a night, 32 sleep for seven hours a night,
19 sleep for eight hours a night, 7 sleep for nine hours a night, and 1
person sleeps for ten hours every night. What is the mean number of
hours of sleep per night for this sample?

Module 2-2 Page 24 of 25


4. Suppose we have two samples A and B of quantitative data. Suppose
that sample A has mean ȳA = 25 and sample B has mean ȳB = 50,
and that sample B is twice the size of sample A. What is the mean of
the combined sample?

Module 2-2 Page 25 of 25

You might also like