Tech News, Tech & Coding · Free Online Tools

IT Question Answer
Tools
Back to Data Science & Big Data
Descriptive vs Inferential Statistics Explained

Descriptive vs Inferential Statistics Explained

Data ScienceBy Muhammad Fareed
statisticsdata-sciencedescriptive-statisticsinferential-statistics

Short answer: descriptive statistics summarize the data you have, using measures such as the mean, median and standard deviation. Inferential statistics use a sample to draw conclusions about a larger population, using tools such as confidence intervals and hypothesis tests.

Descriptive statistics

These describe a dataset without going beyond it. Examples:

  • Center: mean, median, mode.
  • Spread: range, variance, standard deviation, interquartile range.
  • Shape: skewness and distribution plots such as histograms.
  • Relationships: correlation between two variables.

If you say "the average delivery time last month was 32 minutes", you are describing data you measured.

Inferential statistics

These help you make statements about a population from a sample. Examples:

  • Estimation: a 95% confidence interval for the average delivery time of all orders.
  • Hypothesis testing: checking whether a new checkout design really improved conversion or whether the difference could be chance.
  • Regression: modeling how one variable changes with others, with measures of uncertainty.

The key idea is that a sample is only a part of the whole, so conclusions come with uncertainty.

Side-by-side comparison

DescriptiveInferential
GoalSummarize the data you haveGeneralize to a larger population
UsesAverages, charts, tablesTests, confidence intervals, models
ResultCertain for the observed dataAn estimate with uncertainty
ExampleThe mean score in our class is 72The mean score of all students is probably between 69 and 75

A simple example

You survey 200 customers and find that 124 are satisfied. Descriptive: 62% of the 200 customers are satisfied. Inferential: based on this sample, the satisfaction rate for all customers is likely between about 55% and 69%, if the sample was chosen fairly. The range reflects sampling uncertainty.

What can go wrong

  • Biased samples: surveying only your most active users does not represent everyone.
  • Small samples: results can swing widely.
  • Misreading p-values: a small p-value does not prove an effect is large or important.
  • Confusing correlation with causation.

Quick glossary

  • Mean: the sum of values divided by their count.
  • Median: the middle value when data is sorted, which resists outliers.
  • Standard deviation: a measure of how spread out values are around the mean.
  • Confidence interval: a range that likely contains the true population value.
  • Null hypothesis: the default claim of no effect, which a test tries to challenge.
  • p-value: how surprising the data would be if the null hypothesis were true.

Key takeaways

  • Describe first: look at the data with summaries and charts before testing anything.
  • Infer carefully: a sample estimate always carries uncertainty, so report intervals, not just single numbers.
  • Check how the sample was collected, because a biased sample cannot be fixed by statistics.
  • Remember that statistical significance is not the same as practical importance.

Descriptive statistics in Python

import pandas as pd

df = pd.read_csv("orders.csv")
print(df["amount"].describe())          # count, mean, std, min, quartiles, max
print(df["amount"].median())
print(df["country"].value_counts().head())
print(df.groupby("channel")["amount"].agg(["mean", "median", "count"]))

These few lines summarise the data you actually have. Nothing here claims anything about customers who are not in the file, which is the defining feature of descriptive statistics.

A simple inferential test: comparing two groups

Suppose an online shop shows two versions of a checkout page and wants to know whether version B really increases the average order value, or whether the difference is just random noise.

from scipy import stats

a = df[df["version"] == "A"]["amount"]
b = df[df["version"] == "B"]["amount"]

t_stat, p_value = stats.ttest_ind(a, b, equal_var=False)  # Welch's t-test
print(f"p-value: {p_value:.4f}")

The p-value is the probability of seeing a difference at least this large if there were truly no difference between the versions. A small p-value (a common, but arbitrary, threshold is 0.05) suggests the difference is unlikely to be pure chance. It does not tell you how big or important the difference is, so always report the effect size and a confidence interval too.

Confidence intervals in plain words

A 95% confidence interval for the average order value, such as 40 to 46, means that if you repeated the sampling many times, about 95% of intervals built this way would contain the true population average. It is a range of plausible values, not a guarantee. Wider intervals signal more uncertainty, usually because the sample is small or the data varies a lot.

Common mistakes

  • Treating a p-value as the probability that the hypothesis is true. It is a statement about the data assuming no effect, not about the hypothesis itself.
  • Using the mean for skewed data such as incomes or house prices, where a few large values pull it up. Report the median as well.
  • Generalising from a biased sample, for example surveying only your most loyal customers.
  • Running many tests and reporting only the significant one, which makes false discoveries very likely.
  • Confusing statistical significance with practical importance. A tiny effect can be "significant" with enough data.

Apply these ideas in the data science workflow, show results with the right chart, and see how evaluation metrics work in accuracy, precision and recall.

Frequently asked questions

Which should I learn first?

Start with descriptive statistics and charts, because they build the intuition you need to understand inference later.

Do I need inferential statistics for machine learning?

It helps. Ideas such as sampling, variance, confidence and hypothesis testing underlie model evaluation and experiments, even when libraries do the calculations.

What is a population versus a sample?

The population is everyone or everything you want to study. A sample is the part of it that you actually measure.

What sample size do I need?

It depends on how small an effect you want to detect and how much the data varies. A power analysis calculates it before you collect data; many statistics libraries and online calculators can do this.