[go: up one dir, main page]

0% found this document useful (0 votes)
16 views88 pages

Lecture 04

This lecture covers descriptive statistics, focusing on measures of central tendency, variation, and correlation between variables. Key concepts include the arithmetic mean, median, mode, geometric mean, and interquartile range, along with graphical representations like box-and-whisker plots. The lecture emphasizes the importance of both graphical and numerical summaries in understanding data sets.

Uploaded by

lllinhtam
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)
16 views88 pages

Lecture 04

This lecture covers descriptive statistics, focusing on measures of central tendency, variation, and correlation between variables. Key concepts include the arithmetic mean, median, mode, geometric mean, and interquartile range, along with graphical representations like box-and-whisker plots. The lecture emphasizes the importance of both graphical and numerical summaries in understanding data sets.

Uploaded by

lllinhtam
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
You are on page 1/ 88

LECTURE 4

Descriptive Statistics

Lecturer: Nguyen Thi Thu Van


Email: van.nguyen@ueh.edu.vn
Although pictures are very important, there are still
times when they don’t tell us all we need to know
about a data set. It is extremely necessary that we
can use both graphical and numerical summaries
to explore a data set.

In this lecture, we will explore various measures of


the central tendency, measures of dispersion and
measures of correlation between variables.
“Statistics is a way to get information from data.”
Gerald Keller

Data Information
Average = 48.67
Min = 43.33
Max = 53.33
Range = 10

Content

 Measures of central tendency

 Percentiles - Quartiles

 Measures of variation

 Shape of distribution

 Standardized data

 Group data

 Linear relationship
Numerical Descriptive Statistics

Numerial Data Properties

Center Variation Shape Relation

Arithmetic Mean Range Skewness

Median Interquartile Range Kurtosis

Mode Variance

Trimmed Mean Standard Deviation Covariance


Geometric Mean Coefficient of Variation Correlation
Percentile – Quartile
Measures of Central Tendency
Basic Measures of Center

Center

Arithmetic Mean Median Mode Geometric Mean

X i
XG  ( X1  X2    Xn )1/ n

X i1
n Midpoint of Most
ranked frequently Trimmed Mean
values observed
value
Arithmetic Mean
The arithmetic mean (or simply mean) is the
average of all values. It is the most commonly
used measure of central tendency.
 For a sample of size n:
n

X i
X1  X 2    Xn
X i1

n n

Sample size Observed values


The arithmetic mean is sensitive to extreme
values (outliers), as demonstrated in the following
example:

0 1 2 3 4 5 6 7 8 9 10 0 1 2 3 4 5 6 7 8 9 10

Mean = 3 Mean = 4

1  2  3  4  5 15 1  2  3  4  10 20
 3  4
5 5 5 5
Median
 In an ordered array, the median is the “middle”
number (50% above, 50% below)

0 1 2 3 4 5 6 7 8 9 10 0 1 2 3 4 5 6 7 8 9 10

Median = 3 Median = 3

 Not affected by extreme values.


How to Find Median?
 The location of the median:
n 1
Median position  position in the ordered data
2

 If the number of values is odd, the median is the


middle number

 If the number of values is even, the median is the


average of the two middle numbers
n 1
 Note that is not the value of the median, only the
2
position of the median in the ranked data.
Mode
The mode is the value that appears most frequently.
 Not affected by extreme values.
 There may be no mode, one mode or several
modes
Remark: mode only is useful for either discrete
numerical or categorical (nominal) data.

0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 0 1 2 3 4 5 6

No Mode

Mode = 9
Review Example
 Five houses on a hill by the beach

$2,000 K
House Prices:
$2,000,000
500,000
$500 K
300,000 $300 K
100,000
100,000
$100 K

$100 K
Review Example: Summary Statistics

House Prices:  Mean: ($3,000,000/5)


$2,000,000
= $600,000
500,000
300,000
100,000  Median: middle value of ranked
100,000 data
Sum $3,000,000 = $300,000

 Mode: most frequent value


= $100,000
Which measure of location is the “best”?
 The mean is generally used unless extreme values
(outliers) are present. In cases with outliers, the
median is often preferred, as it is less sensitive to
extreme values. For example, median home prices
are commonly reported for a region because they are
less influenced by outliers.

 Additionally, in practice, calculating the mode can


often be challenging.
Geometric Mean
Example
An investment of $100,000 declined to $50,000 at the
end of year one and rebounded to $100,000 at end of
year two:

X1  $100,000 X2  $50,000 X3  $100,000

50% decrease 100% increase

The overall two-year return is zero, since it started and


ended at the same level.
Example
Use the 1-year returns to compute the arithmetic
mean and the geometric mean:
Arithmetic ( 50%)  (100%)
mean rate X  25% Misleading result
2
of return:

Geometric R G  [(1  R1 )  (1  R 2 )    (1  Rn )]1/ n  1


mean rate
 [(1  ( 50%))  (1  (100%))]1/ 2  1
of return: More
 [(.50)  (2)] 1/ 2
1 1
1/ 2
 1  0% accurate
result
Trimmed Mean
 Trimmed mean is a measure of central tendency that
cuts down the highest and lowest k percent of the
observations before applying the standard averaging
formula.

 The trimmed mean mitigates the effects of very


extreme values.
Percentiles
Percentiles
Finding Location and Value of a Percentile
Quartiles
 Quartiles split the ranked data into 4 segments with
an equal number of values per segment

25% 25% 25% 25%

Q1 Q2 Q3

 Q1 is the value for which 25% of the observations are smaller


and 75% are larger

 Q2 is the same as the median (50% are smaller, 50% are larger)

 Only 25% of the observations are greater Q3


Quartile Formulas

Find a quartile by determining the value in the


appropriate position in the ranked data, where

First quartile position Q1 : (n+1)/4

Second quartile position Q2: (n+1)/2 (the median position)

Third quartile position Q3: 3(n+1)/4

where n is the number of observed values


Quartile Example
Example: Find the first quartile
Sample Data in Ordered Array: 11 12 13 16 16 17 18 21 22

(n = 9)
Q1 is in the (9+1)/4 = 2.5 position of the ranked data
so use the value half way between the 2nd and 3rd values,

so Q1 = 12.5

Q1 and Q3 are measures of noncentral location


Q2 = median, a measure of central tendency
Quartile Example
Example:
Sample Data in Ordered Array: 11 12 13 16 16 17 18 21 22

(n = 9)
Q1 is in the (9+1)/4 = 2.5 position of the ranked data,
so Q1 = 12.5

Q2 is in the (9+1)/2 = 5th position of the ranked data,


so Q2 = median = 16

Q3 is in the 3(9+1)/4 = 7.5 position of the ranked data,


so Q3 = 19.5
Box and Whisker Plot
Box-and-Whisker Plot: A Graphical display of data
using 5-number summary:

Minimum* -- Q1 -- Median -- Q3 -- Maximum*

25% 25% 25% 25%

Minimum 1st Median 3rd Maximum


Quartile Quartile
Shape of Box-and-Whisker Plots
The Box and central line are centered between the
endpoints if data are symmetric around the
median.

 A Box-and-Whisker plot can be shown

in either vertical or horizontal format

Min Q1 Median Q3 Max


Distribution Shape and Box-and-Whisker Plot

Left-Skewed Symmetric Right-Skewed

Q1 Q2 Q3 Q1 Q2 Q3 Q1 Q2 Q3
Measure of Variation
Measures of Variation

Variation

Range Interquartile Variance Standard


Coefficient
Range Deviation
of Variation

 Measures of variation give


information on the spread
or variability of the data
values.

Same center but different variation


Range
 Simplest measure of variation

 Difference between the largest and the smallest


values in a set of data:

Range = Xlargest – Xsmallest

0 1 2 3 4 5 6 7 8 9 10 11 12 13 14

Range = 14 - 1 = 13
What are Disadvantages of the Range?
 Ignores the way in which data are distributed

7 8 9 10 11 12 7 8 9 10 11 12
Range = 12 - 7 = 5 Range = 12 - 7 = 5

 Sensitive to outliers
1,1,1,1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,3,3,3,3,4,5
Range = 5 - 1 = 4

1,1,1,1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,3,3,3,3,4,120
Range = 120 - 1 = 119
Interquartile Range
 Can eliminate some outlier problems by using
the interquartile range

 Eliminate some high- and low-valued


observations and calculate the range from the
remaining values
Interquartile range = 3rd quartile – 1st quartile
IQR = Q3 – Q1
Interquartile Range

Example:
Median X
X Q1 Q3 max
min (Q2)
25% 25% 25% 25%

12 30 45 57 70

Interquartile range
IQR= 57 – 30 = 27
Fences and Unusual Data Values
Inner fences
Lower fence: Q1 - 1.5 IQR
Upper fence: Q3 +1.5 IQR
Outer fences
Lower fence: Q1 - 3 IQR
Upper fence: Q3 + 3 IQR
 Values outside the inner
fences are unusual

 Values outside the outer


fences are outliers
Population Mean
 Population summary measures are called
parameters
 The population mean is the sum of the values in the
population divided by the population size, N
N

X i
X1  X 2    XN
 i 1

N N
Population Variance

 Average of squared deviations of values from


the mean N

 (X  μ)
i
2

Population variance: σ  i1


2

N
Population Standard Deviation
N

 i
(X  μ)2

σ i1
N

Standard deviation is most commonly used


measure of variation. It shows variation about the
population mean and has the same units as the
original data.
Sample Mean

Sample summary measures are called


statistics.
 The sample mean is the sum of the values
in the sample divided by the sample size:
σ𝑛𝑖=1 𝑋𝑖
𝑋ത =
𝑛
Sample Variance
 Average (approximately) of squared deviations
of values from the mean
n

 (X i  X) 2

 Sample variance: S2  i 1
n -1
Sample Standard Deviation

The sample standard deviation is most commonly


used measure of variation. It shows variation about
the mean and has the same units as the original
data.
n

 (X  X)
i
2

S i1
n -1
Calculation Example: Sample Standard Deviation
Sample
Data (Xi) : 10 12 14 15 17 18 18 24
n=8 Mean = X = 16

(10  X )2  (12  X )2  (14  X )2    (24  X )2


S
n 1

(10  16) 2  (12  16) 2  (14  16) 2    (24  16) 2



8 1

130 A measure of the “average”


  4.3095
7 scatter around the mean
Measuring variation

Small standard deviation

Large standard deviation


Comparing Standard Deviations

Mean = 15.5
11 12 13 14 15 16 17 18 19 20 21 S = 3.338

Mean = 15.5
11 12 13 14 15 16 17 18 19 20 21 S = 0.926

Mean = 15.5
11 12 13 14 15 16 17 18 19 20 21 S = 4.567
Advantages of Variance and Standard Deviation

 Each value in the data set is used in the


calculation

 Values far from the mean are given extra


weight
Coefficient of Variation
Comparing Coefficient of Variation

Both stocks
have the
same
standard
deviation,
but stock B
is less
variable/var
iant relative
to its price
Shapes of Distribution
Shape of a Distribution

 Describes how data are distributed

 Measures of shape:
 Symmetry / asymmetry

 Peakedness
Skewness
Measure symmetry/asymmetry of a distribution
Skewness
Kurtosis
Measure peakedness of a distribution
Measures of Center and Shapes
Compare mean and median or look at histogram
to determine degree of skewness.
Using Microsoft Excel

 Descriptive Statistics can be obtained


from Microsoft® Excel
 Use menu choice:
tools / data analysis / descriptive statistics

 Enter details in dialog box


Using Excel

Use menu choice:


tools / data analysis /
descriptive statistics
Using Excel

 Enter dialog box


details

 Check box for


summary statistics

 Click OK
Excel Output
Microsoft Excel
descriptive statistics output,
using the house price data:

House Prices:

$2,000,000
500,000
300,000
100,000
100,000
Standardized Data
Why it need to Standardize data Scores?
Z-score is a measure of distance from the mean

Formula for a Population Formula for a Sample

A Z score above 2.0 or below -2.0 is considered an unusual

A Z score above 3.0 or below -3.0 is an outlier


Example. If the mean is 14.0 and the standard
deviation is 3.0, what is the Z score for the value
18.5?

X  X 18.5  14.0
Z   1.5
S 3.0
 The value 18.5 is 1.5 standard deviations above
the mean

Remark: A negative Z-score would mean that a


value is less than the mean.
How to find Proportion of Values in a Data Set?

If you have a mean and standard deviation, in


order to know the proportion of values that lie
within, say, plus and minus two standard
deviations of the mean, we could use
• Chebyshev’s Theorem
• Empirical Rule.
What are these rules like?
Chebyshev Rule
 Regardless of how the data are distributed,
at least (1 - 1/k2) x 100% of the

values will fall within k standard

deviations of the mean (for k > 1)

At least within

(1 - 1/12) x 100% = 0% ……..... k=1 (μ ± 1σ)


(1 - 1/22) x 100% = 75% …........ k=2 (μ ± 2σ)
(1 - 1/32) x 100% = 89% ………. k=3 (μ ± 3σ)
Examples
The Empirical Rule
 If the data distribution is approximately bell-
shaped, then the interval:

 μ  1σ contains about 68% of the values in


the population or the sample

68%

μ
μ  1σ
The Empirical Rule
 μ  2σ contains about 95% of the values in
μ  3σ the population or the sample contains
about 99.7% of the values in the population or the
sample

95% 99.7%

μ  2σ μ  3σ

Outliers are observations that lie beyond  + 3s.


Example. The mean monthly rent of students at
Oxnard University is $875 with a standard deviation
of $219.
(a) John’s rent is $1,325. What is his z-score?
(b) Is John’s rent an outlier?
(c) How high would the rent have to be to qualify as
an outlier?
Group Data
Weighted Mean
Approximations for Grouped Data
Approximations for Grouped Data

i i
f (m  μ)2

σ2  i 1
N

i i
f (m  x) 2

s2  i1
n 1
Example – Grouped Data
Group Mid-point (m) Frequency (f)

From 0 to below 10 5 4

From 10 to below 20 15 5

From 20 to below 30 25 3

From 30 to below 40 35 2

Mean = 17.14
Population variance = 102.55
Population std. = 10.13
Linear Relationship
The Covariance
 The covariance measures the strength of the
linear relationship between two variables
 The Population Covariance:
n

(X i  X )(Yi  Y )
s XY  cov ( X , Y )  i 1
N

 The Sample Covariance:


n

(X i  X )(Yi  Y )
s XY  cov ( X , Y )  i 1
n 1
Interpreting Covariance

 Covariance between two random variables:


cov(X,Y) > 0 X and Y tend to move in the same direction.

cov(X,Y) < 0 X and Y tend to move in opposite directions.

cov(X,Y) = 0 X and Y are independent.

 Only concerned with the strength of the relationship .


 No causal effect is implied.
Coefficient of Correlation
 Measures the relative strength of the linear
relationship between two variables
 Sample coefficient of correlation:

cov (X, Y)
r
SX SY
where
n

 (X  X)(Y  Y)
n n
i i  (X  X)
i
2
 (Y  Y )
i
2

cov (X , Y)  i1
SX  i1
SY  i1
n 1 n 1 n 1
Equivalent Formula

 (X i  X)(Yi  Y)
r i 1
n n

 i
(X
i 1
 X ) 2
 i
(Y
i 1
 Y ) 2
Features of Correlation Coefficient, r
 Unit free

 Ranges between –1 and 1

 The closer to –1, the stronger the negative linear


relationship

 The closer to 1, the stronger the positive linear


relationship

 The closer to 0, the weaker the linear relationship


Scatter Plots of Data with Various Correlation Coefficients

Y Y Y

X X X
r = -1 r = -.6 r=0
Y
Y Y

X X X
r = +1 r = +.3 r=0
Using Excel to Find the Correlation Coefficient

 Select
Tools/Data Analysis
 Choose Correlation from
the selection menu
 Click OK . . .
Using Excel to Find the Correlation Coefficient

 Input data range and select


appropriate options
 Click OK to get output
Interpreting the Result
 r = .733

Scatter Plot of Test Scores


 There is a relatively
100

strong positive linear 95

Test #2 Score
90

relationship between 85

80

75
test score #1 70
70 75 80 85 90 95 100

Test #1 Score
and test score #2

 Students who scored high on the first test tended to score


high on second test, and students who scored low on the
first test tended to score low on the second test.
-- The End of Topic --
Thank You!

You might also like