0% found this document useful (0 votes)
4 views15 pages

Module 1 SDA Notes

The document is a lecture note from BITS-Pilani, Hyderabad, covering the basics of statistical data analysis, including notations, types of variables, data types, scales of measurement, and concepts of population and sample. It explains the mean, median, mode, percentiles, quartiles, and outliers, providing definitions and examples for each statistical measure. The content is structured to facilitate understanding of data representation and analysis in a statistical context.

Uploaded by

f20240192
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)
4 views15 pages

Module 1 SDA Notes

The document is a lecture note from BITS-Pilani, Hyderabad, covering the basics of statistical data analysis, including notations, types of variables, data types, scales of measurement, and concepts of population and sample. It explains the mean, median, mode, percentiles, quartiles, and outliers, providing definitions and examples for each statistical measure. The content is structured to facilitate understanding of data representation and analysis in a statistical context.

Uploaded by

f20240192
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

1

BITS-PILANI, HYDERABAD

STATISTICAL DATA ANALYSIS: MAC F313

Instructor: Dr. Harsha K V, Dept. Of Mathematics

Module 1: Graphical Representation of Data

I. N OTATIONS

• A set is a well defined collection of objects or elements.


• The set of all real numbers is denoted by R. Any element of R, we write x ∈ R.
• Z = {. . . , −2, −1, 0, 1, 2, . . .} is the set of all integers.
• N = {1, 2, . . .} is the set of all natural numbers.
Q = m

• n : m, n ∈ Z, n 6= 0 is the set of all rational numbers (Here the notation “:” means

“such that”)
• For two numbers a < b, the open interval (a, b) = {x ∈ R : a < x < b}, and closed interval
[a, b] = {x ∈ R : a ≤ x ≤ b}.

Cardinality of a set is the number of elements in the set.

• Finite set : A set which has only finite number of elements, e.g. A = {1, 4, 3, 6}, here cardinality
of A is 4.
• Infinite set:

– Countably infinite: you can list the elements of a set A as {a1 , a2 , . . .}, e.g. N = {1, 2, . . .} or
integers Z = {. . . , −2, −1, 0, 1, 2, . . .} why?
– Uncountable: A set is uncountable if it is not countable. e.g., intervals (0, 1), or [0, 1], or R.

DATA T YPES AND C LASSIFICATION

• Data: Facts and figures, collected, analyzed, and summarized for presentation and interpretation.
• Data set: All the data collected in a particular study.
• Experimental unit/ Element: An entity on which a variable is measured (or data is collected)
• Variable: An attribute or characteristic of interest for the elements.
• Observation: The set of measurements obtained for a particular element.
2

A. Types of Variables

A variable can be classified into two categories:

• Qualitative (Categorical) variable: variables which are not measured in numerical terms (what
type or category). Examples, political affiliations, color, gender, restaurant rankings, language etc.

– Nominal: Data that represents categories with no inherent order. Example, Gender: Male,
Female, Other genders (no particular order for gender, you can rearrange the data).
– Ordinal: Data that consists of categories with a meaningful order or ranking, but differences
between values are not measurable. Example, Education level: High School < Bachelor’s <
Master’s < PhD (You can rank or order the data, but cannot quantify the gap between ranks).

• Quantitative (Numerical) variable: measures of values or counts which are expressed as numbers,
and calculations are possible on them. (e.g. how many, how much or how often). Examples, number
of students in a class, weight, height etc. There are two types of quantitative variables:

– Discrete: A discrete variable takes a finite or countably infinite number of distinct values. The
possible values can be counted or listed. Examples: number of students in a class, number of
cars owned, number of defects in a product.
– Continuous: A continuous variable can take any value within a given range or interval.
Examples: height, weight, temperature, and time.

B. Data Types

• Cross-sectional data: Data collected from different elements/subjects at a single point in time.
Example: Heights of 4 students measured in 2026.

Student Height (cm)


A 165
B 172
C 168
D 180
• Time-series data: Data collected for a single variable or entity at different points in time.
Example: India’s GDP measured from 2022 to 2025.
3

Year GDP
2022 3.4
2023 3.7
2024 3.9
2025 4.1
• Panel /Pooled /Longitudinal Data: Data containing observations on multiple elements/subjects over
multiple points in time.
Example: Annual profits of several companies over several years.

Company Year Profit


A 2024 50
A 2025 55
A 2026 60
B 2024 40
B 2025 45
B 2026 48

C. Scale of Measurement

A scale of measurement describes how the values of a variable are measured, classified, and interpreted.
There are four types of measurement scales:

• Nominal Scale: A scale used to classify data into categories with no inherent order or ranking. The
categories are simply labels or names. Examples: Gender, blood group, political affiliation, color,
nationality.
• Ordinal Scale: A scale in which data are classified into categories that have a meaningful order or
ranking. However, the differences between the categories cannot be measured or are not necessarily
equal. Examples: Education level (High School < Bachelor’s < Master’s < PhD), satisfaction level
(Poor < Average < Good < Excellent), class rank.
• Interval Scale: A numerical scale in which values have a meaningful order and equal intervals
between consecutive values, but there is no true or absolute zero. Therefore, differences can
be meaningfully compared, but ratios are not meaningful. Examples: Temperature in Celsius or
Fahrenheit, calendar years.
4

• Ratio Scale: A numerical scale that has all the properties of the interval scale and also has a true or
absolute zero. Both differences and ratios are meaningful. Examples: Height, weight, age, income,
distance, and number of students.
Continuous

Quantitative
Ratio
Discrete

Variable Interval
Scale of Measurement
Ordinal
Ordinal
Qualitative

Nominal Nominal

D. Population and Sample

• A population is the entire group of individuals, items, or data points that you’re interested in studying.
(See Fig.1)
• A sample is a subset of the population, selected for analysis.

As an example, if you are studying the heights of all students in a university, the population includes every
student at that university. Measuring the heights of 100 students randomly selected from the university
can be taken as a sample. The number of observations in a population is denoted by N and the
number of observations in a sample is denoted by n.

II. M EAN , M EDIAN , M ODE

Arithmetic mean (A.M):

• Case 1: For n observations, x1 , · · · , xn , the mean denoted by x̄ is defined as


Pn
x1 + . . . + xn xi
x̄ = = i=1 . (1)
n n
• Case 2: For n observations, x1 , · · · , xn , if the frequency fi (here frequency fi means how many
times xi occurs) of each observation xi is given, then the mean is defined as
Pn
x1 f1 + . . . + xn fn xi fi
x̄ = = Pi=1
n . (2)
f1 + . . . + fn i=1 fi
5

Fig. 1: Picture courtesy: [Link]

The population mean is denoted by the Greek letter µ (pronounced as “mu” ) and sample mean by
x̄.
N
1 X
µ = xi
N
i=1
n
1X
x̄ = xi .
n
i=1

Example 1:
Observation frequency fi xi fi
xi

0 7 0
1 3 3
2 4 8
3 5 15
4 6 24
P P
fi = 25 xi fi = 50
50
Here mean is x̄ = 25 = 2.

Mode: Mode is the value which occurs most frequently in a set of observations and around which the
other items of the set cluster densely. For example: For the data set, 2,5,6,6,7,8,6,6, mode is 6.
6

Median (Med): Let x1 , . . . , xn are n observations arranged in an ascending order. Then the median,
denoted by x̃, can be obtained as follows.

 n+1 th term

if n is odd

2
x̃ = n th
. (3)
 ( 2 ) term +( 2 +1) term
n th
if n is even.

2

The population median is denoted by µ̃ and sample median is denoted by x̃. Examples will be discussed
in the next section.

III. P ERCENTILES

When a data (no. of observations is n) is arranged in an ordered sequence (ascending order in our case),
it can be divided into 100 parts by using 99 values known as Percentiles denoted by P1 , P2 , · · · , P99 .
The k th percentile Pk is computed as follows: There are two-methods to compute percentiles.
1) Percentile Position Formula:
k
• Define, rank = 100 × (n + 1), where k = 1, · · · , 99.
• If the rank is a whole number, take that value as Pk .
• If rank is a decimal (say rank= r.d), interpolate between the rth and (r + 1)th data values, and
define Pk using the formula as

Pk = rth term + decimal part × (r + 1)th term − rth term .


 
(4)

Example 2: 11, 18, 24, 33, 47, 59, 61, 72, here n = 8.
• 25th -percentile: P25 : Here k = 25.
25
– First find rank= 100 × 9 = 2.25. Here r = 2, and decimal part is d = 0.25.
– P25 = 2nd term + 0.25(3rd term − 2nd term) = 18 + 0.25 × (24 − 18) = 19.5.
• 50th -percentile P50 : Here k = 50.
50
– First find rank= 100 × 9 = 4.5.
– P50 = 4th term + 0.5(5th term − 4th term) = 33 + 0.5 × (47 − 33) = 40.
2) Type-7 Method (R programming uses this method!):
 k 
• Define, position = 100 × (n − 1) + 1, where k = 1, · · · , 99.

• If the position is a whole number, take that value as Pk .


• If position is a decimal (say rank= r.d), interpolate between the rth and (r + 1)th data values,
and define Pk using the formula as

Pk = rth term + decimal part × (r + 1)th term − rth term .


 
(5)
7

Example 2 (Type-7 method): 11, 18, 24, 33, 47, 59, 61, 72, here n = 8.
• 25th -percentile: P25 : Here k = 25.
25
– First find position= ( 100 × 7) + 1 = 2.75. Here r = 2, and decimal part is d = 0.75.
– P25 = 2nd term + 0.75(3rd term − 2nd term) = 18 + 0.75 × (24 − 18) = 22.5.
• 50th -percentile P50 : Here k = 50.
50
– First find position= ( 100 × 7) + 1 = 4.5.
– P50 = 4th term + 0.5(5th term − 4th term) = 33 + 0.5 × (47 − 33) = 40.

IV. Q UARTILES AND O UTLIERS

When a data (no. of observations is n) is arranged in an ordered sequence (ascending order in our
case), it can be divided into 4 parts by using 3 values known as quartiles denoted by Q1 , Q2 , Q3 . Note
that Q1 = P25 , Q2 = P50 , and Q3 = P75 .
Interquartile range (IQR): Interquartile range (IQR) and quartile deviation are defined as

Interquartile range (IQR) = Q3 − Q1


Q3 − Q1
Quartile deviation (Q.D) = .
2
There are different methods to calculate quartiles:
1) Percentile Position Method In this case, rank = k4 × (n + 1), where k = 1, 2, 3.
Example: 11, 18, 24, 33, 47, 59, 61, 72, here n = 8.
• First quartile Q1 :
n+1
– First find 4 = 2.25.
– Q1 = 2nd term + 0.25(3rd term − 2nd term) = 18 + 0.25 × (24 − 18) = 19.5.
• Second quartile or median Q2 :
2(n+1)
– First find 4 = 4.5.
– Q2 = 4th term + 0.5(5th term − 4th term) = 33 + 0.5 × (47 − 33) = 40.
• Third quartile Q3 :
3(n+1)
– First find 4 = 6.75.
– Q3 = 6th term + 0.75(7th term − 6rd term) = 59 + 0.75 × (61 − 59) = 60.5.
2) Type-7 Method (Default method in R for Quantile!) In this, define position = k4 × (n − 1) + 1,
 

where k = 1, 2, 3. In the above example, 11, 18, 24, 33, 47, 59, 61, 72, here n = 8.
• First quartile Q1 : k = 1
8

k
× (n − 1) + 1 = 14 × 7 + 1 = 2.75.
  
– First find 4

– Q1 = 2nd term + 0.75(3rd term − 2nd term) = 18 + 0.75 × (24 − 18) = 22.5.

• Second quartile or median Q2 : k = 2

– First find 24 × 7 + 1 = 4.5.


 

– Q2 = 4th term + 0.5(5th term − 4th term) = 33 + 0.5 × (47 − 33) = 40.

• Third quartile Q3 : k = 3

– First find 43 × 7 + 1 = 6.25.


 

– Q3 = 6th term + 0.25(7th term − 6rd term) = 59 + 0.25 × (61 − 59) = 59.5.

3) Half Method/Tukey’s Method (Default method in R for Boxplot!). In the above example data,
11, 18, 24, 33, 47, 59, 61, 72, we compute the quartiles as follows:
33+47
• First find median or Q2 using Equation (3). Here n = 8 is even, so Q2 = 2 = 40.
• Then consider lower half = {11, 18, 24, 33}, find Q1 as median of this lower half. We get
18+24
Q1 = 2 = 21.
• Now consider upper half = {47, 59, 61, 72}, find Q3 as median of this upper half. We get
59+61
Q3 = 2 = 60.

Example: Data is 10, 12, 13, 14, 15, 16, 17, 18, 50, n = 9 (odd no. of observations)

• First find median or Q2 using Equation (3). Here n = 9 is even, so Q2 = 15.


• Then consider lower half = {10, 12, 13, 14, 15}, find Q1 as median of this lower half. We get
Q1 = 13.
• Now consider upper half = {15, 16, 17, 18, 50}, find Q3 as median of this upper half. We get
Q3 = 17.

Remark 1: Note that, we have quartiles values using three different methods for the data set
11, 18, 24, 33, 47, 59, 61, 72:

Quartiles Percentile Tukey’s Method Type-7 Method


Method (Boxplot R) (Quantile R)

Q1 19.5 21 22.5
Q2 40 40 40
Q3 60.5 60 59.5
9

All methods are valid, even though the results may differ slightly! You can use any of
these methods to compute quartiles!
Outliers: Outliers in a data set can be defined using IQR.
• By IQR method: Find quartiles Q1 , Q3 , and define an interval

[a, b] = [Q1 − (1.5 × IQR), Q3 + (1.5 × IQR)], where IQR = Q3 − Q1 .

The data points which are outside this interval [a, b] are called as an outliers (also called as Mild
outliers). The data points which are above Q3 + (3 × IQR) or below Q3 − (3 × IQR) are called
Extreme Outliers.
Example: For the data 10, 12, 13, 14, 15, 16, 17, 18, 50, Q1 = 13, Q2 = 15, Q3 = 17, Hence IQR =
Q3 − Q1 = 4. [a, b] = [Q1 − (1.5 × IQR), Q3 + (1.5 × IQR)] = [7, 23]. As 50 > 23, 50 is the outlier
in the data set. In fact, 50 is an extreme outlier (Verify!).

a b

V. M EASURES OF D ISPERSION

Range: For a given data,

Range (R) = Highest value of the observation − Lowest value of the observation = H − L.

Variance and Standard deviation:


The population variance is denoted by σ 2 (where σ is pronounced as “sigma” ) and sample variance
is denoted by s2 , which are defined as follows:
N PN 2 ! N
2 1 X 2 i=1 xi 1 X
σ = (xi − µ) = − µ2 , where µ = xi .
N N N
i=1 i=1
n n
1 X 1X
s2 = (xi − x̄)2 , where x̄ = xi .
n−1 n
i=1 i=1
The standard deviation (S.D) is the positive square root of the variance. The population standard
deviation is denoted by σ and sample standard deviation is denoted by s.
The sum of squared deviations or sum of squares (SS) is given by
n n
!
X X
2
Sxx = (xi − x̄) = xi − n(x̄)2 .
2
(6)
i=1 i=1
10

If for each observation xi , frequency fi is given, then the term Sxx is given by
!
X
2
X 1X X
Sxx = fi (xi − x̄) = fi xi − n(x̄)2 , where x̄ =
2
fi xi , and n= fi .
n
i i i
Sxx
Sample variance is s2 = n−1
Example 4: Calculate mean, standard deviation for the following sample data?

xi Frequency fi fi xi fi x2i

5 12 60 300
15 18 270 4050
25 27 675 16875
35 20 700 24500
45 17 765 34425
55 6 330 18150

Total 100 2800 98300


P
i fi x i 2800
Here mean is x̄ = P
fi = 100 = 28.
The sample variance is given by
" #
2 1 X
2 2
s = fi xi − n(x̄)
n−1
i
1 
98300 − (100 × 282 ) = 201.01

=
99

This implies sample S.D is given by s = 201.01 = 14.77.

VI. DATA V ISUALIZATION

Stem and leaf Plot:


Dataset of test scores out of 100 is given as 43, 46, 47, 51, 52, 53, 55, 61, 62, 67, 71, 73. The stem and
leaf plot is given below with Leaf unit=1 (Leaf unit 1 means each leaf in the stem-and-leaf plot represents
the ones place (the last digit) of the number).

Stem Leaf
4 367
5 1235
6 127
7 13
11

Example, 4|3 in the plot, that is, stem 4, leaf 3 means the number 43.
Example 5 Dataset is given as 2.3, 2.5, 2.7, 3.1, 3.4, 3.5, 3.9, 6.3, 6.8. The stem and leaf plot is given
below with Leaf unit=0.1 (Leaf unit 0.1 means each leaf in the plot represents the tenth place (first digit
after decimal) of the number).

Stem Leaf
2 357
3 1459
6 38

Example, 2|3 in the plot, that is, stem 2, leaf 3 means the number 2.3.
Box Plot:
• Arrange data (no. of observations is n) in an ascending order from smallest to the largest.
• Find mean x̄, and quartiles Q1 , Q2 , Q3 .
• Find outliers using IQR method.
• Find the minimum value of the dataset excluding the outliers. That is, Min = smallest data point ≥
Q1 − 1.5 × IQR.
• Find the maximum value of the dataset excluding the outliers. That is, Max = largest data point ≤
Q3 + 1.5 × IQR.
• Draw a box from Q1 to Q3 , by marking median with a solid line. Also mark the mean with a dashed
line inside the box. Then draw “Whiskers” from Min to Q1 , and from Q3 to Max. Mark outliers if
any.
Example 6: Dataset is 2, 5, 6, 8, 9, 12, 13, 18, 19, 21, 22, 60.
Here n = 12, and x̄ = 16.25. Quartiles are Q1 = 7, Q2 = 12.5, Q3 = 20, and IQR = 13, and

[Q1 − (1.5 × IQR), Q3 + (1.5 × IQR)] = [−12.5, 39.5].

This implies that 60 is an outlier. Since there are no outliers less than −12.5, we get Min = 2.

Max = largest data point ≤ 39.5

= 22.

Box plot for this data is given in Fig 2.

Bar Graph: Bar graph is for qualitative data. In bar graph, categories are shown on the x-axis (horizontal)
or y-axis (vertical). Bars are separated by spaces (unlike in histograms). Bars can be vertical or horizontal.
12

Q1 Q2 x̄ Q3
Min Max Outlier

−5 0 5 10 15 20 25 30 35 40 45 50 55 60

Fig. 2: Box Plot

In the example, the frequency of each category is marked along the y -axis. Relative frequency or
percentage frequency can also be taken along y -axis.
P
Example 8: Here we have, total number of observations n = i fi = 17.

Categories Frequency
fi

Apple 7
Banana 4
Pear 6
P
fi = 17

The bar graph for the above data is given by

4
Frequency
3

Apple Banana Pear

Fig. 3: Bar Graph

Pie Chart: For the same data, the pie chart is given as follows: Note that, total no of units is n = 17, and
◦
the total angle is 360◦ . Then, 1 unit corresponds to angle of 360
n . So for Apple 7 units corresponding
13

to approximate angle of 148.232 degree, and percentage 41.2%.

Pear

35.3%

41.2% 23.5%

Apple
Banana

Fig. 4: Pie Chart

Histogram: Histogram is for quantitative data. There are two types, one for discrete data and other for
continuous data.
In histogram, we plot the data in (x, y)-plane, with data values are marked along x-axis. The frequency
of each observation or class is marked along the y -axis. Relative frequency or percentage frequency can
also be taken along y -axis. We first discuss examples with equal class interval width.
Example 5 (Discrete Data): The following data gives the number of courses taken by each student in a
P
semester (x). Here we have, total number of observations n = i fi = 25.

Observation Frequency Relative Percentage


xi fi Frequency Frequency
fi fi
25 25 × 100%

0 7 0.28 28%
1 3 0.12 12%
2 4 0.16 16%
3 5 0.2 20%
4 6 0.24 24%
P
fi = 25

The histogram plot is given by


P
Example 7 (Continuous Data): Here we have, total number of observations n = i fi = 25.
14

4
Frequency
3

0 1 2 3 4
x

Fig. 5: Histogram: Discrete data

Observation Frequency Relative Percentage


class fi Frequency Frequency
fi fi
25 25 × 100%

[0, 10) 7 0.28 28%


[10, 20) 3 0.12 12%
[20, 30) 4 0.16 16%
[30, 40) 5 0.2 20%
[40, 50) 6 0.24 24%

The histogram plot is given by

4
Frequency
3

0 10 20 30 40 50
x

Fig. 6: Histogram: Continuous data


15

Histogram with unequal class width:


When class intervals have unequal widths, the height of each histogram bar is represented by the
frequency density.
Frequency Density:
Frequency
Frequency Density =
Class Width
• For example, consider the following frequency distribution:

Class Interval Frequency Class Width Frequency Density


20
0 − 10 20 10 10 = 2
30
10 − 30 30 20 20 = 1.5
20
30 − 40 20 10 10 = 2

• In an unequal-width histogram:

Height of bar = Frequency Density

Hence
Area of bar = Class Width × Frequency Density = Frequency

Draw the histogram for this example as a practice problem.

You might also like