📘 DATA ANALYTICS SERIES · CHAPTER 49
Statistics for Data Analysts — Practical Guide India 2026
Descriptive statistics, probability distributions, hypothesis testing, A/B testing, correlation, and regression — the statistical concepts every data analyst in India actually uses, with Python code and business examples.
What Statistics Does a Data Analyst Actually Need?
Statistics textbooks cover enormous ground — much of it irrelevant to an analyst's daily work. This chapter covers only the statistics that appear in real analysis tasks and job interviews in India. Think of this as applied statistics, not academic statistics.
1. Descriptive Statistics — Summarising What You See
Descriptive statistics turn a column of numbers into a story. Before any analysis, every analyst should run describe() and know what each number means in business terms.
import pandas as pd
import numpy as np
df = pd.read_csv('orders.csv')
# The first thing you should always run
print(df['order_value'].describe())
# Output:
# count 10000.000
# mean 1842.50 <-- average order value
# std 2310.00 <-- high std = wide spread = outliers likely
# min 50.00
# 25% 450.00 <-- 25% of orders are below ₹450
# 50% 980.00 <-- median — half above, half below ₹980
# 75% 2100.00 <-- 75% of orders are below ₹2,100
# max 85000.00 <-- one massive outlier pulling mean up
# Mean vs median gap: ₹1842 vs ₹980 → strong right skew → use median
print(f"Skewness: {df['order_value'].skew():.2f}") # > 1 = right-skewed
# Percentile check
for p in [90, 95, 99]:
print(f"P{p}: ₹{df['order_value'].quantile(p/100):,.0f}")| Metric | What it measures | When to use | Weakness |
|---|---|---|---|
| Mean | Arithmetic average | Symmetric distributions — heights, test scores | Sensitive to outliers |
| Median | Middle value (50th percentile) | Skewed distributions — income, prices, wait times | Ignores extreme values (sometimes intentionally) |
| Mode | Most frequent value | Categorical data — most common city, product | Can be multiple or meaningless for continuous data |
| Std Deviation | Average spread from mean | Comparing variability across groups | In same units as data — hard to compare across scales |
| Variance | Std deviation squared | Mathematical operations, ANOVA | Units are squared — hard to interpret directly |
| Percentiles | Value below which X% of data falls | SLAs (P95 latency), outlier thresholds | Does not describe shape between percentiles |
| IQR (Q3−Q1) | Middle 50% spread | Outlier detection (1.5×IQR rule) | Only captures middle — misses tail behaviour |
2. Probability Distributions — Four You Must Recognise
You do not need to derive these distributions mathematically. You need to recognise which distribution describes your data and what that implies for your analysis.
from scipy import stats
stat, p = stats.shapiro(df['column'])
print('Normal' if p > 0.05 else 'Not normal')# Visualise df['order_value'].hist(bins=50) # If right tail is long → right-skewed → prefer log transform
from scipy.stats import binom # P(exactly k conversions out of n visits with rate p) binom.pmf(k=50, n=1000, p=0.04)
from scipy.stats import poisson # P(exactly k events given avg rate lambda) poisson.pmf(k=5, mu=3.2) # 3.2 tickets/hour avg
3. Hypothesis Testing — The Framework
Hypothesis testing answers a specific question: is the difference we observed in the data real, or could it have happened by random chance? Every A/B test, every "our conversion rate went up this month" claim, and every "product A sells better than product B" conclusion should go through this framework.
- State H₀ and H₁ — Null hypothesis (no effect) and alternative (there is an effect)
- Choose significance level α — Usually 0.05 (5% chance of false positive)
- Choose the right test — t-test, z-test, chi-square — depends on your data type
- Calculate p-value — probability of seeing this result if H₀ were true
- Decide — if p < α, reject H₀ and conclude the effect is statistically significant
Which Test to Use
| Test | When to use | Business example |
|---|---|---|
| Two-sample t-test | Compare means of two groups (continuous data) | Is average order value higher in Mumbai vs Delhi? |
| Paired t-test | Compare same group before and after an intervention | Did the email campaign increase avg session time? |
| z-test for proportions | Compare two conversion rates or percentages | Did variant B have higher checkout conversion than control A? |
| Chi-square test | Test independence between two categorical variables | Is payment method (UPI/card/COD) associated with return rate? |
| One-sample t-test | Compare a sample mean to a known benchmark | Is our NPS score significantly different from industry average of 42? |
| ANOVA | Compare means across 3+ groups | Do 4 product categories have different average ratings? |
from scipy import stats
import numpy as np
# Two-sample t-test: Mumbai vs Delhi order values
mumbai_orders = df[df['city'] == 'Mumbai']['order_value']
delhi_orders = df[df['city'] == 'Delhi']['order_value']
t_stat, p_value = stats.ttest_ind(mumbai_orders, delhi_orders)
print(f"t-statistic: {t_stat:.3f}")
print(f"p-value: {p_value:.4f}")
print(f"Conclusion: {'Significant difference' if p_value < 0.05 else 'No significant difference'} at α=0.05")
# z-test for proportions: A/B test on conversion rate
from statsmodels.stats.proportion import proportions_ztest
conversions = [45, 62] # A: 45 converted, B: 62 converted
nobs = [1000, 1000] # 1000 visitors each
z_stat, p_val = proportions_ztest(conversions, nobs)
print(f"z-stat: {z_stat:.3f}, p-value: {p_val:.4f}")
print(f"CVR A: {45/1000:.2%}, CVR B: {62/1000:.2%}")
if p_val < 0.05:
print("Variant B wins — roll out to all users")
else:
print("Difference not statistically significant — do not call a winner yet")4. A/B Testing — Practical Walkthrough
A/B testing is hypothesis testing applied to product or marketing decisions. It is one of the most common analyst responsibilities at startups, e-commerce companies, and product teams — and one of the most commonly misused.
- Stopping the test as soon as results look significant (peeking problem)
- Not calculating required sample size before starting
- Running test for too short a period (missing weekly seasonality)
- Testing on too small a segment to detect a meaningful difference
- Declaring a winner based on absolute numbers without a significance test
- ✅ One hypothesis, one primary metric
- ✅ Sample size calculated (use a power calculator)
- ✅ Minimum test duration: 2 full weeks (captures Mon-Sun cycle)
- ✅ Randomisation verified (no overlap between groups)
- ✅ Guard rails defined (what would stop the test early?)
# Step 1: Calculate required sample size BEFORE starting
from statsmodels.stats.power import NormalIndPower
analysis = NormalIndPower()
n = analysis.solve_power(
effect_size=0.2, # minimum detectable effect (Cohen's d)
alpha=0.05, # significance level
power=0.80, # 80% chance of detecting a real effect
alternative='two-sided'
)
print(f"Required sample size per group: {int(n)}")
# → ~197 per group. Run until you have 197 in EACH group.
# Step 2: After test ends, analyse results
from scipy.stats import ttest_ind
control = df[df['variant'] == 'A']['revenue_per_session']
treatment = df[df['variant'] == 'B']['revenue_per_session']
t, p = ttest_ind(control, treatment)
lift = (treatment.mean() - control.mean()) / control.mean()
print(f"Control mean: ₹{control.mean():.2f}")
print(f"Treatment mean: ₹{treatment.mean():.2f}")
print(f"Relative lift: {lift:.1%}")
print(f"p-value: {p:.4f}")
print(f"Statistically significant: {p < 0.05}")5. Correlation — Measuring Relationships in Data
Correlation quantifies how strongly two variables move together. It ranges from -1 (perfect negative — when one goes up, the other goes down) to +1 (perfect positive — they move together exactly). Zero means no linear relationship.
import seaborn as sns
import matplotlib.pyplot as plt
# Correlation matrix for numeric columns
corr = df[['revenue', 'visits', 'avg_session_time', 'cart_adds']].corr()
# Heatmap
plt.figure(figsize=(8, 6))
sns.heatmap(corr, annot=True, fmt='.2f', cmap='coolwarm',
vmin=-1, vmax=1, center=0)
plt.title('Correlation Matrix — Sales Metrics')
plt.tight_layout()
plt.savefig('correlation_heatmap.png')
# Pearson r between two specific columns
from scipy.stats import pearsonr
r, p = pearsonr(df['ad_spend'], df['revenue'])
print(f"Correlation: {r:.3f}, p-value: {p:.4f}")
# r=0.72, p<0.05 → strong positive correlation, statistically significant6. Linear Regression — Prediction and Driver Analysis
Linear regression fits a line through data to quantify the relationship between a dependent variable (what you want to predict) and one or more independent variables (the drivers). For data analysts, the most useful output is the coefficients — they tell you how much the outcome changes per unit change in each driver.
import statsmodels.api as sm
import pandas as pd
# Business question: what drives monthly revenue?
# Independent variables (drivers): ad_spend, num_products, avg_price, month_num
X = df[['ad_spend', 'num_products', 'avg_price', 'month_num']]
y = df['monthly_revenue']
# Add constant (intercept)
X = sm.add_constant(X)
# Fit the model
model = sm.OLS(y, X).fit()
print(model.summary())
# Key outputs to read:
# R-squared: how much variance in revenue is explained (e.g., 0.82 = 82%)
# Coefficients: for every ₹1 increase in ad_spend, revenue increases by ₹coef[ad_spend]
# p-values: is each coefficient statistically significant? (p < 0.05 = yes)
# Simpler version with sklearn
from sklearn.linear_model import LinearRegression
from sklearn.metrics import r2_score
model_sk = LinearRegression()
model_sk.fit(X_train, y_train)
y_pred = model_sk.predict(X_test)
print(f"R² on test set: {r2_score(y_test, y_pred):.3f}")
# Coefficients
for feature, coef in zip(X_train.columns, model_sk.coef_):
print(f"{feature}: ₹{coef:.2f} per unit increase")Statistics Interview Quick Reference — India
What is the difference between Type I and Type II error?
Type I (false positive): rejecting H₀ when it is true — concluding an effect exists when it does not. Type II (false negative): failing to reject H₀ when it is false — missing a real effect. α controls Type I rate; power (1−β) controls Type II rate.
What is the Central Limit Theorem?
The distribution of sample means approaches a normal distribution as sample size increases, regardless of the underlying data distribution. This is why t-tests and z-tests work even when your raw data is not normal — you just need a large enough sample (typically n > 30).
What is the difference between standard deviation and standard error?
Standard deviation measures spread within your sample. Standard error measures how precisely your sample mean estimates the population mean — it equals SD / √n. As sample size increases, SE decreases (more data = more precise estimate of the true mean).
What does "statistically significant" mean in plain English?
It means the observed result is unlikely to have occurred by random chance, given the null hypothesis. It does NOT mean the result is large, important, or practically meaningful. A very large sample can make a tiny, irrelevant difference statistically significant. Always pair statistical significance with practical significance (effect size).
What is the 68-95-99.7 rule?
In a normal distribution: 68% of values fall within 1 standard deviation of the mean, 95% within 2 SD, and 99.7% within 3 SD. Practical use: if a metric is 3 SD away from its historical mean, something unusual has very likely occurred — worth investigating.
Frequently Asked Questions
How much statistics does a data analyst in India need to know?
A data analyst in India needs practical, applied statistics — not theoretical proofs. The core topics are: descriptive statistics (mean, median, mode, standard deviation, percentiles), basic probability (distributions, expected value), hypothesis testing (t-test, chi-square), correlation vs causation, and regression (linear regression for prediction). Deep probability theory and advanced ML statistics are data science territory, not required for most analyst roles.
What is the difference between mean and median, and when should you use each?
Mean is the arithmetic average — sum divided by count. It is sensitive to outliers. Median is the middle value when data is sorted — it is robust to outliers. Use median for skewed distributions like income, home prices, or delivery times where a few extreme values would distort the mean. Use mean for symmetric distributions like heights or test scores. In business: always check both. If mean and median differ significantly, the distribution is skewed and median is a better representative.
What is a p-value and what does p < 0.05 mean?
A p-value is the probability of observing a result at least as extreme as your data, assuming the null hypothesis is true. p < 0.05 means that if there were no real effect (null hypothesis), you would see a result this extreme less than 5% of the time by random chance. It is a threshold convention — it does not mean the effect is large, practically significant, or that your hypothesis is 95% likely to be correct. Always report effect size alongside p-values.
How do you run an A/B test as a data analyst in India?
A/B testing steps: (1) Define the hypothesis — what change are you testing and what metric will improve? (2) Calculate the required sample size using a power calculator (aim for 80% power at p=0.05). (3) Randomly split users into control (A) and treatment (B) groups. (4) Run the test until you reach the required sample size — do not stop early. (5) Run a two-proportion z-test or t-test on the metric. (6) If p < 0.05 and effect size is practically meaningful, conclude the variant wins. Most Indian startups use Google Optimize, VWO, or custom SQL-based tracking.
What is the difference between correlation and causation?
Correlation means two variables move together — when one goes up, the other tends to go up (or down). Causation means one variable directly causes a change in the other. Correlation does not imply causation — ice cream sales and drowning rates are correlated (both rise in summer) but ice cream does not cause drowning. As a data analyst, you observe correlations in data. Claiming causation requires controlled experiments (A/B tests), natural experiments, or causal inference methods — not just a high correlation coefficient.
When is linear regression useful for data analysts?
Linear regression is useful for: (1) understanding which factors drive an outcome (feature importance), (2) predicting a continuous number (e.g., expected monthly revenue given ad spend), and (3) forecasting trends. For data analysts, the most practical use is understanding coefficients — how much does revenue change per ₹1 of ad spend? The key assumptions are linearity, independence, homoscedasticity, and normal residuals. Violating these is fine for exploratory analysis; matters for formal inference.
What statistics questions are asked in data analyst interviews in India?
Common statistics interview questions for data analysts in India: (1) Difference between mean, median, and mode and when to use each. (2) What is standard deviation and what does it tell you? (3) What is a normal distribution? (4) Explain p-value in plain English. (5) How would you design an A/B test? (6) What is the difference between Type I and Type II error? (7) When would you use a chi-square test vs a t-test? (8) Correlation vs causation example. Most roles at IT services companies ask questions 1-4; startups and product companies ask 5-8 as well.
Build Statistical Thinking With Real Data
Evika Academy, Noida Sector 51, teaches statistics through real business datasets — not textbook examples. Python, SQL, and applied stats taught together so you can use them in an interview and on the job from day one.
📱 Talk to a Mentor on WhatsApp