BNG 495 Capstone Design Descriptive Statistics
Overview The overall goal of this short course in statistics is to provide an introduction to descriptive and inferential statistical methods, with a focus on using MATLAB for implementation. The four modules are: Introduction and descriptive statistics Probability distributions Hypothesis testing Correlation and regression Each lecture will be supplemented with a MATLAB tutorial on the same topic You will need to walk through these yourselves after we have covered the corresponding topics in class
Statistics a (very brief) introduction 1663 Natural and Political Observations upon the Bills of Mortality by John Graunt is published Motivated by the desire to base policy on demographic data 1700s Laplace introduces the normal distribution and regression via his study of astronomy 1800s Quetelet applies statistical analysis to human biology The central purpose of statistics is to learn more about some population of interest (e.g., all humans in the world) However, we very rarely, if ever, have access to every individual in the population! sample a subset of the entire population??? compilation of data about the entire population With a sample in hand, we seek to either summarize that data (using descriptive statistics) or use the data to make some prediction or statement about the population (using inferential statistics)
The Central Dogma of Statistics used to summarize data; (this is the focus for today) used to make inferences about the population
Dimensionality of data sets Univariate: measurements made on one variable per subject. This will be the focus for modules 1-3 Bivariate: measurement made on two variables per subject. Multivariate: measurement made on many variables per subject.
Types of descriptive statistics Central tendency measures: computed to give a center around which the measurements in the data are distributed (also called measures of location ). (mean, median, mode, quartiles) Variation or variability measures: describe data spread or how far the measurements are away from the center. (variance, standard dev.) Relative standing measures: describe the relative position of specific measurements in the data. (percentiles)
Measures of central tendency mean The sample mean (a.k.a. average): To calculate the average x of a set of observations, add their values and divide by the number of observations: n x 1 +...+ x n 1 x = = Σ x n n i i = 1
Measures of central tendency - median Median the exact middle value Calculation If there are an odd number of observations, find the middle value If there are an even number of observations, find the mean of the middle two values Example: Median = ave(22,23) = 22.5 Age of students: 17 19 21 22 23 23 23 28
Which measure of central tendency is best? In other words, which measure better approximates the center of a data set? Mean is best for symmetric distributions w/o outliers Median is useful for skewed distributions or data with (one-directional) outliers mean = 3.125 median = 3 mean = 4.857 median = 4
Scale: variance The sample variance is the average of squared deviations of values from the mean n s 2 = Σ (x i x) 2 i = 1 n 1 Square the deviations to get rid of the negatives The result is that the contribution to the variance increases as you go farther from the mean in either direction
Scale: standard deviation s = i n Σ(x i x) 2 = 1 n 1 Procedure to obtain the sample standard deviation: Score/measure observations (in the units that are meaningful, let s say m/s) Find the mean of the observations (m/s) Find each score s deviation from the mean (m/s) Square all those deviations (m/s) 2 Divide by n 1 (m/s) 2 (note that this is the variance) square root (m/s) now we have the starting units! Let s do a simple example problem!
Measures of central tendency mode The mode is the observation that takes place most frequently in a data set Unlike the mean or median, the mode is not necessarily unique the same maximum frequency may occur at different values. Based on the previous slide, is the mode a parametric statistic? (hint: remember that it is a measure of central tendency)
Scale: quartiles and IQR Q 2 is the same as the median The first quartile (Q 1 ) and third quartile (Q 3 ) are the medians of the data sets that would be created if all of the values below and above Q 2, respectively, were chosen. The interquartile range (IQR) is Q 3 Q 1
Quartiles example problem Find the three quartiles and IQR of the following two datasets: 2 3 6 10 12 14 15 18 2 5 9 11 13 15 19 21 24 Q 1 = 4.5 Median = 11 Q 3 = 14.5 IQR = 10 Q 1 = 7 Median = 13 Q 3 = 20 IQR = 13 Note from this example that the 25% rule from the previous slide isn t precisely correct It is easiest to first insert the median the lower and upper halves from which to find Q 1 and Q 3 should then be obvious
Percentiles (a.k.a. quantiles) Generally, the n th percentile is a value such that n% of the observations fall at or below it: Q 1 = 25 th percentile Median = 50 th percentile Q 2 = 75 th percentile
Univariate data: histograms and bar plots What s the differences between a histogram and bar plot? Bar plot Used for categorical variables to show frequency or proportion in each category. Translate the data from frequency tables into a pictoral representation... Histogram Used to visualize distribution (shape, center, range, variation) of continuous variables bin size is important
Effect of bin size on histogram Simulated 1000 N(0,1) 1000 random numbers from the standard normal distribution with mean 0 and st. dev. 1
More on histograms What s the difference between a frequency histogram and a density histogram?
More on histograms What s the difference between a frequency histogram and a density histogram?
More on histograms So, for our roughly gaussian distribution from earlier, the density histogram looks like this: 0.4 0.35 0.3 mean = 3.125 relative frequency 0.25 0.2 0.15 0.1 mean = 4.857 median = 3 0.05 median = 4 0 1 2 3 4 5 observation
Stem and leaf plots
Box and whisker plots An outlier is a score either 1.5 IQR above the upper quartile or below the lower quartile
Example problem Two different classes take a quiz and gets the following scores. Class 1: 2, 4, 6, 8, 10, 12, 14 Class 2: 2, 2, 3, 8, 8, 10, 23 What the mean and median of each set? The same! Will making a box and whisker plot of each set of data give us a better picture of their distributions? (let s do the second one together)
Box plot procedure Steps to make our box plot: Find the median, Q1, Q3, and IQR Draw 3 horizontal lines, at Q1, median, and Q3 Draw the corresponding vertical lines to make the boxes Compute the lower inner fence (Q1 1.5*IQR) and the upper inner fence (Q3 + 1.5*IQR) Draw a whisker downward from Q1 to lower inner fence or minimum, whichever comes first Draw a whisker upward from Q3 to upper inner fence or maximum, whichever comes first Compute the lower outer fence (Q1 3*IQR) and the upper outer fence (Q3 + 3*IQR) Mild outliers fall between the inner and outer fences, mark with O Extreme outliers fall outside outer fences, mark with *
References Lecture 2 Descriptive Statistics and Exploratory Data Analysis University of Washington School of Medicine. http://www.webquest.hawaii.edu/ http://www.sonoma.edu/users/w/wilsonst/cour ses/math_300/final/p14/default.html