Data and Statistics Basics: Data Types, Mean, Variance and Worked Examples
Follow eight teaching latencies from raw rows to centre, spread and outlier checks. Every calculation separates population and sample notation clearly.
KnowledgeGate Team
Exam prep & CS education

Mean, variance and standard deviation are easy to memorise separately. Questions become confusing when you must identify the variable type, choose a useful summary, handle an outlier and decide between population and sample notation. The eight rounded request latencies are 12, 15, 15, 16, 18, 20, 22, 42 ms. Checked results are mean 20 ms, median 17 ms, population variance 77.75 ms^2, sample variance 88.86 ms^2, and one IQR-flagged outlier at 42 ms.
1. Data basics: variables, populations and samples
Data are recorded values. A dataset organises them, an observation is one case, and a variable is one measured field.
Field | Example or domain | Type | Reason |
|---|---|---|---|
Request ID |
| Identifier | Label only |
Device |
| Categorical nominal | No order |
Retry count |
| Quantitative discrete | Event count |
Latency | Rounded milliseconds | Quantitative continuous | Time remains continuous |
Priority |
| Categorical ordinal | Meaningful order |
Digits can label rather than measure, so a pin code is not automatically quantitative.
If these are every request in a one-minute log, they form a finite population and mu = 20 ms is a parameter. If randomly selected from a larger stream, they form a sample and x-bar = 20 ms is a statistic estimating its mean. Descriptive statistics organise observed data; inferential statistics reason from a sample to a population with uncertainty. These summaries support data-driven Approaches to AI, where data quality and problem structure also guide model choice. The Skill Development Courses page groups applied learning paths in one place.
2. Frequency distributions: organise the eight raw values
Start with indexed rows: R1=12, R2=15, R3=15, R4=16, R5=18, R6=20, R7=22, R8=42, all in milliseconds. Sorting preserves observations while revealing median and quartiles.
Latency x (ms) | Frequency f | Relative frequency f/8 | Cumulative frequency |
|---|---|---|---|
12 | 1 | 12.5% | 1 |
15 | 2 | 25% | 3 |
16 | 1 | 12.5% | 4 |
18 | 1 | 12.5% | 5 |
20 | 1 | 12.5% | 6 |
22 | 1 | 12.5% | 7 |
42 | 1 | 12.5% | 8 |
Audit it: sum f = 8, relative frequencies total 100%, and final cumulative frequency is 8. Raw rows preserve cases, frequency exposes repetition, relative frequency gives a share, and cumulative frequency counts values at or below a point. Thus 6/8 = 75% are at or below 20 ms.

3. Calculate mean, median and mode, then choose among them
Do not skip the total:
sum x = 12+15+15+16+18+20+22+42 = 160
So the arithmetic mean is 160/8 = 20 ms. The frequency table provides an independent check:
sum fx = 12(1)+15(2)+16(1)+18(1)+20(1)+22(1)+42(1) = 160
The mean is the balance point using every value. With even n=8, the median averages positions four and five: (16+18)/2 = 17 ms. The mode is 15 ms because it occurs twice. Data may have no mode or several; mode is not the largest value or frequency 2.
Temporarily remove 42. The remaining total is 118, giving mean 118/7 = 16.857... ms, median 16 ms and mode 15 ms. Against the original 20, 17 and 15 ms, the mean shifts most because it uses magnitudes; the median mainly uses order. Prefer the median when skew or outliers distort typical centre, but retain the mean when every magnitude and the total matter.
4. Measure spread with range, IQR, variance and standard deviation
The range is 42-12 = 30 ms. Under the median-of-halves convention, lower half 12, 15, 15, 16 gives Q1=(15+15)/2=15 ms; upper half 18, 20, 22, 42 gives Q3=(20+22)/2=21 ms. Thus IQR=21-15=6 ms. Range uses the extremes; IQR describes the middle half.
Now measure deviations around the mean 20:
x | x - 20 | (x - 20)^2 |
|---|---|---|
12 | -8 | 64 |
15 | -5 | 25 |
15 | -5 | 25 |
16 | -4 | 16 |
18 | -2 | 4 |
20 | 0 | 0 |
22 | 2 | 4 |
42 | 22 | 484 |
Checks: sum(x-20)=0 and sum(x-20)^2=622 ms^2. For this complete finite population, sigma^2=622/8=77.75 ms^2 and sigma=sqrt(77.75)=8.817596... ms, about 8.82 ms. Variance has squared units; standard deviation returns to milliseconds and expresses typical distance around the mean, not the largest gap. The 484 from 42 shows outlier sensitivity. Linear Algebra for GATE CS bridges to variance in vectors, covariance matrices and eigenvalue methods. Basic one-variable variance needs no eigenvalues.
5. Detect the outlier and read the distribution's shape
Tukey's 1.5 x IQR rule gives fences Q1-1.5(IQR)=15-9=6 ms and Q3+1.5(IQR)=21+9=30 ms. Values outside [6,30] are flagged, so 42 ms is an outlier under this rule and all others are inside. A flag calls for investigation. It neither proves error nor authorises deletion.
The ordinary five-number summary is min=12, Q1=15, median=17, Q3=21, max=42. A modified box plot ends whiskers at non-outliers 12 and 22, showing 42 separately. The right tail puts mean 20 above median 17 and mode 15.
Under the population convention, z=(42-20)/8.817596...=2.495..., about 2.50. This is distance from the mean in standard-deviation units, not a universal deletion threshold, especially for small or skewed data. Ask whether 42 is a real slow request, unit mismatch or recording fault before retaining, correcting or excluding it.

6. Population and sample variance: choose the formula deliberately
The squared-deviation total 622 supports two calculations. For the complete finite population, variance is 622/8=77.75 ms^2. For a sample estimating a larger stream, s^2=622/(8-1)=622/7=88.857142... ms^2, and s=sqrt(622/7)=9.426406... ms, about 9.43 ms.
Bessel's correction has a practical reason. After estimating the sample mean, only n-1=7 deviations are free to vary because their sum must be zero. Dividing by n-1 corrects the naive sample-variance estimator's downward bias. Neither denominator is universally correct; context decides.
Correct arithmetic does not guarantee good inference. An x-bar=20 ms sample may poorly represent wider latency if drawn from one device, period or network. Representative or random collection matters. Probability for GATE CS builds the next foundation for sampling uncertainty.
7. Data and statistics traps in assessment-style questions
Wrong move | What goes wrong | Correct move |
|---|---|---|
Treat digit-based ID as quantitative | Label becomes amount | Use meaning |
Call rounded latency discrete | Rounding hides continuity | Call latency continuous |
Find median before sorting | Wrong position | Sort first |
Report mode as frequency | Count replaces value | Report |
Use | Average is unfinished | Divide by two |
Confuse | Variance becomes SD | Check unit |
Divide by | Wrong denominator | Divide by |
Delete flagged | Valid extreme may vanish | Investigate first |
Mix quartile conventions | Fences conflict | State the convention giving |
Use these five checks: A: classify device, retry count, latency and priority as nominal, discrete, continuous and ordinal. B: recover mean 20, median 17, mode 15. C: choose median as the most outlier-resistant centre. D: get IQR=6, upper fence 30, then flag 42. E: choose 622/7, not 622/8, for a sample estimating wider variance.
Interpretation checks: 6/8=75% of observed values are at or below 20 ms; population SD 8.82 ms has the original unit, while variance 77.75 ms^2 does not. Neither statistic supports conclusions about the wider request stream without a representative sample.
8. Data and statistics basics in one recall chain
Recall the chain: identify observation and variable; classify data type; decide population or sample; sort and tabulate; choose centre; calculate spread with declared conventions; inspect shape and outliers. Checked results: n=8, sum 160, mean 20 ms, median 17 ms, mode 15 ms, population variance 77.75 ms^2, population SD about 8.82 ms, and IQR fence [6,30] flags 42 ms.
Hide the tables, rebuild them from 12,15,15,16,18,20,22,42, and explain why removing 42 shifts the mean more. Artificial Intelligence (AI) connects descriptive summaries to model-building decisions. Next, repeat every calculation on 4,4,5,7,10, first as a complete population, then as a sample.
Keep learning
Descriptive Statistics for ML: Mean, Variance, IQR and Robust Summaries
Work through one seven-value feature to see how ordinary and robust summaries react to a long right tail. Then turn the results into careful preprocessing choices.
Data and Statistics Basics MCQs and Short Answers: Mean, Data Literacy and AI
Practise a mixed set on data and statistics basics. Check six MCQs with option-by-option reasoning, then build five short answers with definitions, purpose and worked examples.
Range, Mean Deviation, Variance and Standard Deviation: 12 Questions with Solutions
Practise 12 questions on dispersion, from finding a range to recovering a missing number. Each solution shows the calculation and the trap to avoid.
Statistics for Competitive Exams: Concepts, Shortcuts and Solved Examples
Learn how to choose the right statistic, turn data into a useful table, calculate efficiently, and catch errors through solved examples and sanity checks.





