Descriptive Statistics
Descriptive statistics refers to the process of summarizing and
analysing data to describe its main features in a clear and
meaningful way. It is used to present raw data in a form that
makes it easier to understand and interpret. Descriptive
statistics involves both graphical representations (such as charts
and plots) and numerical measures to summarize data
effectively. Unlike inferential statistics, which makes predictions
about a population based on a sample, Descriptive statistics is
applied to data that is already known.
Inferential Statistics
Inferential statistics involves using data from a sample to make
predictions, generalizations, or conclusions about a larger
population. Unlike descriptive statistics, which simply
summarizes known data, inferential statistics makes inferences
or draws conclusions that go beyond the available data. It uses
probability theory to estimate population parameters and test
hypotheses. By working with a sample, inferential
statistics allows researchers to make informed decisions without
having to gather data from an entire population.
What is Statistical Analysis?
Statistical Analysis means gathering, understanding, and
showing data to find patterns and connections that can help us
make decisions. It includes lots of different ways to look at data,
from simple stuff like basic facts to more complicated methods
for figuring out what those facts mean.
Statistical analysis aims to:
Summarize data: Descriptive statistics such as mean,
median, and mode provide insights into the central
tendencies of a dataset.
Infer insights: Inferential statistics enable researchers
to draw conclusions or make predictions about a
population based on a sample.
Common Types of Statistical Analysis
There are 6 major types of Statistical Analysis:
Descriptive Statistics
Descriptive Statistics Focuses on summarizing the main
characteristics of a data set. Involve methods for organizing,
summarizing, and presenting data in a meaningful way. It
provides a concise summary of the main features of a dataset,
such as measures of central tendency (mean, median, mode),
measures of dispersion (range, variance, standard deviation),
and graphical representations (histograms, box plots, etc.).
Descriptive statistics help researchers and analysts to
understand the basic characteristics of the data, identify
patterns, and draw preliminary conclusions.
Inferential Statistics
Inferential statistics involves making inferences or predictions
about a population based on a sample of data. It uses probability
theory to generalize findings from a sample to a larger
population. This type of analysis includes hypothesis testing,
confidence intervals, and regression analysis. Inferential
statistics allows researchers to draw conclusions, make
predictions, and test hypotheses about populations, even when
only a subset of the population is observed.
Exploratory Data Analysis (EDA)
Exploratory Data Analysis (EDA) is an approach to analyzing
data sets to summarize their main characteristics, often with
visual methods· Unlike inferential statistics, EDA focuses more on
uncovering patterns, trends, and relationships within the data
rather than making formal statistical inferences. It involves
techniques such as scatter plots, histograms, and correlation
analysis to explore relationships between variables and identify
potential outliers or anomalies. EDA is often used as a
preliminary step before applying more formal statistical
methods.
Predictive Modeling
Predictive modeling involves using statistical algorithms and
machine learning techniques to predict future outcomes based
on historical data. It is widely used in various fields such as
finance, marketing, healthcare, and weather forecasting.
Predictive models are trained on historical data to identify
patterns and relationships between variables, which are then
used to make predictions on new or unseen data. Common
techniques include linear regression, decision trees, neural
networks, and support vector machines.
Prescriptive Analysis
Prescriptive analysis goes beyond predictive modeling by
recommending actions or decisions based on the predictions
generated by predictive models. It involves optimizing decision-
making processes to achieve specific goals or objectives.
Prescriptive analytics combines techniques from operations
research, optimization, and decision theory to identify the best
course of action among various alternatives. It is used in
business applications such as supply chain management,
resource allocation, and pricing optimization.
Causal Analysis
Causal analysis is analysis that seeks to establish if changes in
one variable cause changes in another variable in a given data
set. This is critical in establishing if the two variables
relationships are based on causation or mere correlation. It
usually requires to be designed as an experiment, or it can also
be analyzed from a statistical viewpoint, using some more
advanced statistical tools like regression analysis, causal
inference, propensity score matching, and instrumental variable.
The reason for understanding the causal relationship is to make
empowered discussions and make informed interventions,
especially, under public policy, health, and social circumstances
strands.
Descriptive Statistic
Statistics is the foundation of data science. Descriptive statistics
are simple tools that help us understand and summarize data.
They show the basic features of a dataset, like the average,
highest and lowest values and how spread out the numbers are.
It's the first step in making sense of information.
Types of Descriptive Statistics
There are three categories for standard classification of
descriptive statistics methods, each serving different purposes in
summarizing and describing data. They help us understand:
1. Where the data centers (Measures of Central Tendency )
2. How spread out the data is (Measure of Variability )
3. How the data is distributed (Measures of Frequency
Distribution)
1. Measures of Central Tendency
Statistical values that describe the central position within a
dataset. There are three main measures of central tendency:
Measures of Central Tendency
Mean: is the sum of observations divided by the total number of
observations. It is also defined as average which is the sum
divided by count.
where,
x = Observations
n = number of terms
Median: The median is the middle value in a sorted dataset. If
the number of values is odd, it's the center value, if even, it's the
average of the two middle values. It's often better than the mean
for skewed data.
Mode: The most frequently occurring value in the dataset. It’s
useful for categorical data and in cases where knowing the most
common choice is crucial.
2. Measure of Variability
Knowing not just where the data centers but also how it spreads
out is important. Measures of variability, also called measures of
dispersion, help us spot the spread or distribution of
observations in a dataset. They identifying outliers, assessing
model assumptions and understanding data variability in relation
to its mean. The key measures of variability include:
1. Range : describes the difference between the largest and
smallest data point in our data set. The bigger the range,
the more the spread of data and vice versa. While easy to
compute range is sensitive to outliers. This measure can
provide a quick sense of the data spread but should be
complemented with other statistics.
2. Variance: is defined as an average squared deviation from
the mean. It is calculated by finding the difference between
every data point and the average which is also known as
the mean, squaring them, adding all of them and then
dividing by the number of data points present in our data
set.
where,
x -> Observation under consideration
N -> number of terms
μ -> Mean
3. Standard deviation: Standard deviation is widely used to
measure the extent of variation or dispersion in data. It's
especially important when assessing model performance (e.g.,
residuals) or comparing datasets with different means.
It is defined as the square root of the variance. It is calculated by
finding the mean, then subtracting each number from the mean
which is also known as the average and squaring the result.
Adding all the values and then dividing by the no of terms
followed by the square root.
where,
x = Observation under consideration
N = number of terms
μ = Mean
Measures of Frequency Distribution
A frequency distribution table is a summarized way to show how
data points are distributed across different categories or
intervals. It helps to identify patterns, outliers and the overall
structure of the dataset. It's often the first step in understanding
the dataset before applying more advanced analytical methods
or creating visualizations like histograms or pie charts.
Frequency Distribution Table Includes measure like:
Data intervals or categories
Frequency counts
Relative frequencies (percentages)
Cumulative frequencies when needed
What is Inferential Statistics?
Inferential statistics is an important tool that allows us to make
predictions and conclusions about a population based on sample
data. Unlike descriptive statistics, which only summarize data,
inferential statistics let us test hypotheses, make estimates, and
measure the uncertainty about our predictions. These tools are
essential for evaluating models, testing assumptions, and
supporting data-driven decision-making.
Why Do We Need Inferential Statistics?
In real-world scenarios, analyzing an entire population is often
impossible. Instead, we collect data from a sample and use
inferential statistics to:
Conclude the whole population.
Test claims or hypotheses.
Calculate confidence intervals and p-values to measure
uncertainty.
Make predictions with statistical models.
Techniques in Inferential Statistics
Inferential statistics offers several key methods for testing
hypotheses, estimating population parameters, and making
predictions. Here are the major techniques:
1. Confidence Intervals: It gives us a range of values that
likely includes the true population parameter. It helps quantify
the uncertainty of an estimate. The formula for calculating a
confidence interval for the mean is:
Where:
xˉ is the sample mean
Za/2 is the Z-value from the standard normal distribution
(e.g., 1.96 for a 95% confidence interval)
σ is the population standard deviation
n is the sample size
For example, if we measure the average height of 100 people, a
95% confidence interval gives us a range where the true
population mean height is likely to fall. This helps gauge the
precision of our estimate and compare models (like in A/B
testing).
Hypothesis Testing: Hypothesis testing is a formal procedure
for testing claims or assumptions about data. It involves the
following steps:
Null Hypothesis (H₀): The default assumption, such as
“there’s no difference between two models.”
Alternative Hypothesis (H₁): The claim you aim to
prove, such as “Model A performs better than Model B.”
We collect data and compute a test statistic (such as Z for a Z-
test or t for a T-test):
Where:
xˉxˉ is the sample mean
μ0μ0 is the hypothesized population mean
σσ is the population standard deviation
nn is the sample size
After calculating the test statistic, we compare it with a critical
value or use a p-value to decide whether to reject or accept the
null hypothesis. If the p-value is smaller than the significance
level α (usually 0.05), we reject the null hypothesis.
.
Central Limit Theorem: It states that the distribution of the
sample mean will approximate a normal distribution as the
sample size increases, regardless of the original population
distribution. This is important because many statistical methods
assume that data is normally distributed. The CLT can be
mathematically expressed as:
Where:
μμis the population mean
σσ is the population standard deviation
nn is the sample size
This theorem allows us to apply normal distribution-based
methods even when the original data is not normally distributed,
such as in cases with skewed income or shopping behavior data.
Errors in Inferential Statistics
In hypothesis testing, Type I Error and Type II Error are key
concepts:
Type I Error occurs when we wrongly reject a true null
hypothesis. The probability of making a Type I error is
denoted by αα (the significance level).
Type II Error occurs when we fail to reject a false null
hypothesis. The probability of making a Type II error is
denoted by ββ and the power of the test is given
by 1−β1−β.
The goal is to minimize these errors by carefully selecting
sample sizes and significance levels.
Parametric and Non-Parametric Tests
Statistical tests help decide if the data support a hypothesis.
They calculate a test statistic that shows how much the data
differs from the assumption (null hypothesis). This is compared
to a critical value or p-value to accept or reject the null.
1. Parametric Tests: These tests assume that the data
follows a specific distribution (often normal) and has
consistent variance. They are typically used for
continuous data. Examples include the Z-test, T-test,
and ANOVA. These tests are effective for comparing
models or measuring performance when the assumptions
are met.
2. Non-Parametric Tests: Non-parametric tests do not
assume a specific distribution for the data, making them
ideal for small samples or non-normal data, including
categorical or ranked data. Examples include the Chi-
Square test, Mann-Whitney U test, and Kruskal-Wallis
test. They are useful when data is skewed or categorical,
such as customer ratings or behaviors.
Covariance and Correlation
Covariance and correlation are the two key concepts in Statistics
that help us analyze the relationship between two variables.
Covariance measures how two variables change together,
indicating whether they move in the same or opposite directions.
Relationship between Independent and dependent variables
To understand this relationship better, consider factors like
sunlight, water and soil nutrients (as shown in the image), which
are independent variables that influence plant growth our
dependent variable. Covariance measures how these variables
change together, indicating whether they move in the same or
opposite directions.
What is Covariance?
Covariance measures how two random variables change
together. It is calculated by averaging the product of their
deviations from their means. A positive value means they move
in the same direction, while a negative value means they move
in opposite directions.
1. It can take any value between - infinity to +infinity,
where the negative value represents the negative
relationship whereas a positive value represents the
positive relationship.
2. It is used for the linear relationship between variables.
3. It gives the direction of relationship between variables.
Types of Covariance
Positive Covariance: When one variable increases, the
other variable tends to increase as well and vice versa.
Negative Covariance: When one variable increases,
the other variable tends to decrease.
Zero Covariance: There is no linear relationship
between the two variables; they move independently of
each other.
Covariance Formula
What is Correlation?
Correlation is a standardized measure of the strength and
direction of the linear relationship between two variables. It is
derived from covariance and ranges between -1 and 1. Unlike
covariance, which only indicates the direction of the relationship,
correlation provides a standardized measure.
Positive Correlation (close to +1): As one variable
increases, the other variable also tends to increase.
Negative Correlation (close to -1): As one variable
increases, the other variable tends to decrease.
Zero Correlation: There is no linear relationship
between the variables.
The correlation coefficient ρρ for variables X and Y is defined as:
1. Correlation takes values between -1 to +1, wherein
values close to +1 represents strong positive correlation
and values close to -1 represents strong negative
correlation.
2. In this variable are indirectly related to each other.
3. It gives the direction and strength of relationship
between variables.
Correlation Formula
The correlation coefficient ρρ for variables X and Y is defined as:
1. Correlation takes values between -1 to +1, wherein
values close to +1 represents strong positive correlation
and values close to -1 represents strong negative
correlation.
2. In this variable are indirectly related to each other.
3. It gives the direction and strength of relationship
between variables.
Correlation Formula
Correlation Coefficient Formula
Correlation Coefficient Formula: The correlation coefficient is
a statistical measure used to quantify the relationship between
predicted and observed values in a statistical analysis. It
provides insight into the degree of precision between these
predicted and actual values.
Correlation coefficients are used to calculate how vital a
connection is between two variables. There are different types of
correlation coefficients, one of the most popular is Pearson's
correlation (also known as Pearson's R)which is commonly used
in linear regression.
What is Correlation?
Correlation is a statistical measure that describes the extent to
which two variables are related to each other. It quantifies the
direction and strength of the linear relationship between
variables. Generally, a correlation between any two variables is
of three types that include:
Positive Correlation
Zero Correlation
Negative Correlation
Correlation Coefficient Definition
A statistical measure that quantifies the strength and direction of
the linear relationship between two variables is called the
Correlation coefficient. Generally, it is denoted by the symbol 'r'
and ranges from -1 to 1.
What is Correlation Coefficient Formula?
Correlation coefficient procedure is used to determine how
strong a relationship is between the data. The correlation
coefficient procedure yields a value between 1 and -1. In which,
-1 indicates a strong negative relationship
1 indicates strong positive relationships
Zero implies no connection at all
Understanding Correlation Coefficient
Correlation coefficient of -1 means there is a negative
decrease of a fixed proportion, for every positive
increase in one variable. Like, the amount of gas in a
tank decreases in a perfect correlation with the speed.
Correlation coefficient of 1 means there is a positive
increase of a fixed proportion of others, for every positive
increase in one variable. Like, the size of the shoe goes
up in perfect correlation with foot length.
Correlation coefficient of 0 means that for every
increase, there is neither a positive nor a negative
increase. The two just aren't related.
Pearson's Correlation
It is the most common correlation in statistics. The full name is
Pearson's Product Moment Correlation in short PPMC. It displays
the Linear relation between the two sets of data. Two letters are
used to represent the Pearson correlation
Greek Letter "rho (ρ)" for a population and the letter “r” for a
sample correlation coefficient.
How to Find Pearson's Correlation Coefficient?
Follow the steps added below to find the Pearson's Correlation
Coefficient of any given data set
Step 1: Firstly make a chart with the given data like subject,x,
and y and add three more columns in it xy, x² and y².
Step 2: Now multiply the x and y columns to fill the xy column.
For example:- in x we have 24 and in y we have 65 so xy will be
24×65=1560.
Step 3: Now, take the square of the numbers in the x column
and fill the x² column.
Step 4: Now, take the square of the numbers in the y column
and fill the y² column.
Step 5: Now, add up all the values in the columns and put the
result at the bottom. Greek letter sigma (Σ) is the short way of
saying summation.
Step 6: Now, use the formula for Pearson's correlation
coefficient:
R=n(∑xy)−(∑x)(∑y)[n∑x²−(∑x)²][n∑y²−(∑y)² R=[n∑x²−(∑x)²]
[n∑y²−(∑y)²n(∑xy)−(∑x)(∑y)
To know which type of variable we have either positive or
negative.
Linear Correlation Coefficient
The Pearson's correlation coefficient is the linear correlation
coefficient which returns the value between the -1 and +1. In
this -1 indicates a strong negative correlation and +1 indicates a
strong positive correlation. If it lies 0 then there is no correlation.
This is also known as zero correlation.
The "crude estimations” for analyzing the stability of correlations
using Pearson’s Correlation:
r Value Crude Estimates
A very strong positive
+.70 or higher
relationship
+.40 to +.69 Strong positive relationship
+.30 to +.39. Moderate positive relationship
+.20 to +.29 Weak positive relationship
+.01 to +.19 No or negligible relationship
0 No relationship [zero correlation]
r Value Crude Estimates
-.01 to -.19 No or negligible relationship
-.20 to -.29 Weak negative relationship
-.30 to -.39 Moderate negative relationship
-.40 to -.69 Strong negative relationship
The very strong negative
-.70 or higher
relationship
Cramer’s V Correlation
It is as similar as the Pearson correlation coefficient. It is used to
calculate the correlation with more than 2×2 rows and columns.
Cramer's V correlation varies between 0 and 1. The value close
to zero associates that a very little association is there between
the variables and if it's close to 1 it indicates a very strong
association.
The "crude estimates” for interpreting strengths of correlations
using Cramer's V Correlation:
Cramer’s V Crude Estimates
.25 or higher Very strong relationship
.15 to .25 Strong relationship
.11 to .15 Moderate relationship
.06 to .10 Weak relationship
Cramer’s V Crude Estimates
.01 to .05 No or negligible relationship
Difference between Covariance and
Correlation
This table shows the difference between Covariance and
Covariance:
Covariance Correlation
Covariance is a measure of Correlation is a statistical measure
how much two random that indicates how strongly two
variables vary together variables are related.
Involves the relationship
Involves the relationship between
between two variables or
multiple variables as well
data sets
Lie between -infinity and
Lie between -1 and +1
+infinity
Measure of correlation Scaled version of covariance
Provides direction of Provides direction and strength of
relationship relationship
Dependent on scale of
Independent on scale of variable
variable
Have dimensions Dimensionless
They key difference is that Covariance shows the direction of the
relationship between variables, while correlation shows both the
direction and strength in a standardized form.
Applications of Covariance and Correlation
Applications of Covariance
Portfolio Management in Finance: Covariance is used
to measure how different stocks or financial assets move
together, aiding in portfolio diversification to minimize
risk.
Genetics: In genetics, covariance can help understand
the relationship between different genetic traits and how
they vary together.
Econometrics: Covariance is employed to study the
relationship between different economic indicators, such
as the relationship between GDP growth and inflation
rates.
Signal Processing: Covariance is used to analyze and
filter signals in various forms, including audio and image
signals.
Environmental Science: Covariance is applied to study
relationships between environmental variables, such as
temperature and humidity changes over time.
Applications of Correlation
Market Research: Correlation is used to identify
relationships between consumer behavior and sales
trends, helping businesses make informed marketing
decisions.
Medical Research: Correlation helps in understanding
the relationship between different health indicators, such
as the correlation between blood pressure and
cholesterol levels.
Weather Forecasting: Correlation is used to analyze
the relationship between various meteorological
variables, such as temperature and humidity, to improve
weather predictions.
Machine Learning: Correlation analysis is used in
feature selection to identify which variables have strong
relationships with the target variable, improving model
accuracy.
[Link]
correlation/
[Link]
Chi-Square Test
Chi-squared test indicates that there is a relationship between
two entities. Handling data often involves testing hypotheses to
extract useful information. In categorical analysis, chi-square
tests are used to determine whether observed frequencies
differ significantly from expected frequencies under a
given hypothesis.
Chi-squared test, or χ² test, helps in determining whether these
two variables are associated with each other.
This test is widely used in market research, healthcare, social
sciences, and more to analyze categorical relationships.
Chi-Square Test
For example, Entity 1: People’s favorite colors and Entity 2: Their
preference for ice cream.
Null Hypothesis (H₀): Favorite color and ice cream
preference are independent (no relationship).
Alternative Hypothesis (H₁): They are dependent (a
relationship exists).
By comparing observed survey data with expected
frequencies (if no relationship existed), the Chi-Square test
calculates a test statistic (χ²). If this value is large enough, we
reject H₀, concluding that color preference does influence ice
cream choice and vice versa.
Goodness-Of-Fit
A goodness-of-fit test checks if a hypothesized model matches
observed data. For example, testing whether urban residents are
taller than rural ones by comparing actual height data to
predictions.
Key Aspects:
1. Purpose: Validate if data fits an expected distribution.
2. Data Types: Works for both categorical (e.g., survey
responses) and continuous (e.g., heights) data.
3. Applications: Compare observed vs. expected
frequencies (e.g., Chi-Square test) and assess if data
follows a specific distribution (e.g., normal distribution).
4. Benefits: Identifies model-data mismatch.
Applications of Chi-Square Test in
Computer Science
A/B Testing & Feature Evaluation
Compare user engagement (e.g., clicks, conversions)
between two website versions (A vs. B).
Chi-test is used to test if observed metrics (e.g., "Click"
vs. "No Click") differ significantly between groups.
Example: Observed: Version A: 120 clicks / 1,000 views;
Version B: 150 clicks / 1,000 views. Chi-Square: Checks if
the difference is statistically significant (not due to
chance).
Machine Learning (Feature Selection)
Identify categorical features correlated with target
variables.
Test if independence between features (e.g., "Browser
Type" vs. "Purchase Decision") using the Chi-square test.
Example: χ² p-value < 0.05 → "Browser Type"
significantly affects purchases.
Database Query Optimization
Assess if data is evenly distributed across partitions.
Chi-square is used to test if actual row counts per
partition match the expected uniform distribution.
Example: Uneven distribution (χ² significance) suggests
a poor sharding strategy.
Natural Language Processing (NLP)
Evaluate word frequency distributions in texts.
Compare observed word counts (e.g., "error" in logs) to
the expected Poisson distribution.
Example: Detects overused terms in spam emails (χ²
highlights deviations from normal usage).
[Link]
[Link]
[Link]
[Link]
[Link]
kurtosis-in-r-programming/
[Link]
[Link]
[Link]
[Link]
[Link]
[Link]
[Link]
[Link]
[Link]
[Link]
[Link]