Never let time idle away aimlessly.
description
Transcript of Never let time idle away aimlessly.
1
Never let time idle away aimlessly.
2
Chapters 1, 2: Turning Data into Information
Types of data Displaying distributions Describing distributions
3
What are Data?
Any set of data contains information about some group of individuals. The information is organized in variables.
Individuals are the objects described by a set of data. Could be animals, people, or things.
A variable is any characteristic of an individual.A variable can take different values for different individuals.
4
Population/Sample/Raw Data
A population is a collection of all individuals about which information is desired.
A sample is a subset of a population. Raw data: information collected but not been
processed.
5
Example: A College’s Student Dataset
The data set includes data about all currentlyenrolled students such as their ages, genders,heights, grades, and choices of major.
Population/sample/raw data of study? Who? What individuals do the data describe? What? How many variables do the data
describe? Give an example of variables.
6
Types of Variables
A categorical variable places an individual into one of several groups or categories.
A quantitative variable takes numerical values for which arithmetic operations such as adding and averaging make sense.
Q. Which variable is categorical ? Quantitative?
7
A variable
Categorical/Qualitative
Numerical/Quantitative
Nominal variable Ordinal variable Discrete variable Continuous variable
Q: Does “average” make sense?
Yes
Yes
No
No NoYes
Q: Is there any natural ordering among categories? Q: Can all possible values be listed down?
8
Two Basic Strategies to Explore Data
Begin by examining each variable by itself. Then move on to study the relationship among the variables.
Begin with a graph or graphs. Then add numerical summaries of specific aspects of the data.
9
Summarizing Data
Goal: to study or estimate the distributions of variables
The distribution of a variable tells us what values/categories it takes and how often it takes those values/categories.
Displaying distributions of data with graphs Describing distributions of data with numbers
10
A Dataset of CSUEB Students
Gender Height (inches)
Weight (pounds)
College
M 68.5 155 BsnsF 61.2 99 BsnsF 63.0 115 ArtsM 70.0 205 ArtsF 68.6 170 ArtsF 65.1 125 BsnsM 72.4 220 ArtsM -- 188 Bsns
11
Displaying Distributions of Categorical Variables
Calculating these first: Frequency/counts Relative frequency/percentage
12
Displaying Distributions of Categorical Variables
Pie charts: good for one variable
Bar graphs: good for one or two variables and better than pie charts for ordinal variables
Example 1.3 (page 9)
13
Year Count Percent
Freshman 18 41.9%
Sophomore 10 23.3%
Junior 6 14.0%
Senior 9 20.9%
Total 43 100.1%
Class Make-up on First Day
14
Freshman41.9%
Sophomore23.3%
Junior14.0%
Senior20.9%
Pie Chart
Class Make-up on First Day
15
41.9%
23.3%
14.0%
20.9%
0.0%
5.0%
10.0%
15.0%
20.0%
25.0%
30.0%
35.0%
40.0%
45.0%
Freshman Sophomore Junior Senior
Year in School
Perc
ent
Class Make-up on First Day
Bar Graph
16
Displaying Distributions of Quantitative Variables
Stem-and-leaf plots: good for small to medium datasets
Histograms: Similar to bar charts; good for medium to
large datasets
17
How to Make a Histogram
1. Break the range of values of a variable into equal-width intervals. Make sure to specify the classes precisely so that each individuals falls into exactly one class.
2. Count the # of individuals in each interval. These counts are called frequencies and the corresponding %’s are called relative frequencies.
3. Draw the histogram: the variable on the horizontal axis and the count (or %) on the vertical axis.
*** work on blackboard for height ***
18
Histograms: Class Intervals
How many intervals?– One rule is to calculate the square root of the
sample size, and round up. Size of intervals?
– Divide range of data (maxmin) by number of intervals desired, and round to convenient number
Pick intervals so each observation can only fall in exactly one interval (no overlap)
19
How to Make a Stemplot
1. Separate each observation into a stem consisting of all but the final (rightmost) digit and a leaf, the final digit. Stems may have as many digits as needed, but each leaf contains only a single digit.
Example: height of 68.5 leaf = “5” and the other digit “68” will be the stem
20
How to Make a Stemplot
2. Write the stems in a vertical column with the smallest at the top, and draw a vertical line at the right of this column.
3. Write each leaf in the row to the right of its stem, in increasing order out from the stem.
21
Weight Data:Stemplot(Stem & Leaf Plot)
10 016611 00912 003457813 0035914 0815 0025716 55517 00025518 00005556719 24520 321 02522 023242526 0
Key
20|3 means203 pounds
Stems = 10’sLeaves = 1’s
22
Extended Stem-and-Leaf Plots
If there are very few stems (when the data cover only a very small range of values), then we may want to create more stems by splitting the original stems.
23
Extended Stem-and-Leaf Plots
Example: if all of the data values were between 150 and 179, then we may choose to use the following stems:
151516161717
Leaves 0-4 would go on each upper stem (first “15”), and leaves 5-9 would go on each lower stem (second “15”).
24
What do We See from the Graphs?
Important features we should look for: Overall pattern
– Shape– Center (the location data tend to cluster to)– Spread (the spread level of data)
Outliers, the values that fall far outside the overall pattern
(for quantitative variables only)
25
Overall Pattern—Shape
How many peaks, called modes? A distribution with one major peak is called unimodal.
Symmetric or skewed?– Symmetric if the large values are mirror images of small
values– Skewed to the right if the right tail (large values) is much
longer than the left tail (small values)– Skewed to the left if the left tail (small values) is much
longer than the right tail (large values)
*** Show examples on blackboard. ***
26
Numerical Summaries for Quantitative Variables (Chapter 2)
To measure center (location): Mode, Mean and Median
To measure spread: Range, Interquartile Range (IQR) and Standard Deviation (SD)
Five-number summaries** show height Outliers** give a large number for the missing height
27
Mean or Average
Traditional measure of center Sum the values and divide by the number of
values
xnx x x
nxn i
i
n
1 1
1 2
1
28
Median (M)
A resistant measure of the data’s center At least half of the ordered values are less
than or equal to the median value At least half of the ordered values are greater
than or equal to the median value If n is odd, the median is the middle ordered value If n is even, the median is the average of the two
middle ordered values
29
Median (M)
Location of the median: L(M) = (n+1)/2 ,where n = sample size.
Example: If 25 data values are recorded, the Median would be the (25+1)/2 = 13th ordered value.
30
Median
Example 1 data: 2 4 6 Median (M) = 4
Example 2 data: 2 4 6 8 Median = 5 (ave. of 4 and 6)
Example 3 data: 6 2 4 Median 2 (order the values: 2 4 6 , so Median = 4)
31
Comparing the Mean & Median
The mean and median of data from a symmetric distribution should be close together. The actual (true) mean and median of a symmetric distribution are exactly the same.
In a skewed distribution, the mean is farther out in the long tail than is the median [the mean is ‘pulled’ in the direction of the possible outlier(s)].
32
Question
A recent newspaper article in California said that the median price of single-family homes sold in the past year in the local area was $136,000 and the mean price was $149,160. Which do you think is more useful to someone considering the purchase of a home, the median or the mean?
33
Spread, or Variability
If all values are the same, then they all equal the mean. There is no variability.
Variability exists when some values are different from (above or below) the mean.
We will discuss the following measures of spread: range, IQR, and standard deviation
34
Range
One way to measure spread is to give the smallest (minimum) and largest (maximum) values in the data set;
Range = max min The range is strongly affected by outliers
35
Quartiles
Three numbers which divide the ordered data into four equal sized groups.
Q1 has 25% of the data below it. Q2 has 50% of the data below it. (Median)
Q3 has 75% of the data below it.
36
Obtaining the Quartiles
Order the data. For Q2, just find the median. For Q1, look at the lower half of the data values,
those to the left of the median location; find the median of this lower half.
For Q3, look at the upper half of the data values, those to the right of the median location; find the median of this upper half.
37
Weight Data: Sorted
100 124 148 170 185 215101 125 150 170 185 220106 127 150 172 186 260106 128 152 175 187110 130 155 175 192110 130 157 180 194119 133 165 180 195120 135 165 180 203120 139 165 180 210123 140 170 185 212
L(M)=(53+1)/2=27
L(Q1)=(26+1)/2=13.5
38
Weight Data: Quartiles
Q1= 127.5 Q2= 165 (Median) Q3= 185
39
Five-Number Summary minimum = 100 Q1 = 127.5 M = 165 Q3 = 185 maximum = 260
InterquartileRange (IQR)= Q3 Q1
= 57.5
IQR gives spread of middle 50% of the data
40
Variance and Standard Deviation
Recall that variability exists when some values are different from (above or below) the mean.
Each data value has an associated deviation from the mean:
x xi
41
Deviations
what is a typical deviation from the mean? (standard deviation)
small values of this typical deviation indicate small variability in the data
large values of this typical deviation indicate large variability in the data
42
Variance
Find the mean Find the deviation of each value from the
mean Square the deviations Sum the squared deviations Divide the sum by n-1
(gives typical squared deviation from mean)
43
Variance Formula
sn
x xii
n2
11
2
1
( )
( )
44
Standard Deviation Formulatypical deviation from the mean
sn
x xii
n
1
12
1( )( )
[ standard deviation = square root of the variance ]
45
Variance and Standard DeviationExample from Text
Metabolic rates of 7 men (cal./24hr.) :1792 1666 1362 1614 1460 1867 1439
1600 7200,11
71439186714601614136216661792
x
46
Variance and Standard DeviationExample from Text
Observations Deviations Squared deviations
1792 17921600 = 192 (192)2 = 36,8641666 1666 1600 = 66 (66)2 = 4,3561362 1362 1600 = -238 (-238)2 = 56,6441614 1614 1600 = 14 (14)2 = 1961460 1460 1600 = -140 (-140)2 = 19,6001867 1867 1600 = 267 (267)2 = 71,2891439 1439 1600 = -161 (-161)2 = 25,921
sum = 0 sum = 214,870
xxi ix 2xxi
47
Variance and Standard DeviationExample from Text
67.811,3517
870,2142
s
calories 24.18967.811,35 s
48
More Graphs for Quantitative Variables
Boxplots (pages 46 - 49)** to show location and spread, and identify outliers
Scatterplots** to see the relationship between two quan. var’s:
height vs. weight
Time plots** a special scatterplot; time is the x-axis ** example 1.10, page 23
49
Boxplot
Central box spans Q1 and Q3.
A line in the box marks the median M.
Lines extend from the box out to the minimum and maximum.
50
M
Weight Data: Boxplot
Q1 Q3min max
100 125 150 175 200 225 250 275
Weight
51
Example from Text: Boxplots
52
Identifying Outliers
The central box of a boxplot spans Q1 and Q3; recall that this distance is the Interquartile Range (IQR).
We call an observation a suspected outlier if it falls more than 1.5 IQR above the third quartile or below the first quartile.
53
Time Plots
A time plot shows behavior over time. Time is always on the horizontal axis, and the variable
being measured is on the vertical axis. Look for an overall pattern (trend), and deviations from
this trend. Connecting the data points by lines may emphasize this trend.
Look for patterns that repeat at known regular intervals (seasonal variations).
54
Class Make-up on First Day(Fall Semesters: 1985-1993)
0%
10%
20%
30%
40%
50%
60%
70%
Percent of ClassThat Are Freshman
1985 1986 1987 1988 1989 1990 1991 1992 1993
Year of Fall Semester
Class Make-up On First Day
55
Average Tuition (Public vs. Private)
Graphs for the Relation of Two Variables
1 categorical + 1 quantitative var’s:
2 quantitative var’s:
2 categorical var’s:
56