530 likes | 564 Views
Descriptive Statistics for Numeric Variables. Types of Measures: measures of location measures of spread measures of relative spreading measures of shape. What to describe?. What is the “location” or “center” of the data? (“ measures of location ”)
E N D
Descriptive Statistics for Numeric Variables Types of Measures: measures of locationmeasures of spreadmeasures of relative spreadingmeasures of shape
What to describe? • What is the “location” or “center” of the data? (“measures of location”) • How do the data vary? (“measures of variability”)
Measures of Location • Mean • Median • Mode
Mean • Another name for average. • If describing a population, denoted as , the greek letter m, i.e. “mu”. (PARAMETER) • If describing a sample, denoted as , called “x-bar”. (STATISTIC) • Appropriate for describing measurement data. • Seriously affected by unusual values called “outliers”.
Calculating Sample Mean Formula: That is, add up all of the data points and divide by the number of data points. Data (# ER arrivals in 1 hr): 2 8 3 4 1 Sample Mean = (2+8+3+4+1)/5 = 3.6 arrivals
Median • Another name for 50th percentile. • Appropriate for describing measurement data. • “Robust to outliers,” that is, not affected much by unusual values.
Calculating Sample Median Order data from smallest to largest. If odd number of data points, the median is the middle value. Data (# ER arrivals in 1 hr.): 2 8 3 4 1 Ordered Data: 12 3 4 8 Median
Calculating Sample Median Order data from smallest to largest. If even number of data points, the median is the average of the two middle values. Data (# ER arrivals in 1 hr.): 2 8 3 4 1 8 Ordered Data: 12 3 4 8 8 Median = (3+4)/2 = 3.5
Mode • The value that occurs most frequently. • One data set can have many modes. • Appropriate for all types of data, but most useful for categorical data or discrete data with only a few number of possible values.
In JMP: Heart Attack Data • Select Analyze Distribution (JMP Demo)
In JMP: Heart Attack Data Sample sizen = 45 (don’t use N)
The most appropriate measure of location depends on … the shape of the data’s distribution. e.g.
Most appropriate measure of location • Depends on whether or not data are “symmetric” or “skewed”. • Depends on whether or not data have one (“unimodal”) or more (“multimodal”) modes.
Cholesterol Level of Heart Attack Patients - Symmetric and Unimodal (approx.)
Cholesterol Level of Heart Attack Patients - Symmetric and Unimodal (approx.) The mean and the median are approximately the same as this distribution is nearly symmetric. Slight right skewness – see measures of shape.
Heights of College Students - Symmetric and Bimodal Variable n Mean Median StdDev Males 84 70.048 70.000 3.030 Females 89 64.798 65.000 2.877 All 176 67.313 67.000 4.017 Variable SE Mean Min Max Q1 Q3 Males 0.331 63.0 76.0 68.0 72.0 Females 0.305 56.0 77.0 63.0 67.0 All 0.303 56.0 77.0 64.0 70.0
Heights of College Students - Symmetric and Bimodal Mean height for females Mean height for males Overall mean
Systolic Volume for Heart Attack Patients - Skewed Right • Sample mean (79.42) is substantially larger than the sample median (67.00), median is “better” measure of average. • Skewness statistic is > 1 suggesting pronounced right skewness (see measures of shape).
Time Until Outcome for Heart Attack Patients - Skewed Left • Sample mean (112.4) is substantially smaller than the sample median (138.00), median is “better” measure of average. • Skewness statistic is < - 1 suggesting pronounced left skewness (see measures of shape)
Choosing Appropriate Measure of Location • If data are symmetric, the mean, median, and mode will be approximately the same. • If data are multimodal, report the mean, median and/or mode for each subgroup. • If data are skewed, report the median.
Measures of Variability • Range • Interquartile range (IQR) • Variance and standard deviation • Coefficient of variation (CV)
Range • The difference between largest and smallest data point. • Highly affected by outliers. • Best for symmetric data with no outliers.
Cholesterol Level of Heart Attack Patients - Symmetric and Unimodal (approx.)
Cholesterol Level of Heart Attack Patients - Symmetric and Unimodal (approx.) Max. = 93 (mmoles/l) Min. = 38 (mmoles/l) Range = 93 – 38 = 55 (mmoles/l)
Interquartile range • The difference between the “third quartile” (75th percentile) and the “first quartile” (25th percentile). So, the “middle-half” of the values. • IQR = Q3-Q1 • Robust to outliers or extreme observations. • Works well for skewed data.
Systolic Volume for Heart Attack Patients - Skewed Right Q3 Q1 • Q3 = 92.50 Q1 = 52.50 IQR = 92.50 – 52.50 = 40.0 • The range of the middle 50% of systolic volumes is 40 mmoles/l.
Variance • If measuring variance of population, denoted by 2 (“sigma-squared”). • If measuring variance of sample, denoted by s2 (“s-squared”). • Measures average squared deviation of data points from their mean. • Highly affected by outliers. Best for symmetric data. • Problem is units are squared.
Formula for the Sample Variance (s2) This is nearly (if not for the n-1 in the denominator) the average squared deviation from the sample mean for our observed data.
Standard deviation • Sample standard deviation is square root of sample variance, and so is denoted by s. • Units are the original units. • Measures “average” deviation of data points from their mean. • Also, highly affected by outliers.
Sleep Study: Comparing Time to Fall Asleep of Smokers vs. Non-smokers What differences in distribution of time to fall asleep do we see when comparing the smokers to non-smokers in this study? • Typical time to fall asleep is 20-21 minutes for both populations. • IQR for smokers is twice that for non-smokers. • 3) Distribution for non-smokers is approx. normal, not so for smokers.
Sleep Study: Comparing Time to Fall Asleep of Smokers vs. Non-smokers SmokersNon-smokers s = 3.69 minutes > s = 2.28 minutes IQR = 7.05 minutes > IQR = 3.00 minutes
Empirical Rule – The standard deviation and the normal distribution For unimodal, moderately symmetrical, sets of data approximately: • 68% of observations lie within 1 standard deviation of the mean. • 95% of observations lie within 2 standard deviations of the mean. i.e. Normally Distributed Data
The Empirical Rule 68% within 1 standard deviation 34% 34% x - s x x+s
The Empirical Rule 95% within 2 standard deviations 68% within 1 standard deviation 34% 34% 13.5% 13.5% x - 2s x - s x x+s x+2s
0.1% The Empirical Rule 99.7% of data are within 3 standard deviations of the mean 95% within 2 standard deviations 68% within 1 standard deviation 34% 34% 2.4% 2.4% 0.1% 13.5% 13.5% x - 3s x - 2s x - s x x+s x+2s x+3s
Application of Empirical Rule – Medical Lab Tests When you have blood drawn and it is screened for different chemical levels, any results two standard deviations below or two standard deviations above the mean for healthy individuals will get flagged as being abnormal. Example: For potassium, healthy individuals have a mean level 4.4 meq/l with a SD of .45 meq/l Individuals with levels outside the range : 4.4 – 2(.45) to 4.4 + 2(.45) 3.5 meq/l to 5.3 meq/l would be flagged as having abnormal potassium.
Coefficient of Variation (CV) • Ratio of sample standard deviation to sample mean multiplied by 100. • Measures relative variability, that is, variability relative to the magnitude of the data. • Unitless, so good for comparing variation between two groups and for comparing variability of measurements in completely different scales and/or units.
Heart Attack Data: Which volume measure has more variation, systolic or diastolic? SYSVOLCV = 39.95/79.42 = 50.3% DIAVOL CV = 48.79/158.93 = 30.7% Thus systolic volume has the greater variation in our sample on the basis of the CV.
The most appropriate measure of variability depends on … the shape of the data’s distribution.
Choosing Appropriate Measure of Variability • If data are symmetric, with no serious outliers, use range and standard deviation. • If data are skewed, and/or have serious outliers, use IQR. • If comparing variation across two variables, use coefficient of variation if the variables are in different units and/or scales. If the scales and units are roughly the same direct comparison of the standard deviation is fine.
Measures of Shape – Skewness and Kurtosis Statistical software packages will give some measure of skewness and kurtosis for a given numeric variable. Skewness measures departure from symmetry and is usually characterized as being left or right skewed as seen previously. Kurtosis measures “peakedness” of a distribution and comes in two forms, platykurtosis and leptokurtosis.
Skewness If skewness < -.20 severe left skewness If skewness > +.20 severe right skewness Pearson’s Skewness Coefficient Fisher’s Measure of Skewness has a complicated formula but most software packages compute it. Fisher’s Skewness > 1.00 moderate right skewness > 2.00 severe right skewness Fisher’s Skewness < -1.00 moderate left skewness < -2.00 severe right skewness
Skewness Skewness = -.5786 Suggesting slight left skewness. Skewness = 1.944 Suggesting strong right skewness.
Kurtosis Normal distribution has Kurtosis = 0. Measures peakedness of a distribution. Leptokurtotic distributions are more peaked than normal with fatter tails,Kurtosis > 0 Platykurtotic distributions are less peaked (squashed normal) than normal,Kurtosis < 0
Kurtosis Example 1: Blood pH levels for subjects in right heart catheter study. Here we see slightly left skewed (-1.22) but markedly leptokurtotic (3.49) distribution. The reference normal curve has been added and blue curve is the density estimate from the data.
Example 2: Kurtosis Times to fall asleep for non-smokers are approx. normal as both skewness and kurtosis are close to 0. Times to fall asleep for smokers are fairly platykurtotic. Kurtosis = -1.50
Transformations to Improve Normality (removing skewness) Many statistical methods require that the numeric variables you are working with have an approximately normal distribution. Reality is that this is often times not the case. One of the most common departures from normality is skewness, in particular, right skewness.
Tukey’s Ladder of Powers Left skewed We go up the ladder to remove left skewness and down the ladder to remove right skewness. Middle rung: No transformation (l = 1) Right skewed UP . . . . Here V represents our variable of interest. We are going to consider this variable raised to a power l, i.e. Vl Bigger Impact Bigger Impact DOWN . . . .