Statistical Data Collection
Observational studies Experimental studies
• Measure or survey members of a • Uses control group and an experiment
sample without trying to affect the group. Parameters are changed in the
members or manipulating the experiment group.
variables.
• Testing the effectiveness of a drug.
• Does smoking causes lung cancer ? • Does salt water cause more corrosion
• What is the life expectancy of a in iron?
neutron star ?
Variables
• Independent vs Dependent variables
• Quantitate vs Qualitative variables
• Continuous vs Discrete variables
Data Types in Statistics
Interval
Ratio Scale
Scale
Qualitative Data
• Qualitative data describes qualities or characteristics
• Qualitative data is information that cannot be counted, measured or
easily expressed using numbers
• It is collected using questionnaires, interviews, or observation, and
frequently appears in narrative form.
Qualitative Data
Nominal Data
Qualitative Data
Ordinal Data
Qualitative Data
Nominal Data :
• can categorize your data by labelling them in mutually exclusive groups, but there is no
order between the categories
• E.g. Country, Language, Color, Gender, City of birth, Ethnicity, Car brands
Ordinal Data:
• You can categorize and rank your data in an order but can’t get a precise mathematical
difference between levels.
• E.g. Opinions (Highly agree…Highly disagree) Satisfaction (high, middle, low)
Quantitative Data
Quantitative data is represented numerically
Can be measured or expressed as a number.
• Discrete Data
Discrete Data
• Counted
• E.g.: Number of students in class
Quantitative Data Ration Scale
• Continuous Data
Continuous
• Uses real numbers
Interval Scale • E.g. : Height of a student
Quantitative Data
Discrete Data
• Counted
• Can take on only particular values
• E.g.: Number of students in class
Continuous Data
• Can take on any value in an interval
• Could have any number of decimals
• Uses real numbers
• E.g. : Height of a student
Continuous Data
Interval Data
• Intervals of equal length signify equal differences in the characteristic
The difference in 90° and 100° Fahrenheit is the same as the difference between 80° and
90° Fahrenheit.
• Differences make sense, but ratios do not
100° Fahrenheit is not twice as hot as 50° Fahrenheit.
• Occurs when a numerical scale does not have a ‘true zero’ start point
Zero does not signify an absence of the characteristic.
" Does 0° Fahrenheit represent an absence of heat?
Interval Data
• IQ tests (interval scale).
We don’t have meaning for a 0 IQ.
A 120 IQ is not twice as intelligent as a 60 IQ
• Calendar years (interval scale).
An interval of one calendar year (2005 to 2006, 2014 to 2015) always has the same
meaning.
But ratios of calendar years do not make sense because the choice of the year 0 is
arbitrary and does not mean “the beginning of time.
Calendar years are therefore at the interval level of measurement.
Ratio level (even more meaning than interval level)
At this level, both differences and ratios are meaningful.
Two 2 oz glasses of water IS equal to one 4 oz glass of water " 4 oz of water is twice
as much as 2 oz of water.
Occurs when scale does have a ‘true zero’ start point.
" 0 oz of water is a ‘true zero’ as it is empty, absence of water.
Ratios involve division (or multiplication) rather than addition or subtraction
Continuous Data
Interval Data Ratio Data
• signifies 'space in between’. • Has a True zero
• No true zero (zero is subjective)
• Can be negative • E.g. Height, Weight.
Temperature in Kelvin
• E.g. : Time of the day, Date
Temperature in Celsius (is 10C twice
cold as 20C?)
What Can be Calculated
Calculation Type Nominal Ordinal Interval Ratio
Frequency distribution Yes Yes Yes Yes
Median and percentiles No Yes Yes Yes
Add or subtract No No Yes Yes
Mean, standard deviation,
No No Yes Yes
standard error of the mean
Ratios, coefficient of
No No No Yes
variation
Statistical Graphics
• Display results in a pictorial form
• Objectives
1. The exploration of the content of a data set
2. The use to find structure in data
3. Checking assumptions in statistical models
4. Communicate the results of an analysis.
Scatter plots
• A scatter plot identifies a possible relationship between changes
observed in two or more different sets of variables
Histogram
• an approximate representation
of the distribution of numerical
data
Bin/Interval Count/Frequency
−3.5 to −2.51 9
−2.5 to −1.51 32
−1.5 to −0.51 109
−0.5 to 0.49 180
0.5 to 1.49 132
1.5 to 2.49 34
2.5 to 3.49 4
It is used to summarize discrete or continuous data that are measured on an
interval scale.
The area inside the box (50% of the data) is known as the Inter Quartile Range. (IQR)
The IQR is calculated as
IQR = Q3-Q1
Interquartile range (IQR)
Quartiles
Quartiles are a kind of quantile that divides the number of data points into four parts, or
quarters.
•The first quartile (Q1) , is defined as the middle number between the smallest number
and the median of the data set,
•The second quartile (Q2) is the median of the given data set.
•The third quartile (Q3) is the middle number between the median and the largest value
of the data set.
The IQR is calculated as IQR = Q3-Q1
What is the quartile formula in mathematical terms?
Question 1: Find the quartiles of the following data: 4, 6, 7, 8, 10, 23, 34.
Question 2: Find the Quartiles of the following age:-
23, 13, 37, 16, 26, 35, 26, 35
Determine the median, first quartile, third quartile and also the interquartile range for the given data set:
34, 36, 38, 35, 38, 43, 41, 40, 47.
Box plot
• Box plots (also called box-and-whisker plots or box-whisker plots) give a good
graphical image of the concentration of the data.
• They also show how far the extreme values are from most of the data
• A box plot is constructed from five values
• minimum value (without outliers)
• first quartile
• median
• third quartile
• maximum value (without outliers)
This type of plot is used to easily detect outliers. It can also tell us if your data is symmetrical, how tightly your
data is grouped, and if and how your data is skewed.
Outlier: The data that falls on the far left or right side of the ordered data is tested to be the
outliers. Generally, the outliers fall more than the specified distance from the first and third
quartile.
(i.e.) Outliers are greater than Q3+(1.5 * IQR) or less than Q1-(1.5 * IQR).
Maximum : Q3+(1.5 * IQR)
Minimum : Q1- (1.5 * IQR)
Boxplot Distribution
The box plot distribution will explain how tightly the data is grouped, how the data is skewed,
and also about the symmetry of data.
Example
Let’s use the following dataset:
10, 12, 14, 15, 16, 18, 20, 22, 24, 26, 100
•Minimum: 10
•Maximum: 100
•Median (Q2): 18
•First Quartile (Q1): 14
•Third Quartile (Q3): 24
•Interquartile Range (IQR): Q3 - Q1 = 24 - 14 = 10
•Lower Bound for Outliers: Q1 - 1.5 × IQR = 14 - 15 = -1
•Upper Bound for Outliers: Q3 + 1.5 × IQR = 24 + 15 = 39
•Outliers: 100 (since it exceeds the upper bound of 39)
Consider the following set of data:
53,46,25,50,30,30,40,30,47,109
Draw a Box plot
Step 3: Identify Outliers
Outliers are data points that fall below Q1 - 1.5 × IQR or above Q3 +
1.5 × IQR, where IQR (Interquartile Range) is Q3 - Q1.
[Link] IQR:
[Link]=Q3−Q1=50−30=20IQR=Q3−Q1=50−30=20
[Link] the lower and upper bounds for outliers:
1. Lower Bound = Q1 - 1.5 × IQR = 30 - 1.5 × 20 = 30 - 30 = 0
2. Upper Bound = Q3 + 1.5 × IQR = 50 + 1.5 × 20 = 50 + 30 = 80
[Link] outliers:
25, 30, 30, 30, 40, 46, 47, 50, 53, 109 1. Any value below 0 or above 80 is considered an outlier.
2. In this dataset, 109 is above 80, so it is an outlier.
[Link]: 25
[Link] Quartile (Q1): 30.
[Link] (Q2): (40 + 46) / 2 = 43.
[Link] Quartile (Q3): 50.
[Link]: 109
Example
Bar Chart
• Presents categorical data with
rectangular bars with heights or
lengths proportional to the
values that they represent
Pie Chart
• A circular statistical graphic,
which is divided into slices to
illustrate numerical proportion
Regression Analysis
Correlation Vs Regression
• A correlation analysis: Provides information on
the strength and direction of the linear relationship between two variables.
• A Regression analysis : estimates parameters in a model that can be used
to predict values of one variable based on the others.
• Machine learning methods also provide methods (e.g. ANN) to
predict values of one variable based on the others
Correlation, it determines the interconnection or a co-relationship between the variables.
'Regression' explains how an independent variable is numerically associated with the
dependent variable
What is Regression Analysis
• Regression analysis is a set of statistical methods used for the estimation of
relationships between a dependent variable and one or more independent
variables
• Processes for estimating the relationships between a dependent variable
and one or more independent variables.
• Dependent variable = ‘outcome' or 'response' variable
• Independent variables = 'predictors', 'covariates', 'explanatory variables' or
'features’
Types of Regressions
Simple Linear
Linear regression
Multivariate Linear
Regression Nonlinear Regression
Segmented regression
Simple Linear Regression
• One dependent variable and one independent variable
• Try to fit a straight line to data as accurately as possible.
• Model function is
𝑦 = 𝛽! + 𝛽" 𝑥
𝛽" is the slope and 𝛽! is the y intercept
•Each datapoint is described using
𝑦# = 𝛽! + 𝛽" 𝑥 + 𝜖#
𝑤ℎ𝑒𝑟𝑒𝑟 𝜖# 𝑖𝑠 𝑡ℎ𝑒 𝑟𝑒𝑠𝑖𝑑𝑢𝑎𝑙
Goal
• Estimate 𝛽! and 𝛽" that minimizes the sum of squared residuals in 𝜖#
𝜖# = −(𝛽! + 𝛽" 𝑥# ) + 𝑦#
% &
𝐹𝑖𝑛𝑑 𝑚𝑖𝑛𝑄 𝛽! , 𝛽" = Σ#$" 𝑦# − (𝛽! + 𝛽" 𝑥# )
• Estimates are denoted using a hat operator !
𝛽!, !
𝛽" , %𝜖
!! = 𝑦% − 𝛽
𝛽 !" 𝑥̅
∑%#$"(𝑥# −𝑥)(𝑦
̅ # − 𝑦)
!" =
𝛽
∑%#$"(𝑥# −𝑥)̅ &
Example
X Y
1 2
2 4
3 5
4 4
5 6
Using Excel