Statistics in Data Science (Part 1): Descriptive Statistics
From the publisher’s feed, collected in the ZeroLabs newsroom.
Descriptive statistics is the branch of statistics focused on summarizing, organizing, and presenting raw data so it becomes easy to understand. Instead of getting overwhelmed by thousands of unorganized data points, we use key metrics to reveal the story hidden inside the numbers.This guide covers the core pillars of descriptive data analysis:Population vs. Sample: Understanding who or what we are studying.Types of Data: Categorical (nominal, ordinal) vs. numerical (discrete, continuous) data.Measures of Central Tendency: Finding the center using mean, median, and mode.Measures of Dispersion: Quantifying data spread using range, variance, standard deviation, MAD, and coefficient of variation.Shape of Data: Checking symmetry and tail behavior using skewness and kurtosis.Data Distribution & Visualization: Analyzing positions with quantiles, percentiles, IQR, box plots, KDE plots, and Q-Q plots.What is Statistics?Statistics is the branch of applied mathematics focused on the collection, analysis, interpretation, and presentation of data. It allows us to make sense of vast amounts of information by transforming raw numbers into meaningful insights, effectively acting as the science of extracting information in the face of uncertainty.Descriptive Statistics vs Inferential StatisticsGreeks for Greeks imageDescriptive statistics describe the characteristics of a data set(like central tendency, spread, Data distribution, etc.), while inferential statistics use a sample of data to make predictions and conclusions about a larger population.In this blog, we focus on essentials core founding concepts in Descriptive StatisticsPopulation Vs SamplePopulation refers to the entire group that we want to study, such as the average income of the world’s population.A sample is a subset of the population, which is taken from the population.For example, we might randomly choose the incomes of 1,000 people from the Indian population.Here 1000 peoples income is the sample, and the Indian Population is the Population.Types of DataNominal data: Nominal data refers to categorical informaton that lacks inherent order or ranking.Ordinal Data: Ordinal data represents information with a clear order or ranking, but the differences between the values are not quantifiable.Discrete Data: Discrete data consists of separate values or categories you can measure. As you work with discrete data, you’ll often represent it as whole numbers, such as the number of employees in a company.Continuous Data: Continuous data embodies information that can assume any value within a defined range or interval. It’s typically measured on a continuous scale, such as time, temperature, or distance.Measures of Central Tendency :A measure of central tendency is a statistical measure that represents a central value for a dataset. It provides a summary of data by identifying a single value that is most representative of the dataset as a whole.Mean (Arithmetic Average)When to Use: Continuous or discrete numerical data with a symmetric distribution and no extreme values.Limitation: Highly sensitive to outliers and skewed data, which pull the mean away from the true center.2. Median (Middle Value):When to Use: Skewed distributions (e.g., income, house prices) or ordinal data with potential outliers.Limitation: Ignores the actual magnitude of data values outside the center; less mathematically tractable for statistical modeling.3. Mode (Most Frequent Value)When to Use: Categorical (nominal) data or identifying peak points in multimodal distributions.Limitation: A dataset can have no mode, or multiple modes (bimodal/multimodal); uninformative for small-sample continuous data.4. Advanced VariantsWeighted Mean: Assigns relative weights (w_i) to individual data points based on importance or frequency.Trimmed Mean: Calculates the mean after removing a fixed percentage (e.g., 5\% or 10\%) of extreme values from both ends of the dataset to reduce outlier sensitivity while keeping most data.Measure of Dispersion:A measure of dispersion is a statistical value that indicates how spread out, scattered, or varied the data points are within a dataset. While measures of central tendency (like mean, median, and mode) identify the center of the data, measures of dispersion quantify how far individual data points deviate from that center. High dispersion indicates a wide variation in data, while low dispersion indicates consistency and uniformity.Range:The simplest measure of variability is calculated as the difference between the highest and lowest values in a dataset. It provides a quick snapshot of how widely your data is spread out, though it is highly sensitive to extreme outliers.Formula + Example2. Variance:Image by MATH MONKSVariance is a statistical measure that quantifies the Spread of data points around their mean. It assesses how far each data point deviates from the average. A low variance indicates that the data points are close to the mean and to each other, while a high variance signifies that the data points are widely spread out from the mean.Population and Sample Variance# FAQ: Why is the variance of a population divided by N, while the sample variance is divided by n - 1?3. Standard Deviation:The standard deviation is simply the positive square root of the variance.While variance measures the average squared distance from the mean, standard deviation brings that metric back to the original unit of measurement, making it much easier to interpret.When to Use:Finance & Investment: Measures portfolio risk and asset volatility (e.g., higher SD indicates greater price fluctuation).Quality Control & Manufacturing: Evaluates production consistency to ensure product dimensions or specs stay within acceptable tolerance limits (e.g., Six Sigma).Statistical Modeling & Testing: Serves as a core input for Z-scores, confidence intervals, hypothesis testing, and measuring standard error.Performance Evaluation: Compares standardized test scores or survey metrics across different populations relative to the average.Limitation: Because it relies on squared deviations from the mean, Standard Deviation is disproportionately sensitive to extreme outliers, making it misleading for heavily skewed distributions.4. MAD:Mean Absolute Deviation (MAD) is a measure of dispersion that tells us, on average, how far each data value is from the mean of the dataset.MAD = Average distance of data points from the mean.Formula:When to use:MAD can be used to understand how spread out a dataset is.MAD is commonly used to evaluate forecast errors, it is closely related to MAE ( Mean Absolute Error.Limitation:Sensitive to outliers: Extreme values can increase MAD significantly.MAD can be calculated around the mean or median. The interpretation changes depending on the chosen center.5. Coefficient Of Variation(CV):Coefficient of Variation (CV) is a statistical measure that shows the relative variability or dispersion of data compared to its mean.In simple words:CV tells us how much variation exists relative to the average value.It is usually expressed as a percentage.Generally:Lower CV → Lower relative variabilityHigher CV → Higher relative variabilityThis makes CV useful when comparing datasets with different means or different units/scales.Use Case:Finance: Compare risk relative to return between different investments. CV= Risk / Average Return2. Scientific experiments: Compare consistency of measurements from different experiments or instruments.Limitation:Not suitable when the mean is zero or very close to zeroProblematic with negative means: Interpretation becomes difficult when the mean is negative.Primarily useful for ratio-scale data: It is not appropriate for arbitrary scales such as temperature measured in Celsius.Shape of DataSkewness:Skewness is a statistical measure that tells us about the asymmetry of a distribution around its mean.In simple words:Skewness tells us whether the data is symmetrically distributed or has a longer tail on one side.Skewness measures the asymmetry or lack of symmetry in a dataset relative to its mean.Positive Skew (Right-skewed): Tail extends toward higher values on the right; Mean > Median > ModeNegative Skew (Left-skewed): Tail extends toward lower values on the left; Mean Symmetric: Data is evenly distributed on both sides; Mean = Median = ModeFormulation:Interpretation:Skewness(Sk) = 0 then perfect SymmetricSkewness(Sk) > 0 then Positively / right skewedSkewness(Sk) Small absolute value: approximately symmetricLarge absolute value: strong asymmetryUse case:Understand the shape of the distributionDetect asymmetryIdentify potential outliersDecide whether a transformation might be usefulUnderstand assumptions behind some statistical models2. Kurtosis:Kurtosis is a statistical measure that describes the shape of a distribution, particularly the behavior of its tails and the presence of extreme values.In simple words:Kurtosis tells us how prone a distribution is to producing extreme values compared with a normal distribution.A common misconception is that kurtosis only measures “peakedness.” In modern statistics, kurtosis is more closely associated with tail heaviness and extreme observations.Formulation:Type of Kurtosis:Mesokurtic → Kurtosis =3Leptokurtic → Heavy tails → More extreme values → Kurtosis > 3Platykurtic → Light tails → Fewer extreme values → Kurtosis Use Case:Kurtosis is particularly useful for studying financial returns.Outlier / Extreme-value analysis: High kurtosis does not automatically mean that the dataset contains an error or an outlier.Machine Learning / Data ScienceLimitation:Sensitive to extreme valuesDoes not tell you which observation is an outlierQuantiles & Percentiles :Quantiles are cut-off points that divide a sorted dataset into equal-sized, continuous groups.A percentile is a specific type of quantile that divides data into 100 equal parts. It represents the value below which a certain percentage of data falls.Common Types of Quantiles:Quartiles (4 parts): Cut data at 25%, 50%, and 75%.Quintiles (5 parts): Cut data at 20%, 40%, 60%, and 80%.Deciles (10 parts): Cut data at 10%, 20%, …, 90%.percentile(100 Parts): Cut the data at 1%,2%,…99%90th percentile Means:If your score is at the 90th percentile, it means approximately:90% of the observations are at or below your score.It does not mean that you scored 90%.Formulation:Example:Use Case:Understand Data DistributionOutlier DetectionIncome AnalysisRelative Scoring in ExamLimitation:Different calculation methods can give different resultsThey don’t show the entire distributionQuantiles can be unstable with very small datasetsIQR:One of the most important applications of quantiles is the Interquartile Range.How to Calculate the IQRSort the data in ascending order from least to greatest.Find the median (Q₂(50%)) to split the dataset into lower and upper halves.Find the lower quartile (Q₁(25%)) by calculating the median of the lower half of the data.Find the upper quartile (Q₃(75%)) by calculating the median of the upper half of the data.Subtract Q₁ from Q₃ using the formula: IQR = Q₃ — Q₁.Use Case:Resistant to OutliersOutlier Detection3. Boxplot: A Box Plot, also called a Box-and-Whisker Plot, is a graphical representation used to show the distribution, spread, center, and potential outliers of numerical data.Graph Of Univariate Analysis:Categorical Columns:For categorical columns, key metrics include frequency, percentages, mode, and cardinality. These are the primary numerical values used to analyze categorical data.For univariate visualization of categorical columns, we typically use bar charts, pie charts, and frequency tables.Frequency Table , Sales Chart , Bar Chart2. Numerical Columns:For numerical columns, we first analyze basic numerical metrics such as Central Tendency (Mean, Median, Mode), Spread or Dispersion (Variance, Standard Deviation, IQR, CV), and the overall Distribution (Skewness, Kurtosis).To visualize the univariate distribution of numerical columns, we use histograms, box plots, KDE plots, and Q-Q plots.Boxplot plot, Histogram, Q-Q Plot, KDE PlotIn the above discussion, we talked about the boxplot; now I am talking aboutKDE Plot:A KDE (Kernel Density Estimate) plot visualizes the probability density of a continuous variable as a smooth, continuous curve rather than discrete histogram bars.Mathematical Functions:Given a dataset of n points (x_1, x_2, … , x_n), the estimated density f̂(x) at any point x along the horizontal axis is defined as:Estimated Density Functionsn: Total number of data points in your sample.x_i: Each individual data point in your dataset.K(⋅): The Kernel function — a symmetric, non-negative function that integrates to 1 (most commonly a standard normal/Gaussian bell curve).h: The Bandwidth (h > 0) — a smoothing parameter that controls the width of each individual bell curve.KDE PlotTo build a KDE plot by hand or from scratch without a plotting library:Gussian functions as KernelChoose a Kernel (K): Most implementations default to the Gaussian kernel.Select a Bandwidth (h): Pick a width for your individual curves (often estimated automatically using Silverman’s rule of thumb:Q-Q plot:A quantile-quantile (Q-Q) plot is a graphical tool used in statistics to see if a set of data follows a specific theoretical distribution (like a normal distribution) or to compare two separate data samples.How It WorksOrdering: The sample data is sorted from smallest to largest.Quantiles: These sorted values (sample quantiles) are plotted on the vertical (y) axis.Theoretical Values: Expected values from a reference distribution (such as a standard normal distribution) are plotted on the horizontal (x) axis.Reference Line: A straight diagonal line is drawn through the points.Q-Q PlotHow to Interpret the ShapeStraight line: If the points fall roughly along a straight diagonal line, the sample data matches the theoretical distribution.Curving at the ends (S-shape): If the tails curve away from the line, the data has heavy tails (more extreme values than a normal distribution would expect) or light tails.Bending upward or downward (Curves)An upward curve (concave up) usually signals right-skewed data.A downward curve (concave down) usually signals left-skewed data.Graph of Bivariate AnalysisThere are three main types of bivariate analysis:Here we only mention about the graphs which are useful but not discussion in depth, not any statistical methods for now. I will talk about this in an upcoming blog.Categorical vs. Categorical columnsVisualizations: Grouped bar charts, stacked bar charts, and heatmaps (visualizing cross-tabulations).Statistical Methods: Cross-tabulation (contingency tables) and the Chi-Square test of independence.2. Categorical vs. NumericalVisualizations: Side-by-side box plots, violin plots, overlapping histograms, and strip/swarm plots.Statistical Methods: Comparing group means/medians, Two-sample t-test, and ANOVA (Analysis of Variance).3. Numerical vs. NumericalVisualizations: Scatter plots, line plots (especially for time-series data), and hexbin/2D density plots.Statistical Methods: Pearson correlation coefficient (linear relationship) and Spearman rank correlation (monotonic relationship).ConclusionDescriptive statistics serve as the foundational toolkit for raw data exploration, allowing us to summarize central tendencies, quantify variability, and understand data shapes before diving into complex modeling. While these metrics give us a clear snapshot of historical datasets, they only tell part of the story. To move beyond what the data looks like and begin making predictions, handling uncertainty, and testing hypotheses, we need to understand the underlying mechanics of randomness and risk.What’s Next: Statistics in Data Science (Part 2): Probability Theory & Probability DistributionsIn the next part of this series, we transition from describing data to modeling uncertainty:Probability Theory Basics: Sample spaces, events, conditional probability, and Bayes’ Theorem.Random Variables: Discrete vs. continuous random variables and expected value.Probability Distributions: Deep dive into the Normal Distribution, Binomial, Poisson, and Bernoulli distributions.Central Limit Theorem (CLT): Why the normal distribution is the backbone of statistical inference.Statistics in Data Science (Part 1): Descriptive Statistics was originally published in Towards AI on Medium, where people are continuing the conversation by highlighting and responding to this story.