Statistics Ebook
Statistics Ebook
1. Introduction to statistics
● What is statistics?
● Types of statistics - Descriptive and Inferential
● Types of data
● Population and Sample
● Sampling Techniques
● Statistical Data Analysis Steps
es
2. Descriptive Statistics
3. Probability
● Types of events
o Disjoint or Non-Disjoint event
c
● Conditional Probability
● Bayes Theorem
● Probability Distributions
o Random Variables and its Types (Discrete & Continuous)
o PMF and PDF
● Discrete Distributions
o Binomial
o Bernoulli
● Continuous Distributions
o Uniform
o Normal
▪ Standard Normal Distribution
▪ Standardization
▪ Normalization
▪ Empirical Rule
4. Inferential Statistics
es
o Types of hypotheses: Null and Alternate
o Level of significance and p value
o Type of errors
o One tailed or two tailed test
ss
o Types of tests in statistics (z test, t test, ANOVA, Chi square etc)
la
What is statistics?
C
singular measurement.
To be more specific, here are some claims that we have heard on several occasions.
es
● Descriptive Statistics ss
Descriptive Statistics is a branch of statistics that deals with the collection,
la
presentation, and interpretation of data. The primary goal of this statistics is to
summarize and describe the main features of a dataset. This involves
organizing and simplifying large amounts of data in a meaningful way to make
C
it more understandable.
These statistics are the foundation for more advanced statistical analysis and
h
It includes the construction of graphs, charts, and tables, and the calculation
of various descriptive measures such as averages, measures of variation,
percentiles.
● Inferential Statistics
Inferential Statistics involves drawing conclusions or inferences about a
population based on information obtained from a sample of population. The
key idea is to use the information obtained from a representative sample to
make generalizations and predictions about the entire population.
Inferential statistics often involves the use of probability theory and statistical
methods to make probabilistic statements about population parameters. It
helps researchers make decisions, formulate policies and draw conclusions in
situations where it may be impractical or impossible to study an entire
population.
es
significantly different.
o Estimating the average height of a population with a 95% confidence
interval.
o Analysing the relationship between hours of study and exam scores.
ss
Descriptive and Inferential statistics are interrelated. It is almost always necessary to
use methods of descriptive statistics to organize and summarize the information
la
obtained from a sample before methods of inferential statistics can be used to make
more thorough analysis of subject under investigation.
C
Types of data
c h
Data can be broadly divided into different types based on its nature and
characteristics.
Te
es
● Type 1:
ss
o Structured: Structured data refers to data that is organized in rows
and columns and well-defined manner.
la
Examples: Tables in a relational database, spreadsheet
C
● Type 2:
Examples: Monthly sales data for a product over several years, daily
stock prices for a particular company over a month
● Type 3:
After analysing the type of data, identifying the type of variables is necessary and it
also comes under the types of data.
● Ordinal: Ordinal data represents categories with a clear order or ranking, but
the intervals between the categories are not uniform or meaningful.
es
Examples: Education levels, customer satisfaction ratings, no. of cars owned
by a household
ss
● Categorical: Categorical data represents categories and can be either
nominal or ordinal.
la
Examples: Types of cars, product categories
C
● Numerical: Numerical data includes both discrete and continuous data and
represents measurable quantities.
h
● Interval: Interval data has meaningful interval between values, but there is no
true zero point.
Te
● Ratio: Ratio data has meaningful interval between values and it has a true
zero point, indicating the absence of the attribute being measured.
es
ss
la
Population Sample
C
c h
Te
In statistical analysis, the goal is often to make inferences about a population based
on observations from a sample. Various sampling techniques and statistical methods
are employed to ensure that the sample is a fair and accurate representation of the
population of interest.
For good statistical analysis, the sample needs to be as similar as possible to the
population. If they are similar enough, we say that the sample is representative of the
population. The sample is used to make conclusions about the whole population. If
the sample is not similar enough to the whole population, the conclusions count as
useless.
The characteristics of a population are known as population parameters and
characteristics that describe a sample are called sample statistics.
Why are samples used?
- To reduce cost of data collection
- When a full census cannot be taken
Sampling Techniques
es
Sampling techniques are methods used to select a subset of elements (a sample)
from a larger population for the purpose of making inferences about that population.
Here are some common sampling techniques: ss
● Simple Random Sampling: Every individual or element in the population has
an equal chance of being included in the sample.
la
● Systematic Sampling: A fixed interval is used to select every kth element
from a list after a random starting point is chosen
C
Example: Selecting every 10th person from a list of names, first 20 and last 20
● Stratified Sampling: Population is divided into subgroups or strata based on
h
certain characteristics (e.g., gender, age) and then random samples are taken
from each stratum.
c
Clearly define the problem or research question you want to address. This
step is crucial for guiding the entire analysis process.
2. Data Collection:
es
Gather relevant data based on the research question. Data can be collected
through surveys, experiments, observations or from existing datasets.
3. Data Cleaning: ss
Check for errors, missing values, outliers, and inconsistencies in the data.
la
Clean and preprocess the data to ensure its quality and reliability.
5. Data Transformation:
Te
6. Hypothesis Formulation:
7. Statistical Testing:
Choose appropriate statistical tests based on the nature of your data and
research question. Common tests include t-tests, chi-square tests, ANOVA,
regression analysis, etc.
8. Interpretation of Results:
Analyse the results of your statistical tests. Determine whether the evidence
supports or contradicts your hypothesis. Consider the significance level and
confidence intervals.
9. Draw Conclusions:
Document all the steps, methods, and decisions made during the analysis.
es
This documentation is important for transparency, reproducibility, and future
reference. Prepare a report based on your conclusions, provide
recommendations for future action. Discuss the implications of your findings in
ss
the context of the original research question.
tends to cluster. The three main measures of central tendency are the mean, median
and mode.
h
1- Mean:
c
The mean, also known as the average, is calculated by adding up all the
Te
2+4+6+8+10
Example: For the dataset {2,4,6,8,10}, the mean is 5
=6
Properties:
2- Median:
The median is the middle value of a dataset when it is ordered from least to
greatest. If there is an even number of values, the median is the average of
the two middle values.
Example: For the dataset {3,1,5,7,9}, when ordered, becomes {1,3,5,7,9} and
the median is 5.
Properties:
3- Mode:
es
The mode is the value that occurs most frequently in a data set. A data set
may have no model (if no value is repeated), one mode (If one value is
repeated more than others), or multiple models (if more than one value is
repeated with the same frequency) ss
Example: In the set {4,2,8,6,2,9,2}, the mode is 2 because it appears more
la
frequently than any other value.
Properties:
C
Summary:
c
Measures of Dispersion
Dispersion is the degree of variation in the data. Measures of dispersion, also known
as variability or spread quantify the extent to which individual data points in a dataset
differ from the central tendency (mean, median or mode). They provide important
insights into the spread, scatter or distribution of the data. Two datasets of the same
variable may exhibit similar positions of center but may be remarkably different with
respect to variability. The main measures of dispersion include the range, IQR,
variance, quartiles, percentiles and standard deviation.
1. Range:
Properties:
es
small datasets
2. Quartiles
ss
Quartiles divide a dataset into four equal parts, with three quartiles, Q1, Q2
(median) and Q3. Q1 is the value below which 25% of the data falls, Q2 is the
median and the 50% of the data falls below it, and Q3 is the value below
la
which 75% of the data falls.
C
𝑛+1
Q1 is at position 4
𝑛+1
Q2 is at position
h
2
c
3(𝑛+1)
Q3 is at position 2
Te
Properties:
a. Useful for identifying the central tendency and spread of specific sections
of the data.
3. Percentiles:
Percentiles divide a dataset into 100 equal parts, with specific percentiles
representing the percentage of data below a given value. The 25th, 50th, and
75th percentiles are equivalent to the Q1, Q2 and Q3 quartiles, respectively.
𝑡ℎ 𝑃
𝑃 𝑃𝑒𝑟𝑐𝑒𝑛𝑡𝑖𝑙𝑒: 𝑉𝑎𝑙𝑢𝑒 = 100
𝑋(𝑁𝑢𝑚𝑏𝑒𝑟 𝑜𝑓 𝑜𝑏𝑠𝑒𝑟𝑣𝑎𝑡𝑖𝑜𝑛𝑠 + 1)
Properties:
a. Useful for comparing the position of a particular data point relative to the
entire dataset.
IQR is the range of the middle 50% of the data, representing the spread of the
central portion of the distribution.
IQR = Q3-Q1
Properties:
es
5. Variance
Variance measures the average squared deviation of each data point from the
mean.
𝑁
∑ (𝑋𝑖−μ)
2
ss
la
Variance = 𝑖=1
𝑁
Where Xi is the individual data points, N is the number of data points and µ is
C
Properties:
h
6. Standard deviation
Standard deviation is the square root of the variance and is expressed in the
same units as the original data.
It’s good to use std as it is in the same units as x and variance is in square
units.
Note:
Retailer A: $800
Retailer B: $850
Retailer C: $820
Retailer D: $855
Retailer E: $870
Retailer F: $855
Retailer G: $825
es
Retailer H: $865
Retailer I: $840
Retailer J: $810
ss
la
List = [800,850,820,855,870,855,825,865,840,810]
Ordered list = [800, 810, 820, 825, 840, 850, 855, 855, 865, 870]
C
Mean = 839
h
Median = 845
c
Mode = 855
Te
Range = 70
Variance = 576.67
Frequency
Frequency is the number of times a value of the data occurs. It is commonly used for
categorical data where you want to know how often each category occurs. Table
listing all classes and their frequencies is called a frequency distribution table.
Example: 1,3,3,2,4,1,2,2,1,2,3,5,4,1,2,1,3,1,4,1
1 7
2 5
3 4
4 3
5 1
es
A relative frequency is the ratio of the number of times a value of the data occurs in
ss
the set of all outcomes to the total number of outcomes. In other words, percentage
or proportion of the data value present in the dataset.
Cumulative frequency is a way to show the running total of frequencies as you move
C
through categories. It provides information about the number of data points that are
less than or equal to a certain value or category.
h
have categorized the complaints into four main types: Shipping Delays, Product
Quality, Billing Issues, and Returns. Here is a summary of the data:
Returns: 12 complaints
Returns 12 0.3125 45
Graphical Representations
Graphical representations play a crucial role in descriptive statistics, providing visual
insights into the distribution, frequency, central tendency and dispersion of data.
es
1. Histograms
- Helps visualize the shape, central tendency and spread of the data
- Useful for identifying patterns, potential outliers, and skewness.
h
▪
Tail on the right side ss
Mean is greater than the median
la
▪ Data concentrates on the left side, with a tail extending to the
right.
C
c h
Te
es
ss
la
Types based on number of modes:
C
o Unimodal Distribution
▪ One clear peak
c h
Te
o Bimodal Distribution
▪ Two distinct peaks
es
o Multimodal Distribution
▪ More than two peaks
ss
la
C
c h
Te
es
ss
la
3. Scatter Plots
C
relationships
- Relationships can be Positive, Negative or No correlation.
- Can be enhanced with regression lines to highlight trends.
es
ss
la
C
c h
Outliers are data points that deviate significantly from the rest of the dataset. These
values are notably different from the majority of the observations, can be unusually
high or low and often potential to skew the overall interpretation of the data.
Identifying and understanding outliers is a crucial aspect of data analysis, as they
can have a substantial impact on statistical analysis.
1. Identification of Outliers:
es
3. Effects on Inferential Statistics:
-
ss
Parametric Tests: Outliers may violate assumptions of normality in parametric
tests, leading to inaccurate results.
la
- Regression Analysis: Outliers can disproportionately impact regression
coefficients, affecting the model's predictive performance.
C
It indicates the direction of the relationship; it does not quantify the strength of the
relationship.
Correlation is a statistical measure that describes the extent to which two variables
change together. In other words, it quantifies the degree to which a change in one
variable is associated with a change in another variable. Correlation does not imply
causation, but it helps us understand the relationship between variables in a dataset.
It is a statistical technique used to measure the strength and direction of a linear
relationship between two variables. The result is a correlation coefficient, a value
between -1 and 1.
es
● Positive Correlation (1): When one variable increases, the other variable
tends to increase. Correlation coefficient closer to 1 indicates a strong positive
correlation.
ss
● Negative Correlation (-1): When one variable increases, the other variable
tends to decrease. Correlation coefficient closer to -1 indicates a strong
negative correlation.
● No Correlation (0): There is no pattern or relation between the variables.
la
How to calculate correlation?
C
𝐶𝑜𝑣(𝑥,𝑦) 𝐶𝑜𝑣(𝑥,𝑦)
ρ(𝑥, 𝑦) = = 𝑠𝑡𝑑(𝑥)𝑠𝑡𝑑(𝑦)
𝑣𝑎𝑟(𝑥) 𝑣𝑎𝑟(𝑦)
Te
- Correlation does not imply causation: Just because two variables are
correlated does not mean that one causes the other.
- Outliers: Extreme data points can influence correlation, so its essential to
check for outliers.
- Non-linear Relationships: Correlation specifically measures linear
relationships. Non-linear relationships may not be accurately represented.
Note: Causation refers to the relationship between cause and effect. In a causal
relationship, a change in the independent variable is directly responsible for a
change in the dependent variable. Unlike correlation, which simply describes a
relationship between two variables, causation implies a direct connection in which
one variable influences the other.
Example: Correlation and Covariance in Stock Market Analysis
Suppose you are a financial analyst studying the relationship between the stock
prices of two technology companies, Company A and Company B, over the past
year. You have collected daily closing prices for both companies and want to analyze
whether there is a correlation or covariance between their stock performance.
Company A prices = [100, 102, 105, 103, 110, 112, 115, 118, 120, 122]
Company B Prices = [80, 82, 85, 87, 88, 92, 95, 97, 98, 100]
es
ss
la
C
c h
Te
Probability
Probability is a measure of the likelihood of a particular event occurring. It is defined
as a chance of something happening or likelihood of an event is to be happened. It is
expressed as a number between 0 and 1, where 0 indicates impossibility, 1 indicates
certainty, and values in between represent varying degrees of likelihood.
Probability basics
Example: In the die example, the event A could be getting an even number
{2,4,6}
es
● Complement of an event: It consists of all outcomes not in A.
P(A’) = 1 – P(A)
ss
Example: If A is getting an even number on a die, then A’ is getting an odd
number.
la
Types of events
C
These are the events that cannot occur at the same time or do not have
common outcomes.
c
P (A and B) = 0
Example:
Suppose we select a random card from a deck, let event A be the event that
the card is a Spade or a Club and let event B be the event that the card is a
Heart or a Diamond.
A = {Spade, Club}
B = {Heart, Diamond}
There is no overlap between the two sample spaces, thus these are disjoint
events.
The probability that either event occurs can be calculated by adding up their
individual probabilities.
P (A or B) = P (A) + P (B)
These are the events that occurs at the same time or have common
es
outcomes.
Example: Consider two dice rolls. A joint event could be “both dice showing
ss
even numbers,” which occurs when both dice show, for instance, 2 and 4.
3. Dependent Events:
c
If the occurrence of one event does affect the probability of the other
Te
Example: If you draw a card and do not replace it, the events of drawing a red
card and then drawing a black card are dependent.
4. Independent Events:
Two events are independent if the occurrence of one does not change the
probability of the other occurring.
Conditional Probability
Probability of an event or outcome based on the occurrence of a previous event or
outcome. In other words, the probability of an event occurring given that another
event has already occurred.
𝑃(𝐴 𝑎𝑛𝑑 𝐵)
P(A|B) = 𝑃(𝐵)
es
Consider a medical scenario where we want to determine the probability that a
patient has a specific disease (event A) given that they have tested positive for a
certain medical test (event B). ss
P(A): The overall probability that a random person has the disease.
la
P(B|A): The probability that a person with the disease tests positive for the medical
test.
C
P(B): The probability that a random person tests positive for the medical test.
The conditional probability P(A|B) represents the likelihood that a person has the
h
disease if they tested positive. In this case, P (A and B) is the probability that a
c
Bayes Theorem
Bayes theorem, named after the Reverend Thomas Bayes, is a mathematical
formula that enables us to update the probability of an event based on new evidence
or information.
𝑃(𝐴)*𝑃(𝐴)
𝑃(𝐵) = 𝑃(𝐵)
P(A|B): This is the probability of event A occurring given that event B has occurred. It
is the updated probability based on new evidence.
P(A): The prior probability of event A, which is our initial belief about the likelihood of
A.
P(B|A): The probability of observing event B given that event A has occurred. It
represents how well the evidence (event B) supports our initial belief (event A).
1. Medical Diagnosis:
In email filtering systems, Bayes' theorem helps classify emails as spam or not spam
es
based on the presence of certain keywords and other features. It's a fundamental
component of spam filters.
3. Recommendation Systems: ss
In recommendation algorithms, Bayes' theorem can be applied to suggest products,
movies, or music to users. It takes into account user preferences, past behavior, and
la
item characteristics.
C
In A/B testing, Bayes' theorem helps analyse the results of experiments where you
h
test two or more variations of a web page, app, or product to determine which one is
more effective in achieving a specific goal.
c
Insurance companies use Bayes' theorem to assess the risk of insuring individuals or
properties. It helps determine premium rates and estimate claim probabilities based
on historical data and new information.
6. Fraud Detection:
Healthy 891 9
Sick 1 99
P(S) is the prior probability of a person being sick, which is 0.1 (100 out of 1000).
P(¬S) is the prior probability of a person being healthy, which is 0.9 (900 out of
1000).
es
P(P|¬S) is the probability of testing positive if the person is healthy which is 0.01.
ss
P(P) is the probability of person tested positive which is 0.108 after test (108 out of
1000)
We can now use Bayes' theorem to calculate P(S|P), the probability that a person is
la
sick given they tested positive:
C
𝑃(𝑆)*𝑃(𝑆)
𝑃(𝑃) = 𝑃(𝑆)*𝑃(𝑆)+𝑃(¬𝑆)*𝑃(¬𝑆)
0.99*0.1
𝑃(𝑃) = 0.99*0.1+0.01*0.9
= 0. 9167
h
Or,
𝑃(𝑆)*𝑃(𝑆) 0.99*0.1
c
𝑃(𝑃) = 𝑃(𝑃)
= 0.108
= 0. 9167
Te
So, using Bayes' theorem, the probability that a person is sick (S) given that they
tested positive (P) is approximately 0.9167 or 91.67%. This means that even with a
99% effective test, if a person tests positive, there is still a relatively high probability
that they are sick, given that the disease is relatively common in the population.
Probability Distributions
Random Variables: A random variable is a variable whose values are outcomes of
a random experiment or all the possible events in some partition of the sample
space. It associates a numerical value with each outcome.
Example: X = (0,1)
es
variable.
When tossing four fair coins, we have the following possible outcomes for the
number of heads (H):
0 heads (TTTT)
ss
la
1 head (HTTT, THTT, TTHT, TTTH)
C
4 heads (HHHH)
c
So, the PMF for the number of heads when tossing four fair coins is as follows:
Te
P (X = 0) = 1/16
P (X = 1) = 4/16
P (X = 2) = 6/16
P (X = 3) = 4/16
P (X = 4) = 1/16
es
ss
Imagine a call centre that receives a large volume of customer inquiries and service
requests. Customers are placed on hold until they can be connected to a customer
service representative. The time a customer spends on hold is referred to as "wait
la
time."
C
The mean wait time (μ) is estimated to be 5 minutes, indicating the average time
customers spend on hold.
𝑏
Te
Cumulative Distribution Function (CDF) shows how much probability the variable
accumulated until a certain value.
Fx(x) = P(X<=x)
Bernoulli Distribution:
A Bernoulli distribution models a binary outcome where an event can have one of
two possible outcomes, typically labelled as success (1) or failure (0). Such an event
h
is called a Bernoulli trial, and a Bernoulli distribution assesses only one trial. (n =1)
c
PMF = f(x,p) = {𝑝 𝑖𝑓 𝑥 = 1 𝑞 = 1 − 𝑝 𝑖𝑓 𝑥 = 0
Te
Mean = p
Binomial Distribution:
𝑛! 𝑥 𝑛−𝑥
PMF = f(x:n,p) = (𝑛−𝑥)!𝑥!
𝑝 (1 − 𝑝)
es
Imagine you're an e-commerce business owner, and you want to analyze the
conversion rate of visitors to your website. In this scenario, conversion means
ss
making a purchase. You're interested in understanding the likelihood of a specific
number of purchases (successes) out of a fixed number of website visits (trials)
during a given period.
la
n (number of website visits) = 100
C
x (number of purchases) = 75
h
Question: What is the probability of exactly 75 visitors making a purchase out of 100
website visits given a 75% conversion rate?
c
Te
100! 75 100−75
P(X=50) = (100−75)!75!
0. 75 (1 − 0. 75) = 0.0917
The probability of exactly 75 customers making a purchase out of 100 website visits
with a 75% conversion rate is approximately 0.0917, or 9.17%
es
ss
Multinomial distribution generalizes the binomial distribution to more than two
categories or outcomes.
la
𝑛! 𝑥1 𝑥2 𝑥3 𝑥𝑘
PMF = 𝑥1!𝑥2!𝑥3!…….𝑥𝑘!
𝑝1 𝑝2 𝑝3 …. 𝑝𝑘
C
Example: Suppose two students play chess against each other. The probability that
student A wins a given game is 0.5, the probability that student B wins a given game
is 0.3, and the probability that they tie in a given game is 0.2. If they play 10 games,
what is the probability that player A wins 4 times, player B wins 5 times, and they tie
1 time?
PMF = 0.038272
Uniform Distribution:
es
PDF:
Mean = a+b/2
ss
la
Variance = (b-a)**2/12
C
Uniform distributions are used for generating random numbers. They ensure that
each number in a given range has an equal chance of being selected.
h
In many lottery systems and games of chance, uniform distributions are used to
ensure fairness. This guarantees that each possible outcome, such as drawing a
c
Uniform distributions can be used in market research and economics to model the
equally likely purchase or selection of various products or services within a given
range. This information is valuable for stock management, marketing, and pricing
strategies.
Real-World Scenario:
Imagine you're a manager at a coffee shop, and you want to predict the arrival time
of customers during a particular hour of operation. You believe that customers arrive
at a relatively constant rate throughout the hour. To model this scenario, you can use
a uniform distribution.
es
ss
la
C
c h
Te
Normal distribution:
1 𝑥−μ 2
1 −2( )
PDF : 𝑒 σ
σ 2π
E[X] = u
Var(x) = σ**2
es
mean = 50
std_dev = 10
ss
la
C
c h
Te
A positive z score means that your x value is greater than the mean.
A negative z score means that your x value is less than the mean.
h
It is possible to change each normal random variable X into a z score through the
Te
Z = (X- μ)/σ
es
xnew = (xi – xmin) / (xmax – xmin)
where:
●
●
xi: The ith value in the dataset
ss
xmin: The minimum value in the dataset
la
● xmax: The maximum value in the dataset
have multiple variables that are measured on different scales and we want each of
the variables to have the same range. This prevents one variable from being overly
influential, especially if it’s measured in different units (i.e., if one variable is
measured in inches and another is measured in yards).
h
On the other hand, we typically standardize data when we’d like to know how many
c
Normalization Standardization
Minimum and maximum value of Mean and standard deviation of
variables are used for scaling. variables are used for scaling.
It is used when features are of different It is used when we want to ensure zero
scales. mean and unit standard deviation.
● About 68% of data falls within one standard deviation of the mean
● About 95% of data falls within two standard deviations of the mean
● About 99.7% of data falls within three standard deviations of the mean
es
ss
la
C
This is known as the Empirical Rule and is used to understand the distribution of
values in a dataset.
c h
Te
For example, suppose the height of plants in a certain garden are normally
distributed with a mean of 47.4 inches and a standard deviation of 2.4 inches.
According to the Empirical Rule, what percentage of plants are less than 54.6
inches tall?
The Empirical Rule states that for a given dataset with a normal distribution, 99.7%
of data values fall within three standard deviations of the mean. This means that
49.85% of values fall between the mean and three standard deviations above the
mean.
In this example, 54.6 is located three standard deviations above the mean. Since we
know that 50% of data values fall below the mean in a normal distribution, a total of
50% + 49.85% = 99.85% of values fall below 54.6.
Understanding Data Distribution: The empirical rule is primarily used to gain a quick
and intuitive understanding of how data is distributed around the mean in a normal or
nearly normal distribution.
Quality Control: It's commonly applied in quality control and manufacturing to assess
variations and deviations in products. For instance, in a manufacturing process, you
can use the rule to estimate the percentage of products that fall within certain quality
es
specifications.
Descriptive Statistics: Data analysts and statisticians use the empirical rule to
provide a simple summary of data distribution in presentations and reports.
Identifying Outliers: It can help identify potential outliers or data points that are
c
Scenario: Imagine you are analyzing the exam scores of a large group of students,
and you suspect that the scores follow a normal distribution. The mean score is 75,
and the standard deviation is 10.
About 95% of students scored between 55 and 95 (within two standard deviations of
the mean).
Nearly 99.7% of students scored between 45 and 105 (within three standard
deviations of the mean).
Based on this knowledge, you can quickly assess the distribution of scores and
communicate to stakeholders that the majority of students scored within a certain
range. This information can be vital for setting performance benchmarks, identifying
exceptional students, or assessing the quality of teaching.
es
ss
la
C
h
Inferential Statistics
c
Te
es
Have you asked yourself how statisticians determine parameters such as mean age
of an entire country’s population? It is obvious that they can’t get data from every
ss
single member of the population to calculate this statistic.
la
C
c h
Te
1. Population Parameters:
In many statistical analyses, the goal is to learn something about a specific
characteristic of a population, known as a population parameter. These parameters
represent the true, but often unknown, properties of the entire population. Examples
of population parameters include the mean, variance, proportion, or regression
coefficients.
2. Sample Statistics:
es
ss
la
C
Point Estimation
h
This is the simplest form of estimation, where you provide a single value as your best
guess for the unknown parameter. For example, if you calculate the average income
c
in a sample of households and use that as an estimate for the average income of all
households in a city, you're performing point estimation. The sample data of a
Te
population is used to find a point estimate or a statistic that can act as the best
estimate of an unknown parameter that is given for a population.
Consistent -the larger is the sample size, the more accurate is the estimate.
Unbiased - The expectation of the observed values of various samples equals the
corresponding population parameter. Let’s take, for example, we can say that
sample mean is an unbiased estimator for the population mean.
When the two properties above are met for an estimator, you have the most efficient
or best unbiased estimator.
es
The number of trials is shown by T.
Interval Estimation
A point estimate does not provide information about ‘how close is the estimate’ to the
population parameter unless accompanied by a statement of possible sampling error
involved based on the sampling distribution of the statistic. It is therefore important to
know the precision of an estimate before depending on it to make a decision. Thus,
decision makers prefer to use an interval estimate (i.e., the range of values defined
around a sample statistic) that is likely to contain the population parameter value.
Confidence Interval:
However, it is also important to state ‘how confident’ one should be that the interval
estimate contains the parameter value. Hence an interval estimate of the population
parameter is a confidence interval with a statement of confidence that the interval
contains the parameter value. In other words, a confidence interval estimation is an
es
interval of values computed from sample data that is likely to contain the true
population parameter value. Intervals are chosen such that parameter falls within a
95% or 99% probability called the confidence coefficient. Hence the intervals are
called Confidence Interval. The end points of such an interval called upper and lower
ss
confidence limits. A confidence level is the probability that the interval estimate will
include the population parameter (such as the mean)
la
CI = point estimate +- margin of error
𝑧𝑐= critical value of standard normal variable that represents confidence level
h
Margin of Error:
- The margin of error depends on the degree of confidence that is required for the
estimation.
Alpha = 0.05
ss
Alpha = significance value
la
Z value is the no. of std from the sample mean. Za/2 = confidence coef or critical
C
value
c h
Te
es
ss
Careful not to misinterpret the definition of a confidence interval
NOT Correct – “there is a 90 % probability that the true population mean is within
la
the interval”
C
As the sample size becomes smaller, the sample standard deviation becomes an
increasingly poor approximation of the population standard deviation. The end result
is that a 95% confidence interval computed using s instead of σ may actually only
contain the population mean 90% of the time, or 85% of the time, or even less.
William Gosset developed a new probability distribution, which he called the t
distribution, to describe the probabilities associated with the statistic.
● You can see how the curves with more degrees of freedom are more like a
z-distribution.
es
ss
● So far we have discussed confidence intervals for the mean where n ≥ 30 and
la
when population standard deviation is known, we are assuming the population
is normally distributed and so we can follow the z distribution procedure for
C
es
ss
la
C
Hypothesis Testing
Let's say you have another medicine that you think is superior to the one you're
h
taking. How can you demonstrate it? Hypothesis testing is useful in this situation. It is
similar to being a detective, looking for proof that can support up your claim.
c
Types of Hypotheses:
The two claims need to be mutually exclusive, meaning only one of them can be
true.
"The average height of people in Denmark is more than 170 cm." In this case, the
parameter is the average height of people in Denmark. The null and alternative
hypothesis would be:
es
Null hypothesis: The average height of people in Denmark is 170 cm.
Alternative hypothesis: The average height of people in Denmark is more than 170
cm.
ss
● If the data supports the alternative hypothesis, we reject the null hypothesis
and accept the alternative hypothesis.
la
● If the data does not support the alternative hypothesis, we keep the null
hypothesis.
C
Real-Life Examples:
h
Drug Efficacy: Null Hypothesis (H0): The new drug has no effect. Alternative
Hypothesis (Ha): The new drug is effective.
c
A/B Testing: Null Hypothesis (H0): There is no difference between versions A and B.
Te
The significance level, denoted as α (alpha), is like setting a rule or standard for
how much evidence you need before you believe a hypothesis. It's the maximum
chance you're willing to take of being wrong when you reject a true null hypothesis.
Its the predetermined threshold for deciding if the evidence is strong enough to reject
the null hypothesis. Commonly used values for α are 0.05, 0.01, or 0.10.
A lower significance level means that the evidence in the data needs to be stronger
to reject the null hypothesis.
The p-value is a measure that helps you decide if the evidence from your data is
strong enough to reject the null hypothesis. A low p-value indicates stronger
evidence against the null hypothesis. If the p-value is less than α, you might say the
result is "statistically significant.
Decision Rule: If the p-value is less than or equal to α, you reject the null
hypothesis.
es
ss
la
Example: You're testing a new drug, and the p-value is 0.03. This means there's a
C
3% chance that the observed results happened by random chance alone. If your α is
0.05, which is common, you might decide the evidence is strong enough to reject the
idea that the drug has no effect.
h
Types of errors:
c
When conducting hypothesis testing, there are two main types of errors that
Te
researchers need to be aware of: Type I error and Type II error. Let's break down
each type with examples:
Type I error occurs when the null hypothesis is incorrectly rejected when it is actually
true. In other words, it's a false alarm or a false positive.
Example: Suppose a pharmaceutical company is testing a new drug, and the null
hypothesis is that the drug has no effect. If, based on the sample data, the
researchers mistakenly conclude that the drug is effective (reject the null
hypothesis), when in reality it is not, this is a Type I error.
Example: Using the same drug example, let's say the drug does have a significant
effect, but the researchers fail to detect it based on the sample data. In this case,
they accept the null hypothesis (fail to reject it), when they should have rejected it.
This is a Type II error.
Second Example: You decide to get tested for COVID-19 based on mild symptoms.
There are two errors that could potentially occur:
Type I error (false positive): the test result says you have coronavirus, but you
actually don’t.
Type II error (false negative): the test result says you don’t have coronavirus, but you
es
actually do.
ss
la
C
c h
In hypothesis testing, the choice between a one-tailed and a two-tailed test depends
on the specific research question and the directionality of the expected effect. Let's
delve into each type with examples and decision rules:
One-Tailed Test:
In a one-tailed (or one-sided) test, the critical region for rejecting the null hypothesis
is located in only one tail of the distribution (either the left or the right).
When to Use: When the research hypothesis specifies a direction (e.g., the effect is
expected to be greater than or less than a certain value).
Example:
Research Hypothesis: The average time to complete a task with a new software is
less than 10 minutes.
Null Hypothesis: The average time to complete a task with a new software is 10
minutes or more.
Two-Tailed Test:
In a two-tailed (or two-sided) test, the critical region for rejecting the null hypothesis
is divided between both tails of the distribution.
When to Use: When the research hypothesis is non-directional or when you want to
detect any significant difference, whether it's greater or less than a certain value.
Example:
es
Research Hypothesis: There is a difference in the average scores between two
groups.
ss
Null Hypothesis: There is no difference in the average scores between two groups.
● If the p-value is greater than alpha, do not reject the null hypothesis.
● If the p-value is less than or equal to alpha/2, reject the null hypothesis.
c
● If the p-value is greater than alpha/2, do not reject the null hypothesis.
Te
Types of Tests in Statistics:
1. Z-Test
● One-Sample Z -Test
When you have a single sample and want to determine if its mean is
es
significantly different from a known population mean.
Formula:
Z=
𝑋−µ
σ
ss
la
𝑁
where,
C
Example:
Imagine you're a social media manager, and you want to know if your latest
campaign is a hit. You survey 100 followers and ask how many likes they give
to your posts, on average. But how can you tell if this average (sample mean)
reflects the true feelings of your entire audience (population)? This is where
the one-sample z-test comes in!
Let's say your sample of 100 followers gives an average of 7 likes, and you
hypothesize the average like for all followers is 5 likes (μ = 5) with a known
standard deviation of 1 like (σ = 1). You calculate a z-statistic of 2 (indicating
the sample mean is 2 standard deviations higher than expected). If the
p-value from a z-test calculator is 0.02, you would reject the null hypothesis.
This suggests your campaign is likely a success, with your sample showing a
significantly higher average like than the hypothesized average for all
followers.
● Two-Sample Z -Test
Formula:
es
𝑥1−𝑥2
Z= 2 2
σ1 σ2
𝑛1
+ 𝑛1 ss
Example: A marketing team tests a new website design on two groups of
la
users (Group A and Group B). They measure the average time spent
browsing the website (in minutes) for each group. They want to know if the
new design (Group B) keeps users engaged for significantly longer than the
C
2. T-Test
h
common ones are the independent samples t-test and the paired samples
t-test. It is effective when dealing with small sample sizes(n<30) and when the
population standard deviation is unknown.
Formula:
𝑥1−𝑥2
t= 2 2
𝑠1 𝑠2
𝑛1
+ 𝑛2
Imagine you work for an e-commerce company, and you're tasked with
analyzing the effectiveness of two different website designs (A and B) in terms
of their conversion rates. You want to know if there's a significant difference in
the average conversion rates between the two designs.
es
It is used when comparing the means of two related groups such as before
and after measurements on the same subjects.
Formula:
𝑥𝑑
ss
t=
la
𝑠𝑑
𝑛
C
Imagine you work for a company that has implemented a training program to
improve the performance of its employees. You want to assess whether the
training program has led to a significant improvement in employee
productivity.
It's important to note that the t-test assumes that the data is approximately
normally distributed. If the sample size is large, the t-distribution approaches
the normal distribution, and the t-test becomes robust against deviations from
normality. If the sample size is small and the data is not normally distributed,
other non-parametric tests may be more appropriate.
- ANOVA produces the F statistic as its outcome, which is crucial for analyzing
differences among group means.
es
- Conversely, if the F-ratio is small and fails to reach significance, it indicates
no meaningful differences among groups, and the null hypothesis is accepted.
ss
In ANOVA terminology, an independent variable is called a factor variable and
a dependent variable is called a response variable. One of the biggest
challenges in machine learning is the selection of the most reliable and useful
la
features that are used in order to train a model. ANOVA helps in selecting the
best features to train a model. ANOVA minimizes the number of input
variables to reduce the complexity of the model.
C
Formula:
h
𝑀𝑆𝐵
F= 𝑀𝑆𝑊
c
Te
X- X̄j = overall mean, and nj is the sample size of the jth group.
es
● One-way ANOVA
It is used when we have only one factor (independent variable) with two or
more levels (samples).
ss
Example: Scenario: Comparison of Exam Scores Among Multiple Teaching
Methods
la
Suppose you're a researcher interested in comparing the effectiveness of
C
● Two-way ANOVA
h
Imagine you're studying the effects of diet type (Low Carb vs. Low Fat) and
exercise intensity (High vs. Moderate) on weight loss in individuals. You want
to investigate whether there are significant main effects of diet type and
exercise intensity, as well as any interaction effect between the two factors.
4. Chi-Square Test
es
● Chi-Square Test for Independence
You can use a chi-square test of independence when you have two
ss
categorical variables. It allows you to test whether the two variables are
related to each other. If two variables are independent (unrelated), the
probability of belonging to a certain group of one variable isn’t affected by the
la
other variable.
C
Suppose you're investigating the relationship between smoking habits and the
occurrence of lung cancer. You want to determine if there is a significant
h
lung cancer).
Te
You can use a chi-square goodness of fit test when you have one categorical
variable. It allows you to test whether the frequency distribution of the
categorical variable is significantly different from your expectations.