Statistical AnalysisStatistical Analysis
From data summaries to confidence intervals, hypothesis tests and regression — and how they help catch attackers. Data summary থেকে confidence interval, hypothesis test আর regression — আর এগুলো দিয়ে কীভাবে attacker ধরা যায়।
- Quick Recap and Data SummariesQuick Recap আর Data Summary
- Sampling and the Central Limit TheoremSampling আর Central Limit Theorem
- Estimation and Confidence IntervalsEstimation আর Confidence Interval
- Hypothesis TestingHypothesis Testing
- Comparing Groups (t, Chi-square, ANOVA)Group তুলনা (t, Chi-square, ANOVA)
- Correlation and RegressionCorrelation আর Regression
- Statistics in Information SecurityInformation Security-তে Statistics
- Practice QuestionsPractice Questions
1. Quick Recap and Data Summaries1. Quick Recap আর Data Summary
Quick recap (from Chapter 04)Quick recap (Chapter 04 থেকে)
- Mean \( \bar{x} = \frac{1}{n}\sum x_i \) — the average.
- Median — the middle value after sorting.
- Mode — the most frequent value.
- Variance — average squared distance from the mean. Population: divide by \(N\). Sample: divide by \(n-1\).
- Standard deviation (SD) — square root of variance. Same unit as the data.
- Mean \( \bar{x} = \frac{1}{n}\sum x_i \) — average।
- Median — sort করার পর মাঝের value।
- Mode — সবচেয়ে বেশিবার আসা value।
- Variance — mean থেকে দূরত্বের square-এর average। Population হলে \(N\) দিয়ে ভাগ, sample হলে \(n-1\) দিয়ে ভাগ।
- Standard deviation (SD) — variance-এর square root। Data-র unit-এই থাকে।
Quartiles and the five-number summaryQuartile আর five-number summary
Quartiles cut sorted data into four equal parts.
- Q1 (first quartile) — 25% of data is below it.
- Q2 = the median — 50% is below it.
- Q3 (third quartile) — 75% is below it.
The five-number summary is: Min, Q1, Median, Q3, Max. It tells you the centre and the spread in one line.
Simple method (use this in the exam): Sort the data. Find the median. Q1 is the median of the lower half. Q3 is the median of the upper half. If \(n\) is odd, leave the middle value out of both halves.
Quartile sorted data-কে চারটা সমান ভাগে কাটে।
- Q1 (first quartile) — data-র 25% এর নিচে থাকে।
- Q2 = median — 50% এর নিচে থাকে।
- Q3 (third quartile) — 75% এর নিচে থাকে।
Five-number summary হলো: Min, Q1, Median, Q3, Max। এক লাইনেই centre আর spread বোঝা যায়।
সহজ method (exam-এ এটাই ব্যবহার করো): Data sort করো। Median বের করো। নিচের অর্ধেকের median = Q1। উপরের অর্ধেকের median = Q3। \(n\) odd হলে মাঝের value-টা কোনো অর্ধেকেই নিও না।
IQR and the 1.5 × IQR outlier ruleIQR আর 1.5 × IQR outlier rule
The interquartile range (IQR) is the width of the middle 50% of data. Unlike the range, it does not care about extreme values.
Interquartile range (IQR) হলো data-র মাঝের 50%-এর width। Range-এর মতো এটা extreme value-তে প্রভাবিত হয় না।
Any value below the lower fence or above the upper fence is an outlier.
Lower fence-এর নিচে বা upper fence-এর উপরে যেকোনো value হলো outlier।
3, 5, 7, 8, 9, 11, 13, 15, 18, 40 (already sorted, \(n = 10\)).Step 1 — Median: \(n\) is even, so average the 5th and 6th values: \( \frac{9 + 11}{2} = 10 \).
Step 2 — Lower half: 3, 5, 7, 8, 9 → Q1 = 7.
Step 3 — Upper half: 11, 13, 15, 18, 40 → Q3 = 15.
Step 4 — IQR = 15 − 7 = 8.
Step 5 — Fences: lower = 7 − 1.5 × 8 = 7 − 12 = −5; upper = 15 + 12 = 27.
Step 6 — 40 > 27, so 40 is an outlier. Maybe that day someone ran a brute-force attack!
Five-number summary: Min = 3, Q1 = 7, Median = 10, Q3 = 15, Max = 40.
3, 5, 7, 8, 9, 11, 13, 15, 18, 40 (আগেই sorted, \(n = 10\))।Step 1 — Median: \(n\) even, তাই 5th আর 6th value-র average: \( \frac{9 + 11}{2} = 10 \)।
Step 2 — নিচের অর্ধেক: 3, 5, 7, 8, 9 → Q1 = 7।
Step 3 — উপরের অর্ধেক: 11, 13, 15, 18, 40 → Q3 = 15।
Step 4 — IQR = 15 − 7 = 8।
Step 5 — Fence: lower = 7 − 1.5 × 8 = −5; upper = 15 + 12 = 27।
Step 6 — 40 > 27, তাই 40 একটা outlier। হয়তো সেদিন কেউ brute-force attack চালিয়েছিল!
Five-number summary: Min = 3, Q1 = 7, Median = 10, Q3 = 15, Max = 40।
Box plotBox plot
A box plot (box-and-whisker plot) draws the five-number summary. The box goes from Q1 to Q3. A line inside the box marks the median. The whiskers go out to the smallest and largest values that are not outliers. Outliers are drawn as separate dots.
Box plot (box-and-whisker plot) five-number summary-কে ছবিতে দেখায়। Box থাকে Q1 থেকে Q3 পর্যন্ত। Box-এর ভেতরের line হলো median। Whisker যায় সবচেয়ে ছোট আর সবচেয়ে বড় non-outlier value পর্যন্ত। Outlier আলাদা dot হিসেবে আঁকা হয়।
Skewness (the idea)Skewness (idea-টা)
Skewness tells you if the data has a long tail on one side.
- Right (positive) skew: long tail to the right. Mean > Median. Example: income, file sizes, failed logins.
- Left (negative) skew: long tail to the left. Mean < Median. Example: marks in a very easy exam.
- Symmetric (like the normal curve): Mean ≈ Median ≈ Mode.
A quick measure is Pearson's skewness coefficient:
Skewness বলে data-র কোনো একদিকে লম্বা tail আছে কিনা।
- Right (positive) skew: ডানদিকে লম্বা tail। Mean > Median। Example: income, file size, failed login।
- Left (negative) skew: বামদিকে লম্বা tail। Mean < Median। Example: খুব সহজ exam-এর marks।
- Symmetric (normal curve-এর মতো): Mean ≈ Median ≈ Mode।
একটা quick measure হলো Pearson's skewness coefficient:
\( Sk = \frac{3(12.9 - 10)}{10.56} = \frac{8.7}{10.56} \approx 0.82 \). Positive, so the data is right-skewed. The outlier 40 pulls the mean up.
\( Sk = \frac{3(12.9 - 10)}{10.56} = \frac{8.7}{10.56} \approx 0.82 \)। Positive, তাই data right-skewed। Outlier 40 mean-কে উপরে টেনে নিচ্ছে।
z-score (standardization)z-score (standardization)
A z-score says how many standard deviations a value is away from the mean. Positive z = above the mean. Negative z = below the mean.
z-score বলে একটা value mean থেকে কত standard deviation দূরে। Positive z = mean-এর উপরে। Negative z = mean-এর নিচে।
If we convert every value to its z-score, the new data has mean 0 and SD 1. This is called standardization. It lets us compare values from different scales. If the data is normal, z follows the standard normal distribution \( N(0, 1) \).
সব value-কে z-score-এ convert করলে নতুন data-র mean হয় 0 আর SD হয় 1। একে বলে standardization। এতে আলাদা scale-এর value তুলনা করা যায়। Data normal হলে z follow করে standard normal distribution \( N(0, 1) \)।
Rahim: \( z = \frac{76 - 60}{8} = \frac{16}{8} = 2.0 \).
Karim: \( z = \frac{78 - 70}{5} = \frac{8}{5} = 1.6 \).
Rahim is 2 SDs above his class; Karim is only 1.6 SDs above. So Rahim did relatively better, even though his raw mark is lower.
Rahim: \( z = \frac{76 - 60}{8} = 2.0 \)।
Karim: \( z = \frac{78 - 70}{5} = 1.6 \)।
Rahim তার class থেকে 2 SD উপরে; Karim মাত্র 1.6 SD উপরে। তাই raw mark কম হলেও Rahim তুলনামূলক ভালো করেছে।
A small standard normal tableছোট একটা standard normal table
\( \Phi(z) = P(Z \le z) \) is the area to the left of \(z\). For negative z use \( \Phi(-z) = 1 - \Phi(z) \). Memorise these — you will use them in every section below.
\( \Phi(z) = P(Z \le z) \) হলো \(z\)-এর বামদিকের area। Negative z-এর জন্য \( \Phi(-z) = 1 - \Phi(z) \)। এগুলো মুখস্থ রাখো — নিচের প্রতিটা section-এ লাগবে।
| z | 1.00 | 1.50 | 1.645 | 1.96 | 2.00 | 2.33 | 2.576 | 3.00 |
|---|---|---|---|---|---|---|---|---|
| \( \Phi(z) \) | 0.8413 | 0.9332 | 0.9500 | 0.9750 | 0.9772 | 0.9901 | 0.9950 | 0.9987 |
2. Sampling and the Central Limit Theorem2. Sampling আর Central Limit Theorem
Population, sample, parameter, statisticPopulation, sample, parameter, statistic
- Population — every item we care about. Example: all packets that pass through a firewall in a year.
- Sample — the small part we actually look at. Example: 500 packets we captured.
- Parameter — a number about the population (usually unknown): \( \mu, \sigma, p \).
- Statistic — a number computed from the sample: \( \bar{x}, s, \hat{p} \). We use statistics to guess parameters.
We sample because checking the whole population is too slow, too costly, or impossible.
- Population — যত item নিয়ে আমরা ভাবছি, সবগুলো। Example: এক বছরে firewall দিয়ে যাওয়া সব packet।
- Sample — ছোট অংশ যেটা আমরা আসলে দেখি। Example: capture করা 500টা packet।
- Parameter — population সম্পর্কে একটা সংখ্যা (সাধারণত অজানা): \( \mu, \sigma, p \)।
- Statistic — sample থেকে হিসাব করা সংখ্যা: \( \bar{x}, s, \hat{p} \)। Statistic দিয়ে আমরা parameter আন্দাজ করি।
Sample নেই কারণ পুরো population check করা অনেক ধীর, খরচবহুল, বা অসম্ভব।
Sampling methodsSampling method
| MethodMethod | How it worksকীভাবে কাজ করে | Security exampleSecurity example |
|---|---|---|
| Simple random | Every item has the same chance. Pick using random numbers.প্রতিটা item-এর সমান chance। Random number দিয়ে বাছাই। | Pick 200 log lines at random from 1 million.10 লাখ log line থেকে random 200টা নেওয়া। |
| Stratified | Split into groups (strata) that are different from each other. Take a random sample from each group.Population-কে আলাদা ধরনের group (strata)-এ ভাগ করো। প্রতিটা group থেকে random sample নাও। | Survey staff: sample from IT, HR, Finance separately, in proportion to their size.Staff survey: IT, HR, Finance থেকে আলাদা করে, তাদের size অনুযায়ী sample। |
| Cluster | Split into many similar groups (clusters). Randomly pick a few clusters and take everyone in them.অনেকগুলো একই রকম group (cluster)-এ ভাগ করো। Random কয়েকটা cluster বেছে তার সবাইকে নাও। | Pick 5 branch offices at random and audit every PC there.Random 5টা branch office বেছে সেখানকার সব PC audit করা। |
| Systematic | Pick a random start, then take every k-th item.Random একটা শুরু, তারপর প্রতি k-তম item। | Inspect every 100th packet (like NetFlow sampling).প্রতি 100-তম packet inspect করা (NetFlow sampling-এর মতো)। |
Sampling distribution and standard errorSampling distribution আর standard error
Take a sample of size \(n\) and compute \( \bar{x} \). Take another sample — you get a slightly different \( \bar{x} \). If you repeat this many times, the values of \( \bar{x} \) form a distribution. This is the sampling distribution of the mean.
Its centre is the true mean \( \mu \). Its spread is called the standard error (SE):
Size \(n\)-এর একটা sample নিয়ে \( \bar{x} \) বের করো। আরেকটা sample নাও — একটু আলাদা \( \bar{x} \) পাবে। বারবার করলে \( \bar{x} \)-এর value-গুলো একটা distribution তৈরি করে। একে বলে sampling distribution of the mean।
এর centre হলো আসল mean \( \mu \)। এর spread-কে বলে standard error (SE):
Bigger sample → smaller SE → \( \bar{x} \) is closer to \( \mu \). But note the square root: to cut SE in half, you need 4 times the sample size.
Sample বড় → SE ছোট → \( \bar{x} \) \( \mu \)-এর আরও কাছে। কিন্তু square root খেয়াল করো: SE অর্ধেক করতে sample size 4 গুণ লাগে।
The Central Limit Theorem (CLT)Central Limit Theorem (CLT)
CLT in plain words: Take many random samples of size \(n\) from any population with mean \( \mu \) and SD \( \sigma \). If \(n\) is large enough (rule of thumb: \( n \ge 30 \)), the sample mean \( \bar{X} \) is approximately normal — even if the population itself is not normal.
This is why the normal curve appears everywhere in statistics. It is the reason we can build confidence intervals and do z-tests.
সহজ কথায় CLT: Mean \( \mu \) আর SD \( \sigma \) আছে এমন যেকোনো population থেকে size \(n\)-এর অনেক random sample নাও। \(n\) যথেষ্ট বড় হলে (rule of thumb: \( n \ge 30 \)), sample mean \( \bar{X} \) প্রায় normal হয় — population নিজে normal না হলেও।
এজন্যই statistics-এ normal curve সব জায়গায় দেখা যায়। এর কারণেই আমরা confidence interval বানাতে আর z-test করতে পারি।
(a) What is the probability that the sample mean is more than 530 bytes?
(b) What is the probability that the sample mean is between 480 and 520 bytes?
Step 1 — \(n = 36 \ge 30\), so by CLT, \( \bar{X} \) is about normal.
Step 2 — \( SE = \frac{120}{\sqrt{36}} = \frac{120}{6} = 20 \).
Step 3 — (a) \( z = \frac{530 - 500}{20} = 1.5 \). \( P(\bar{X} > 530) = 1 - \Phi(1.5) = 1 - 0.9332 = \mathbf{0.0668} \).
Step 4 — (b) \( z_1 = \frac{480 - 500}{20} = -1 \), \( z_2 = \frac{520 - 500}{20} = 1 \). \( P = \Phi(1) - \Phi(-1) = 0.8413 - 0.1587 = \mathbf{0.6826} \).
So about 68% of sample means fall within ±20 bytes of the true mean.
(a) Sample mean 530 bytes-এর বেশি হওয়ার probability কত?
(b) Sample mean 480 থেকে 520 bytes-এর মধ্যে হওয়ার probability কত?
Step 1 — \(n = 36 \ge 30\), তাই CLT অনুযায়ী \( \bar{X} \) প্রায় normal।
Step 2 — \( SE = \frac{120}{\sqrt{36}} = \frac{120}{6} = 20 \)।
Step 3 — (a) \( z = \frac{530 - 500}{20} = 1.5 \)। \( P(\bar{X} > 530) = 1 - \Phi(1.5) = 1 - 0.9332 = \mathbf{0.0668} \)।
Step 4 — (b) \( z_1 = -1 \), \( z_2 = 1 \)। \( P = \Phi(1) - \Phi(-1) = 0.8413 - 0.1587 = \mathbf{0.6826} \)।
মানে প্রায় 68% sample mean আসল mean-এর ±20 bytes-এর মধ্যে পড়ে।
3. Estimation and Confidence Intervals3. Estimation আর Confidence Interval
Point estimate vs interval estimatePoint estimate বনাম interval estimate
- A point estimate is one single number as our best guess. Example: "the mean response time is 220 ms" (\( \bar{x} \) estimates \( \mu \); \( \hat{p} \) estimates \( p \)).
- An interval estimate (confidence interval, CI) gives a range and a confidence level. Example: "the mean is between 210.2 and 229.8 ms, with 95% confidence".
A point estimate is almost never exactly right. An interval is more honest, because it shows how unsure we are.
An estimator is unbiased if, on average, it hits the true value. \( \bar{x} \) is unbiased for \( \mu \). \( s^2 \) (divide by \(n-1\)) is unbiased for \( \sigma^2 \).
- Point estimate হলো best guess হিসেবে একটা মাত্র সংখ্যা। Example: "mean response time 220 ms" (\( \bar{x} \) দিয়ে \( \mu \) estimate; \( \hat{p} \) দিয়ে \( p \) estimate)।
- Interval estimate (confidence interval, CI) একটা range আর confidence level দেয়। Example: "95% confidence-এ mean 210.2 থেকে 229.8 ms-এর মধ্যে"।
Point estimate প্রায় কখনোই একদম ঠিক হয় না। Interval বেশি সৎ, কারণ এটা দেখায় আমরা কতটা অনিশ্চিত।
কোনো estimator গড়ে আসল value-তে পৌঁছালে তাকে unbiased বলে। \( \bar{x} \) হলো \( \mu \)-এর unbiased estimator। \( s^2 \) (\(n-1\) দিয়ে ভাগ) হলো \( \sigma^2 \)-এর unbiased estimator।
General shape of a CICI-এর general shape
Critical values tableCritical value table
For a two-sided \( (1-\alpha) \) CI we use \( z_{\alpha/2} \) or \( t_{\alpha/2,\,df} \). The t value is always bigger than z, and it gets closer to z as df grows.
Two-sided \( (1-\alpha) \) CI-এর জন্য \( z_{\alpha/2} \) বা \( t_{\alpha/2,\,df} \) ব্যবহার করি। t value সবসময় z-এর চেয়ে বড়, আর df বাড়লে z-এর কাছে চলে আসে।
| ConfidenceConfidence | α | z | t (df = 4) | t (df = 5) | t (df = 9) | t (df = 10) | t (df = 15) | t (df = 20) | t (df = 30) |
|---|---|---|---|---|---|---|---|---|---|
| 90% | 0.10 | 1.645 | 2.132 | 2.015 | 1.833 | 1.812 | 1.753 | 1.725 | 1.697 |
| 95% | 0.05 | 1.960 | 2.776 | 2.571 | 2.262 | 2.228 | 2.131 | 2.086 | 2.042 |
| 99% | 0.01 | 2.576 | 4.604 | 4.032 | 3.250 | 3.169 | 2.947 | 2.845 | 2.750 |
Note: the 90% row is also the one-tailed 5% row (for example, 1.645 and \( t_{0.05,5} = 2.015 \)). Other values used in this chapter: \( t_{0.025,7} = 2.365 \), \( t_{0.025,8} = 2.306 \), \( t_{0.025,16} = 2.120 \), \( t_{0.05,7} = 1.895 \).
খেয়াল করো: 90% row-টাই one-tailed 5% row (যেমন 1.645 আর \( t_{0.05,5} = 2.015 \))। এই chapter-এ লাগবে এমন আরও value: \( t_{0.025,7} = 2.365 \), \( t_{0.025,8} = 2.306 \), \( t_{0.025,16} = 2.120 \), \( t_{0.05,7} = 1.895 \)।
CI for a mean when σ is known (z-interval)σ জানা থাকলে mean-এর CI (z-interval)
Step 1 — \( SE = \frac{35}{\sqrt{49}} = \frac{35}{7} = 5 \).
Step 2 — \( z_{0.025} = 1.96 \). Margin \( E = 1.96 \times 5 = 9.8 \).
Step 3 — CI = \( 220 \pm 9.8 = (210.2,\ 229.8) \) ms.
For 99% we use 2.576: \( E = 12.88 \), CI = (207.12, 232.88). More confidence → wider interval.
Step 1 — \( SE = \frac{35}{7} = 5 \)।
Step 2 — \( z_{0.025} = 1.96 \)। Margin \( E = 1.96 \times 5 = 9.8 \)।
Step 3 — CI = \( 220 \pm 9.8 = (210.2,\ 229.8) \) ms।
99%-এর জন্য 2.576: \( E = 12.88 \), CI = (207.12, 232.88)। বেশি confidence → চওড়া interval।
CI for a mean when σ is unknown (t-interval)σ অজানা হলে mean-এর CI (t-interval)
In real life we rarely know \( \sigma \). So we use the sample SD \( s \) instead. This adds extra uncertainty, so we use the Student's t distribution with \( df = n - 1 \). The t curve looks like the normal curve but has fatter tails. (We assume the population is roughly normal, which matters most when \(n\) is small.)
বাস্তবে আমরা খুব কমই \( \sigma \) জানি। তাই এর বদলে sample SD \( s \) ব্যবহার করি। এতে অনিশ্চয়তা বাড়ে, তাই \( df = n - 1 \) সহ Student's t distribution ব্যবহার করি। t curve দেখতে normal-এর মতো, কিন্তু tail মোটা। (ধরে নিই population মোটামুটি normal — \(n\) ছোট হলে এটা বেশি জরুরি।)
Step 1 — \( \sigma \) unknown and \(n = 16\) is small → use t with \( df = 15 \).
Step 2 — \( t_{0.025,15} = 2.131 \). \( SE = \frac{8}{\sqrt{16}} = 2 \).
Step 3 — \( E = 2.131 \times 2 = 4.262 \).
Step 4 — CI = \( 52.0 \pm 4.262 = (47.74,\ 56.26) \) hours.
If we had wrongly used z = 1.96, we would get \( \pm 3.92 \) — too narrow, too confident.
Step 1 — \( \sigma \) অজানা আর \(n = 16\) ছোট → \( df = 15 \) সহ t।
Step 2 — \( t_{0.025,15} = 2.131 \)। \( SE = \frac{8}{4} = 2 \)।
Step 3 — \( E = 2.131 \times 2 = 4.262 \)।
Step 4 — CI = \( 52.0 \pm 4.262 = (47.74,\ 56.26) \) hours।
ভুল করে z = 1.96 নিলে \( \pm 3.92 \) পেতাম — বেশি চিকন, বেশি overconfident।
CI for a proportionProportion-এর CI
For yes/no data, \( \hat{p} = x/n \) (number of "yes" divided by sample size). This works well when \( n\hat{p} \ge 10 \) and \( n(1-\hat{p}) \ge 10 \).
Yes/no data-র জন্য \( \hat{p} = x/n \) ("yes"-এর সংখ্যা ÷ sample size)। \( n\hat{p} \ge 10 \) আর \( n(1-\hat{p}) \ge 10 \) হলে এটা ভালো কাজ করে।
Step 1 — \( \hat{p} = 88/400 = 0.22 \). Check: \( 400 \times 0.22 = 88 \ge 10 \), \( 400 \times 0.78 = 312 \ge 10 \). OK.
Step 2 — \( SE = \sqrt{\frac{0.22 \times 0.78}{400}} = \sqrt{0.000429} = 0.02071 \).
Step 3 — \( E = 1.96 \times 0.02071 = 0.0406 \).
Step 4 — CI = \( 0.22 \pm 0.0406 = (0.179,\ 0.261) \). So between about 17.9% and 26.1% of all accounts have weak passwords.
Step 1 — \( \hat{p} = 88/400 = 0.22 \)। Check: \( 400 \times 0.22 = 88 \ge 10 \), \( 400 \times 0.78 = 312 \ge 10 \)। ঠিক আছে।
Step 2 — \( SE = \sqrt{\frac{0.22 \times 0.78}{400}} = \sqrt{0.000429} = 0.02071 \)।
Step 3 — \( E = 1.96 \times 0.02071 = 0.0406 \)।
Step 4 — CI = \( 0.22 \pm 0.0406 = (0.179,\ 0.261) \)। মানে সব account-এর প্রায় 17.9% থেকে 26.1%-এ weak password।
What does "95% confidence" really mean?"95% confidence" আসলে কী বোঝায়?
This is the most common mistake. The true mean \( \mu \) is a fixed number. It does not move. The interval is what changes from sample to sample.
- Correct: If we repeat the sampling many times and build a 95% CI each time, about 95% of those intervals will contain the true \( \mu \). We are 95% confident in the method.
- Wrong: "There is a 95% probability that \( \mu \) is between 210.2 and 229.8." Once the interval is computed, \( \mu \) is either inside it or not.
- Also wrong: "95% of the data lies in the CI." The CI is about the mean, not about single data values.
এটাই সবচেয়ে common ভুল। আসল mean \( \mu \) একটা fixed সংখ্যা। এটা নড়ে না। Sample থেকে sample-এ বদলায় interval।
- ঠিক: বারবার sampling করে প্রতিবার 95% CI বানালে, সেই interval-গুলোর প্রায় 95%-এ আসল \( \mu \) থাকবে। আমরা method-এর উপর 95% confident।
- ভুল: "\( \mu \) 210.2 আর 229.8-এর মধ্যে থাকার probability 95%।" Interval হিসাব হয়ে গেলে \( \mu \) হয় ভেতরে আছে, নয় নেই।
- এটাও ভুল: "95% data CI-এর ভেতরে।" CI হলো mean নিয়ে, একক data value নিয়ে না।
Margin of error and sample sizeMargin of error আর sample size
If you want the margin of error to be at most \(E\), solve \( E = z\sigma/\sqrt{n} \) for \(n\). Always round UP to the next whole number.
Margin of error সর্বোচ্চ \(E\) চাইলে \( E = z\sigma/\sqrt{n} \) থেকে \(n\) বের করো। সবসময় উপরের দিকে round করো।
\( n = \left(\frac{1.96 \times 15}{3}\right)^2 = (9.8)^2 = 96.04 \) → round up → \( n = 97 \). (Not 96! 96 would give a margin slightly above 3.)
Example 2 (proportion): How many users must we survey to estimate the share who reuse passwords within ±3% at 95%? No earlier guess, so \( \hat{p} = 0.5 \) (the worst case).
\( n = \frac{1.96^2 \times 0.5 \times 0.5}{0.03^2} = \frac{0.9604}{0.0009} = 1067.1 \) → \( n = 1068 \).
\( n = \left(\frac{1.96 \times 15}{3}\right)^2 = (9.8)^2 = 96.04 \) → উপরে round → \( n = 97 \)। (96 না! 96 নিলে margin 3-এর একটু বেশি হবে।)
Example 2 (proportion): কতজন user survey করলে 95%-এ ±3%-এর মধ্যে password reuse করা user-এর ভাগ estimate করা যাবে? আগের কোনো guess নেই, তাই \( \hat{p} = 0.5 \) (worst case)।
\( n = \frac{1.96^2 \times 0.25}{0.03^2} = \frac{0.9604}{0.0009} = 1067.1 \) → \( n = 1068 \)।
- \( \sigma \) known → z-interval.
- \( \sigma \) unknown and \(n\) small (< 30) → t-interval with \( df = n-1 \). This is the most tested case.
- \( \sigma \) unknown but \(n\) large → t is best, but z gives almost the same answer.
- Proportion → z-interval with \( \sqrt{\hat{p}(1-\hat{p})/n} \).
- \( \sigma \) জানা → z-interval।
- \( \sigma \) অজানা আর \(n\) ছোট (< 30) → \( df = n-1 \) সহ t-interval। এটাই সবচেয়ে বেশি আসে।
- \( \sigma \) অজানা কিন্তু \(n\) বড় → t best, তবে z প্রায় একই answer দেয়।
- Proportion → \( \sqrt{\hat{p}(1-\hat{p})/n} \) সহ z-interval।
4. Hypothesis Testing4. Hypothesis Testing
The big ideaমূল idea
A hypothesis test is like a court case. The accused is "innocent until proven guilty". In statistics, we assume "nothing special is happening" until the data gives strong evidence against it.
- Null hypothesis \( H_0 \) — the "no change / no effect" claim. It always has an equals sign: \( \mu = 200 \).
- Alternative hypothesis \( H_1 \) (or \( H_a \)) — what we want to find evidence for: \( \mu \ne 200 \), \( \mu > 200 \), or \( \mu < 200 \).
Hypothesis test একটা court case-এর মতো। অভিযুক্ত "দোষ প্রমাণ না হওয়া পর্যন্ত নির্দোষ"। Statistics-এ আমরা ধরে নিই "বিশেষ কিছু হচ্ছে না", যতক্ষণ না data এর বিরুদ্ধে শক্ত প্রমাণ দেয়।
- Null hypothesis \( H_0 \) — "কোনো পরিবর্তন / effect নেই" দাবি। এতে সবসময় equals sign থাকে: \( \mu = 200 \)।
- Alternative hypothesis \( H_1 \) (বা \( H_a \)) — যেটার পক্ষে প্রমাণ খুঁজছি: \( \mu \ne 200 \), \( \mu > 200 \), বা \( \mu < 200 \)।
Key wordsমূল শব্দগুলো
- One-tailed test: \( H_1 \) has \( > \) or \( < \). All the rejection area is in one tail.
- Two-tailed test: \( H_1 \) has \( \ne \). The rejection area is split: \( \alpha/2 \) in each tail.
- Significance level \( \alpha \): how much risk of a false alarm we accept. Usually 0.05 (5%) or 0.01.
- Test statistic: a number from the sample that measures how far the data is from \( H_0 \), in units of standard error. Example: \( z = \frac{\bar{x} - \mu_0}{\sigma/\sqrt{n}} \).
- Critical value / critical region: the cut-off. If the test statistic falls in the critical (rejection) region, we reject \( H_0 \).
- p-value: assuming \( H_0 \) is true, the probability of getting a result at least as extreme as the one we saw.
- One-tailed test: \( H_1 \)-এ \( > \) বা \( < \)। পুরো rejection area এক tail-এ।
- Two-tailed test: \( H_1 \)-এ \( \ne \)। Rejection area ভাগ হয়: প্রতি tail-এ \( \alpha/2 \)।
- Significance level \( \alpha \): false alarm-এর কতটা risk আমরা মেনে নেব। সাধারণত 0.05 (5%) বা 0.01।
- Test statistic: sample থেকে একটা সংখ্যা, যেটা মাপে data \( H_0 \) থেকে কত দূরে (standard error-এর unit-এ)। Example: \( z = \frac{\bar{x} - \mu_0}{\sigma/\sqrt{n}} \)।
- Critical value / critical region: cut-off। Test statistic critical (rejection) region-এ পড়লে \( H_0 \) reject করি।
- p-value: \( H_0 \) সত্য ধরে নিলে, আমরা যা দেখেছি তার সমান বা তার চেয়েও extreme result পাওয়ার probability।
The 5-step procedure (use it every time)5-step procedure (প্রতিবার এটাই)
Decision rule: Reject \( H_0 \) if |test statistic| is beyond the critical value, or equivalently if p-value \( \le \alpha \). Both ways always give the same decision.
Decision rule: Test statistic critical value-এর বাইরে গেলে \( H_0 \) reject, অথবা একইভাবে p-value \( \le \alpha \) হলে reject। দুই উপায়েই সবসময় একই decision আসে।
Example 1: one-sample z-test (σ known)Example 1: one-sample z-test (σ জানা)
Step 1 — Hypotheses: \( H_0: \mu = 200 \), \( H_1: \mu > 200 \) (right-tailed, because you suspect "slower").
Step 2 — Level: \( \alpha = 0.05 \).
Step 3 — Statistic: \( SE = \frac{40}{\sqrt{64}} = 5 \). \( z = \frac{212 - 200}{5} = \frac{12}{5} = 2.4 \).
Step 4 — Critical value: right-tailed, \( z_{0.05} = 1.645 \). p-value \( = P(Z > 2.4) = 1 - 0.9918 = 0.0082 \).
Step 5 — Decision: \( 2.4 > 1.645 \) (and \( 0.0082 < 0.05 \)) → reject \( H_0 \). There is strong evidence that the API is slower than 200 ms on average.
What if the test was two-tailed (\( H_1: \mu \ne 200 \))? Critical values ±1.96; p-value = 2 × 0.0082 = 0.0164. Still reject at 5%. But at \( \alpha = 0.01 \) (critical ±2.576), 2.4 < 2.576 → fail to reject. The choice of α and tails can change the decision.
Step 1 — Hypotheses: \( H_0: \mu = 200 \), \( H_1: \mu > 200 \) (right-tailed, কারণ সন্দেহ "ধীর")।
Step 2 — Level: \( \alpha = 0.05 \)।
Step 3 — Statistic: \( SE = \frac{40}{8} = 5 \)। \( z = \frac{212 - 200}{5} = 2.4 \)।
Step 4 — Critical value: right-tailed, \( z_{0.05} = 1.645 \)। p-value \( = P(Z > 2.4) = 1 - 0.9918 = 0.0082 \)।
Step 5 — Decision: \( 2.4 > 1.645 \) (আর \( 0.0082 < 0.05 \)) → \( H_0 \) reject। API গড়ে 200 ms-এর চেয়ে ধীর — এর পক্ষে শক্ত প্রমাণ আছে।
Test two-tailed হলে (\( H_1: \mu \ne 200 \))? Critical value ±1.96; p-value = 2 × 0.0082 = 0.0164। 5%-এ এখনো reject। কিন্তু \( \alpha = 0.01 \)-এ (critical ±2.576) 2.4 < 2.576 → fail to reject। α আর tail বদলালে decision বদলাতে পারে।
Example 2: one-sample t-test (σ unknown, small n)Example 2: one-sample t-test (σ অজানা, ছোট n)
8, 9, 7, 10, 9, 8, 11, 7, 9, 8. Is the true mean different from 10? Use \( \alpha = 0.05 \).Step 1 — Hypotheses: \( H_0: \mu = 10 \), \( H_1: \mu \ne 10 \) (two-tailed).
Step 2 — Level: \( \alpha = 0.05 \).
Step 3 — Statistic:
Sum = 86, so \( \bar{x} = 8.6 \).
Deviations squared: \( 0.36, 0.16, 2.56, 1.96, 0.16, 0.36, 5.76, 2.56, 0.16, 0.36 \). Sum = 14.4.
\( s^2 = \frac{14.4}{9} = 1.6 \), \( s = 1.265 \). \( SE = \frac{1.265}{\sqrt{10}} = 0.4 \).
\( t = \frac{8.6 - 10}{0.4} = -3.5 \), with \( df = 9 \).
Step 4 — Critical value: \( t_{0.025,9} = 2.262 \). Reject if \( |t| > 2.262 \). (Exact p-value ≈ 0.0067.)
Step 5 — Decision: \( |-3.5| = 3.5 > 2.262 \) → reject \( H_0 \). The average password length is not 10; the data says it is shorter. The policy is not being followed.
8, 9, 7, 10, 9, 8, 11, 7, 9, 8। আসল mean কি 10 থেকে আলাদা? \( \alpha = 0.05 \) নাও।Step 1 — Hypotheses: \( H_0: \mu = 10 \), \( H_1: \mu \ne 10 \) (two-tailed)।
Step 2 — Level: \( \alpha = 0.05 \)।
Step 3 — Statistic:
Sum = 86, তাই \( \bar{x} = 8.6 \)।
Deviation-এর square: \( 0.36, 0.16, 2.56, 1.96, 0.16, 0.36, 5.76, 2.56, 0.16, 0.36 \)। Sum = 14.4।
\( s^2 = \frac{14.4}{9} = 1.6 \), \( s = 1.265 \)। \( SE = \frac{1.265}{\sqrt{10}} = 0.4 \)।
\( t = \frac{8.6 - 10}{0.4} = -3.5 \), \( df = 9 \)।
Step 4 — Critical value: \( t_{0.025,9} = 2.262 \)। \( |t| > 2.262 \) হলে reject। (Exact p-value ≈ 0.0067।)
Step 5 — Decision: \( 3.5 > 2.262 \) → \( H_0 \) reject। Average password length 10 না; data বলছে এটা আরও ছোট। Policy মানা হচ্ছে না।
Type I and Type II errorsType I আর Type II error
Our decision can be wrong in two ways. In security, think of \( H_0 \) as "this traffic is normal".
আমাদের decision দুইভাবে ভুল হতে পারে। Security-তে \( H_0 \)-কে ভাবো "এই traffic normal"।
| Decision ↓ / Truth →Decision ↓ / সত্য → | \( H_0 \) true (normal traffic)\( H_0 \) সত্য (normal traffic) | \( H_0 \) false (real attack)\( H_0 \) মিথ্যা (আসল attack) |
|---|---|---|
| Reject \( H_0 \) (raise alarm)\( H_0 \) reject (alarm দাও) | Type I error (α) False positive — IDS alarms on normal traffic.False positive — normal traffic-এ IDS alarm দিল। | Correct ✓ (power = 1 − β) True positive — attack caught.সঠিক ✓ (power = 1 − β) True positive — attack ধরা পড়ল। |
| Fail to reject \( H_0 \) (stay quiet)\( H_0 \) reject না (চুপ থাকো) | Correct ✓ (1 − α) True negative.সঠিক ✓ (1 − α) True negative। | Type II error (β) False negative — IDS misses a real attack.False negative — IDS আসল attack miss করল। |
- \( \alpha = P(\text{Type I}) = P(\text{reject } H_0 \mid H_0 \text{ true}) \).
- \( \beta = P(\text{Type II}) = P(\text{fail to reject } H_0 \mid H_0 \text{ false}) \).
- Power \( = 1 - \beta \) = chance of catching a real effect (a real attack).
- Trade-off: for a fixed \(n\), lowering \( \alpha \) (fewer false alarms) raises \( \beta \) (more missed attacks). The only way to lower both is to get more data (bigger \(n\)) or a better test.
- \( \alpha = P(\text{Type I}) = P(H_0 \text{ reject} \mid H_0 \text{ সত্য}) \)।
- \( \beta = P(\text{Type II}) = P(H_0 \text{ reject না} \mid H_0 \text{ মিথ্যা}) \)।
- Power \( = 1 - \beta \) = আসল effect (আসল attack) ধরার chance।
- Trade-off: \(n\) fixed থাকলে \( \alpha \) কমালে (কম false alarm) \( \beta \) বাড়ে (বেশি attack miss)। দুটো একসাথে কমানোর উপায় শুধু বেশি data (বড় \(n\)) বা ভালো test।
Step 1 — We reject when \( \bar{x} > 200 + 1.645 \times 5 = 208.225 \).
Step 2 — If \( \mu = 215 \): \( P(\bar{X} > 208.225) = P\!\left(Z > \frac{208.225 - 215}{5}\right) = P(Z > -1.355) \approx 0.912 \).
So power ≈ 91.2% and \( \beta \approx 8.8\% \). We catch the slow API 91% of the time.
Step 1 — Reject করি যখন \( \bar{x} > 200 + 1.645 \times 5 = 208.225 \)।
Step 2 — \( \mu = 215 \) হলে: \( P(\bar{X} > 208.225) = P(Z > -1.355) \approx 0.912 \)।
তাই power ≈ 91.2% আর \( \beta \approx 8.8\% \)। ধীর API-টা আমরা 91% সময় ধরতে পারব।
- The p-value is NOT the probability that \( H_0 \) is true. It is P(data this extreme | \( H_0 \) true). A p-value of 0.03 does not mean "3% chance \( H_0 \) is true".
- "Fail to reject \( H_0 \)" is NOT the same as "accept \( H_0 \)". Not guilty ≠ proven innocent. Maybe the sample was just too small to see the effect.
- Use t (not z) when \( \sigma \) is unknown and \(n\) is small. \( df = n - 1 \).
- Decide one- or two-tailed before looking at the data. Words like "more than", "slower", "increased" → one-tailed. Words like "different", "changed" → two-tailed.
- Statistically significant ≠ practically important. With huge \(n\), a 0.1 ms difference can be "significant".
- p-value মানে \( H_0 \) সত্য হওয়ার probability না। এটা হলো P(এত extreme data | \( H_0 \) সত্য)। p-value 0.03 মানে "\( H_0 \) সত্য হওয়ার chance 3%" না।
- "\( H_0 \) fail to reject" আর "\( H_0 \) accept" এক না। দোষী প্রমাণ হয়নি ≠ নির্দোষ প্রমাণ হয়েছে। হয়তো sample এত ছোট ছিল যে effect দেখা যায়নি।
- \( \sigma \) অজানা আর \(n\) ছোট হলে t ব্যবহার করো (z না)। \( df = n - 1 \)।
- One- নাকি two-tailed, সেটা data দেখার আগে ঠিক করো। "বেশি", "ধীর", "বেড়েছে" → one-tailed। "আলাদা", "বদলেছে" → two-tailed।
- Statistically significant ≠ বাস্তবে গুরুত্বপূর্ণ। অনেক বড় \(n\)-এ 0.1 ms পার্থক্যও "significant" হতে পারে।
5. Comparing Groups (t, Chi-square, ANOVA)5. Group তুলনা (t, Chi-square, ANOVA)
Section 4 compared one sample with a fixed number. Now we compare two or more groups. Pick the test by the type of data and the number of groups:
Section 4-এ একটা sample-কে একটা fixed সংখ্যার সাথে তুলনা করেছি। এখন দুই বা তার বেশি group তুলনা করব। Test বাছাই করো data-র ধরন আর group-এর সংখ্যা দেখে:
| SituationSituation | TestTest | df |
|---|---|---|
| Means of 2 independent groups (numbers)2টা independent group-এর mean (সংখ্যা) | Two-sample (pooled) t-test | \( n_1 + n_2 - 2 \) |
| Same items measured twice (before/after)একই item দুইবার মাপা (before/after) | Paired t-test | \( n - 1 \) (n = pairs) |
| Two categorical variables — related or not?দুইটা categorical variable — সম্পর্ক আছে কিনা? | Chi-square test of independence | \( (r-1)(c-1) \) |
| One categorical variable — does it fit a claimed distribution?একটা categorical variable — দাবি করা distribution-এর সাথে মেলে কিনা? | Chi-square goodness-of-fit | \( k - 1 \) |
| Means of 3 or more groups3 বা তার বেশি group-এর mean | One-way ANOVA (F-test) | \( (k-1,\ N-k) \) |
5.1 Two-sample t-test (independent groups, equal variance)5.1 Two-sample t-test (independent group, সমান variance)
We have two separate groups (different people or machines in each). We assume both populations are about normal with the same variance. First we "pool" the two sample variances into one:
দুইটা আলাদা group আছে (প্রতিটায় আলাদা মানুষ বা machine)। ধরে নিই দুই population মোটামুটি normal আর variance সমান। প্রথমে দুই sample variance-কে "pool" করে একটা বানাই:
Tool A: \( n_1 = 8,\ \bar{x}_1 = 12.5,\ s_1 = 2.0 \). Tool B: \( n_2 = 10,\ \bar{x}_2 = 10.2,\ s_2 = 2.4 \).
Is there a difference in mean detection time? \( \alpha = 0.05 \).
Step 1: \( H_0: \mu_A = \mu_B \), \( H_1: \mu_A \ne \mu_B \) (two-tailed).
Step 2: \( \alpha = 0.05 \).
Step 3: \( s_p^2 = \frac{7(4) + 9(5.76)}{16} = \frac{28 + 51.84}{16} = \frac{79.84}{16} = 4.99 \), \( s_p = 2.234 \).
\( SE = 2.234 \times \sqrt{\frac{1}{8} + \frac{1}{10}} = 2.234 \times \sqrt{0.225} = 2.234 \times 0.4743 = 1.060 \).
\( t = \frac{12.5 - 10.2}{1.060} = \frac{2.3}{1.060} = 2.17 \), \( df = 8 + 10 - 2 = 16 \).
Step 4: \( t_{0.025,16} = 2.120 \). (Exact p ≈ 0.045.)
Step 5: \( 2.17 > 2.120 \) → reject \( H_0 \). The mean detection times are different; Tool B is faster. (It is close, though — at \( \alpha = 0.01 \) we would not reject.)
Tool A: \( n_1 = 8,\ \bar{x}_1 = 12.5,\ s_1 = 2.0 \)। Tool B: \( n_2 = 10,\ \bar{x}_2 = 10.2,\ s_2 = 2.4 \)।
Mean detection time-এ কি পার্থক্য আছে? \( \alpha = 0.05 \)।
Step 1: \( H_0: \mu_A = \mu_B \), \( H_1: \mu_A \ne \mu_B \) (two-tailed)।
Step 2: \( \alpha = 0.05 \)।
Step 3: \( s_p^2 = \frac{7(4) + 9(5.76)}{16} = \frac{79.84}{16} = 4.99 \), \( s_p = 2.234 \)।
\( SE = 2.234 \times \sqrt{0.225} = 2.234 \times 0.4743 = 1.060 \)।
\( t = \frac{2.3}{1.060} = 2.17 \), \( df = 16 \)।
Step 4: \( t_{0.025,16} = 2.120 \)। (Exact p ≈ 0.045।)
Step 5: \( 2.17 > 2.120 \) → \( H_0 \) reject। Mean detection time আলাদা; Tool B দ্রুত। (তবে খুব কাছাকাছি — \( \alpha = 0.01 \)-এ reject হতো না।)
5.2 Paired t-test (before / after)5.2 Paired t-test (before / after)
When the same machines, users, or files are measured twice, the two lists are linked. Take the difference \( d = \text{before} - \text{after} \) for each pair, then do a one-sample t-test on the \( d \) values.
একই machine, user বা file দুইবার মাপা হলে দুই list জোড়া-জোড়া যুক্ত। প্রতিটা pair-এর difference \( d = \text{before} - \text{after} \) নাও, তারপর \( d \) value-গুলোর উপর one-sample t-test করো।
Before: 68, 72, 75, 70, 80, 65. After: 64, 70, 71, 69, 74, 63.
Does the patch reduce CPU load? \( \alpha = 0.05 \).
Step 1: \( d = \) before − after. \( H_0: \mu_d = 0 \), \( H_1: \mu_d > 0 \) (right-tailed: "reduce" means before is bigger).
Step 2: \( \alpha = 0.05 \).
Step 3: \( d = 4, 2, 4, 1, 6, 2 \). Sum = 19, \( \bar{d} = 3.167 \).
\( \sum (d - \bar{d})^2 = 0.694 + 1.361 + 0.694 + 4.694 + 8.028 + 1.361 = 16.833 \).
\( s_d^2 = \frac{16.833}{5} = 3.367 \), \( s_d = 1.835 \). \( SE = \frac{1.835}{\sqrt{6}} = 0.749 \).
\( t = \frac{3.167}{0.749} = 4.23 \), \( df = 5 \).
Step 4: one-tailed \( t_{0.05,5} = 2.015 \). (Exact p ≈ 0.004.)
Step 5: \( 4.23 > 2.015 \) → reject \( H_0 \). The patch lowers CPU load, by about 3.2 percentage points on average.
আগে: 68, 72, 75, 70, 80, 65। পরে: 64, 70, 71, 69, 74, 63।
Patch কি CPU load কমায়? \( \alpha = 0.05 \)।
Step 1: \( d = \) আগে − পরে। \( H_0: \mu_d = 0 \), \( H_1: \mu_d > 0 \) (right-tailed: "কমায়" মানে আগেরটা বড়)।
Step 2: \( \alpha = 0.05 \)।
Step 3: \( d = 4, 2, 4, 1, 6, 2 \)। Sum = 19, \( \bar{d} = 3.167 \)।
\( \sum (d - \bar{d})^2 = 16.833 \)।
\( s_d^2 = \frac{16.833}{5} = 3.367 \), \( s_d = 1.835 \)। \( SE = \frac{1.835}{\sqrt{6}} = 0.749 \)।
\( t = \frac{3.167}{0.749} = 4.23 \), \( df = 5 \)।
Step 4: one-tailed \( t_{0.05,5} = 2.015 \)। (Exact p ≈ 0.004।)
Step 5: \( 4.23 > 2.015 \) → \( H_0 \) reject। Patch CPU load কমায়, গড়ে প্রায় 3.2 percentage point।
5.3 Chi-square test of independence5.3 Chi-square test of independence
Use it when both variables are categories (yes/no, department, email type). We put counts in a table (a contingency table) and ask: are the two variables related?
দুইটা variable-ই category হলে (yes/no, department, email type) এটা ব্যবহার করো। Count-গুলো একটা table-এ রাখি (contingency table) আর প্রশ্ন করি: দুই variable কি সম্পর্কিত?
\(O\) = observed count, \(E\) = expected count if \( H_0 \) (independence) is true. The test is always right-tailed: a big \( \chi^2 \) means observed is far from expected.
\(O\) = observed count, \(E\) = \( H_0 \) (independence) সত্য হলে expected count। Test সবসময় right-tailed: বড় \( \chi^2 \) মানে observed expected থেকে অনেক দূরে।
| Observed (Expected)Observed (Expected) | Has linkLink আছে | No linkLink নেই | Row totalRow total |
|---|---|---|---|
| Phishing | 40 (25) | 10 (25) | 50 |
| Legitimate | 60 (75) | 90 (75) | 150 |
| Column totalColumn total | 100 | 100 | 200 |
Step 2: \( \alpha = 0.05 \).
Step 3: Expected counts: \( E_{11} = \frac{50 \times 100}{200} = 25 \), \( E_{12} = 25 \), \( E_{21} = \frac{150 \times 100}{200} = 75 \), \( E_{22} = 75 \).
\( \chi^2 = \frac{(40-25)^2}{25} + \frac{(10-25)^2}{25} + \frac{(60-75)^2}{75} + \frac{(90-75)^2}{75} = 9 + 9 + 3 + 3 = 24 \).
Step 4: \( df = (2-1)(2-1) = 1 \). Critical \( \chi^2_{0.05,1} = 3.841 \). (p ≈ 0.000001.)
Step 5: \( 24 > 3.841 \) → reject \( H_0 \). Phishing and links are related: 80% of phishing emails have a link, but only 40% of legit ones do. A "has link" feature is useful for a spam filter.
Step 2: \( \alpha = 0.05 \)।
Step 3: Expected count: \( E_{11} = \frac{50 \times 100}{200} = 25 \), \( E_{12} = 25 \), \( E_{21} = \frac{150 \times 100}{200} = 75 \), \( E_{22} = 75 \)।
\( \chi^2 = \frac{15^2}{25} + \frac{15^2}{25} + \frac{15^2}{75} + \frac{15^2}{75} = 9 + 9 + 3 + 3 = 24 \)।
Step 4: \( df = (2-1)(2-1) = 1 \)। Critical \( \chi^2_{0.05,1} = 3.841 \)। (p ≈ 0.000001।)
Step 5: \( 24 > 3.841 \) → \( H_0 \) reject। Phishing আর link সম্পর্কিত: phishing email-এর 80%-এ link আছে, কিন্তু legit email-এর মাত্র 40%-এ। Spam filter-এর জন্য "link আছে" feature কাজের।
| Chi-square critical values (α = 0.05)Chi-square critical value (α = 0.05) | df = 1 | 2 | 3 | 4 | 5 | 6 |
|---|---|---|---|---|---|---|
| \( \chi^2_{0.05} \) | 3.841 | 5.991 | 7.815 | 9.488 | 11.070 | 12.592 |
5.4 Chi-square goodness-of-fit5.4 Chi-square goodness-of-fit
One categorical variable. We test whether the counts match a claimed distribution. \( df = k - 1 \), where \(k\) = number of categories.
একটা categorical variable। Count-গুলো দাবি করা distribution-এর সাথে মেলে কিনা test করি। \( df = k - 1 \), যেখানে \(k\) = category সংখ্যা।
Step 1: \( H_0 \): each number has probability 1/6 (fair). \( H_1 \): not fair.
Step 2: \( \alpha = 0.05 \).
Step 3: Expected = 60/6 = 10 each.
\( \chi^2 = \frac{(8-10)^2 + (9-10)^2 + (12-10)^2 + (11-10)^2 + (6-10)^2 + (14-10)^2}{10} = \frac{4+1+4+1+16+16}{10} = 4.2 \).
Step 4: \( df = 6 - 1 = 5 \), critical = 11.070. (p ≈ 0.52.)
Step 5: \( 4.2 < 11.070 \) → fail to reject \( H_0 \). No evidence that the RNG is unfair. (This does not prove it is fair or secure — only 60 outputs were tested.)
Step 1: \( H_0 \): প্রতিটা সংখ্যার probability 1/6 (fair)। \( H_1 \): fair না।
Step 2: \( \alpha = 0.05 \)।
Step 3: Expected = 60/6 = প্রতিটা 10।
\( \chi^2 = \frac{4+1+4+1+16+16}{10} = 4.2 \)।
Step 4: \( df = 6 - 1 = 5 \), critical = 11.070। (p ≈ 0.52।)
Step 5: \( 4.2 < 11.070 \) → \( H_0 \) fail to reject। RNG unfair — এমন প্রমাণ নেই। (এটা fair বা secure প্রমাণ করে না — মাত্র 60টা output test হয়েছে।)
5.5 One-way ANOVA5.5 One-way ANOVA
To compare the means of 3 or more groups, we use ANOVA (Analysis of Variance). Why not do many t-tests? With 3 groups you need 3 t-tests, and each one has a 5% false-alarm risk. The total risk grows to about 14%. ANOVA does one test for all.
The idea: compare the spread between the group means with the spread within each group. If group means are far apart compared to the noise inside groups, the means are probably different.
3 বা তার বেশি group-এর mean তুলনা করতে ANOVA (Analysis of Variance) ব্যবহার করি। অনেকগুলো t-test কেন না? 3টা group-এ 3টা t-test লাগে, আর প্রতিটায় 5% false-alarm risk। মোট risk বেড়ে প্রায় 14% হয়। ANOVA সবার জন্য একটাই test করে।
Idea: group mean-গুলোর মধ্যে spread-কে প্রতিটা group-এর ভেতরের spread-এর সাথে তুলনা করো। Group-এর ভেতরের noise-এর তুলনায় group mean-গুলো অনেক দূরে হলে mean-গুলো সম্ভবত আলাদা।
Here \(k\) = number of groups, \(N\) = total observations, \( \bar{x} \) = grand mean. Also \( SST = SSB + SSW \). Reject \( H_0 \) if \( F > F_{\alpha}(k-1,\ N-k) \).
এখানে \(k\) = group সংখ্যা, \(N\) = মোট observation, \( \bar{x} \) = grand mean। আর \( SST = SSB + SSW \)। \( F > F_{\alpha}(k-1,\ N-k) \) হলে \( H_0 \) reject।
A: 5, 7, 6 B: 8, 9, 10 C: 4, 6, 5. Are the mean times equal? \( \alpha = 0.05 \).
Step 1: \( H_0: \mu_A = \mu_B = \mu_C \). \( H_1 \): at least one mean is different.
Step 2: \( \alpha = 0.05 \).
Step 3: Group means: 6, 9, 5. Grand mean = 60/9 = 6.667.
\( SSB = 3[(6 - 6.667)^2 + (9 - 6.667)^2 + (5 - 6.667)^2] = 3[0.444 + 5.444 + 2.778] = 26 \).
\( SSW \): A: \( 1 + 1 + 0 = 2 \); B: \( 1 + 0 + 1 = 2 \); C: \( 1 + 1 + 0 = 2 \). Total = 6.
\( MSB = 26/2 = 13 \), \( MSW = 6/6 = 1 \), \( F = 13/1 = 13 \).
Step 4: \( F_{0.05}(2, 6) = 5.14 \). (p ≈ 0.0066.)
Step 5: \( 13 > 5.14 \) → reject \( H_0 \). At least one library has a different mean time (B looks slowest).
A: 5, 7, 6 B: 8, 9, 10 C: 4, 6, 5। Mean time কি সমান? \( \alpha = 0.05 \)।
Step 1: \( H_0: \mu_A = \mu_B = \mu_C \)। \( H_1 \): অন্তত একটা mean আলাদা।
Step 2: \( \alpha = 0.05 \)।
Step 3: Group mean: 6, 9, 5। Grand mean = 60/9 = 6.667।
\( SSB = 3[0.444 + 5.444 + 2.778] = 26 \)।
\( SSW \): A: 2; B: 2; C: 2। মোট = 6।
\( MSB = 26/2 = 13 \), \( MSW = 6/6 = 1 \), \( F = 13 \)।
Step 4: \( F_{0.05}(2, 6) = 5.14 \)। (p ≈ 0.0066।)
Step 5: \( 13 > 5.14 \) → \( H_0 \) reject। অন্তত একটা library-র mean time আলাদা (B সবচেয়ে ধীর মনে হচ্ছে)।
| Source | SS | df | MS | F |
|---|---|---|---|---|
| Between groupsBetween groups | 26 | 2 | 13 | 13 |
| Within groups (error)Within groups (error) | 6 | 6 | 1 | |
| TotalTotal | 32 | 8 |
6. Correlation and Regression6. Correlation আর Regression
Scatter plotsScatter plot
When we have two numeric variables for each item (x, y), we draw each item as a dot. This is a scatter plot. It shows the direction (up or down), the form (straight or curved), and the strength (tight or loose) of the relationship.
প্রতিটা item-এর দুইটা numeric variable (x, y) থাকলে প্রতিটাকে একটা dot হিসেবে আঁকি। একে বলে scatter plot। এটা relationship-এর direction (উপরে না নিচে), form (সোজা না বাঁকা), আর strength (ঘন না ছড়ানো) দেখায়।
Pearson correlation coefficient rPearson correlation coefficient r
\( r \) measures the strength and direction of a straight-line relationship. \( -1 \le r \le 1 \). It has no unit.
\( r \) একটা সোজা-লাইন relationship-এর strength আর direction মাপে। \( -1 \le r \le 1 \)। এর কোনো unit নেই।
| |r| | 0 – 0.3 | 0.3 – 0.7 | 0.7 – 1 |
|---|---|---|---|
| Strength (rough guide)Strength (মোটামুটি guide) | weakweak | moderatemoderate | strongstrong |
| x | y | \( x - \bar{x} \) | \( y - \bar{y} \) | \( (x-\bar{x})^2 \) | \( (y-\bar{y})^2 \) | \( (x-\bar{x})(y-\bar{y}) \) |
|---|---|---|---|---|---|---|
| 1 | 2 | −2 | −2 | 4 | 4 | 4 |
| 2 | 4 | −1 | 0 | 1 | 0 | 0 |
| 3 | 5 | 0 | 1 | 0 | 1 | 0 |
| 4 | 4 | 1 | 0 | 1 | 0 | 0 |
| 5 | 5 | 2 | 1 | 4 | 1 | 2 |
| 15 | 20 | \( S_{xx} = 10 \) | \( S_{yy} = 6 \) | \( S_{xy} = 6 \) |
Step 2 — From the table: \( S_{xx} = 10,\ S_{yy} = 6,\ S_{xy} = 6 \).
Step 3 — \( r = \frac{6}{\sqrt{10 \times 6}} = \frac{6}{\sqrt{60}} = \frac{6}{7.746} = \mathbf{0.775} \).
Interpretation: a strong positive relationship. More training goes with higher quiz scores.
Check with the shortcut: \( \sum x^2 = 55,\ \sum xy = 66 \). \( S_{xx} = 55 - 225/5 = 10 \), \( S_{xy} = 66 - (15)(20)/5 = 6 \). Same.
Step 2 — Table থেকে: \( S_{xx} = 10,\ S_{yy} = 6,\ S_{xy} = 6 \)।
Step 3 — \( r = \frac{6}{\sqrt{60}} = \frac{6}{7.746} = \mathbf{0.775} \)।
Interpretation: strong positive relationship। বেশি training মানে সাধারণত বেশি quiz score।
Shortcut দিয়ে check: \( \sum x^2 = 55,\ \sum xy = 66 \)। \( S_{xx} = 55 - 225/5 = 10 \), \( S_{xy} = 66 - 300/5 = 6 \)। একই।
Correlation is not causationCorrelation মানেই causation না
A strong \(r\) does not prove that x causes y. There may be a hidden third variable (a confounder). Example: the number of antivirus alerts and the number of IT staff hired are correlated across companies. Buying more staff does not create viruses — bigger companies simply have both more computers and more staff.
Also: \( r \approx 0 \) only means no straight-line link. A U-shaped pattern can have \( r = 0 \) but a very strong relationship. Always look at the scatter plot. One outlier can also change \(r\) a lot.
বড় \(r\) প্রমাণ করে না যে x-এর কারণে y হয়। লুকানো তৃতীয় কোনো variable (confounder) থাকতে পারে। Example: বিভিন্ন company-তে antivirus alert-এর সংখ্যা আর IT staff নিয়োগের সংখ্যা correlated। বেশি staff নিলে virus তৈরি হয় না — বড় company-তে computer-ও বেশি, staff-ও বেশি।
আরও: \( r \approx 0 \) মানে শুধু সোজা-লাইন সম্পর্ক নেই। U-shaped pattern-এ \( r = 0 \) হতে পারে, অথচ সম্পর্ক খুব শক্ত। সবসময় scatter plot দেখো। একটা outlier-ও \(r\)-কে অনেক বদলে দিতে পারে।
Spearman rank correlation (one line)Spearman rank correlation (এক লাইনে)
Replace the values by their ranks and compute Pearson's r on the ranks. With no ties: \( r_s = 1 - \frac{6\sum d_i^2}{n(n^2 - 1)} \), where \( d_i \) = rank difference. It works for any monotonic (always up or always down) pattern and is robust to outliers.
Value-গুলোকে তাদের rank দিয়ে বদলে rank-এর উপর Pearson's r হিসাব করো। Tie না থাকলে: \( r_s = 1 - \frac{6\sum d_i^2}{n(n^2 - 1)} \), যেখানে \( d_i \) = rank-এর পার্থক্য। যেকোনো monotonic (সবসময় বাড়ে বা সবসময় কমে) pattern-এ কাজ করে আর outlier-এ কম প্রভাবিত হয়।
Simple linear regression (least squares)Simple linear regression (least squares)
Regression finds the best straight line \( \hat{y} = a + bx \) to predict y from x. "Best" means the line that makes the sum of squared errors \( \sum (y - \hat{y})^2 \) as small as possible (least squares).
Regression x থেকে y predict করার জন্য best সোজা লাইন \( \hat{y} = a + bx \) খুঁজে বের করে। "Best" মানে যে লাইনে squared error-এর sum \( \sum (y - \hat{y})^2 \) সবচেয়ে ছোট (least squares)।
Step 1 — \( b = \frac{S_{xy}}{S_{xx}} = \frac{6}{10} = 0.6 \).
Step 2 — \( a = \bar{y} - b\bar{x} = 4 - 0.6 \times 3 = 2.2 \).
Step 3 — Line: \( \hat{y} = 2.2 + 0.6x \).
Meaning of b: each extra hour of training raises the predicted score by 0.6 points. Meaning of a: predicted score with 0 hours = 2.2.
Prediction: for \( x = 3.5 \) hours, \( \hat{y} = 2.2 + 0.6 \times 3.5 = 4.3 \).
Step 1 — \( b = \frac{S_{xy}}{S_{xx}} = \frac{6}{10} = 0.6 \)।
Step 2 — \( a = \bar{y} - b\bar{x} = 4 - 0.6 \times 3 = 2.2 \)।
Step 3 — Line: \( \hat{y} = 2.2 + 0.6x \)।
b-এর মানে: প্রতি এক ঘণ্টা বেশি training-এ predicted score 0.6 বাড়ে। a-এর মানে: 0 ঘণ্টায় predicted score = 2.2।
Prediction: \( x = 3.5 \) ঘণ্টায় \( \hat{y} = 2.2 + 0.6 \times 3.5 = 4.3 \)।
Residuals and R²Residual আর R²
A residual is the prediction error for one point: \( e = y - \hat{y} \). For least squares, the residuals always add up to 0.
Residual হলো একটা point-এর prediction error: \( e = y - \hat{y} \)। Least squares-এ residual-গুলোর sum সবসময় 0।
Residuals \( e = y - \hat{y} \): −0.8, +0.6, +1.0, −0.6, −0.2. (Sum = 0 ✓.)
\( SSE = 0.64 + 0.36 + 1.00 + 0.36 + 0.04 = 2.4 \).
\( R^2 = 1 - \frac{2.4}{6} = 0.6 \). Check: \( r^2 = 0.775^2 = 0.6 \) ✓.
Meaning: 60% of the variation in quiz scores is explained by training hours. The other 40% comes from other things.
Residual \( e = y - \hat{y} \): −0.8, +0.6, +1.0, −0.6, −0.2। (Sum = 0 ✓।)
\( SSE = 0.64 + 0.36 + 1.00 + 0.36 + 0.04 = 2.4 \)।
\( R^2 = 1 - \frac{2.4}{6} = 0.6 \)। Check: \( r^2 = 0.775^2 = 0.6 \) ✓।
মানে: quiz score-এর variation-এর 60% training hours দিয়ে ব্যাখ্যা হয়। বাকি 40% অন্য কিছু থেকে আসে।
- \(b\) and \(r\) always have the same sign. Also \( b = r \cdot \frac{s_y}{s_x} \).
- The regression of y on x is not the same as x on y (unless \( |r| = 1 \)).
- Do not predict far outside the range of x in the data (extrapolation). The line may not hold there.
- A good residual plot looks like random noise. A curve or funnel in the residuals means the straight-line model is wrong.
- If r = −0.8, then R² = 0.64 (square kills the sign).
- \(b\) আর \(r\)-এর sign সবসময় এক। আর \( b = r \cdot \frac{s_y}{s_x} \)।
- y on x regression আর x on y regression এক না (যদি না \( |r| = 1 \))।
- Data-র x range-এর অনেক বাইরে predict কোরো না (extrapolation)। সেখানে লাইন খাটে নাও পারে।
- ভালো residual plot দেখতে random noise-এর মতো। Residual-এ curve বা funnel shape মানে সোজা-লাইন model ভুল।
- r = −0.8 হলে R² = 0.64 (square করলে sign চলে যায়)।
7. Statistics in Information Security7. Information Security-তে Statistics
This section ties everything to security. These ideas are very likely in an InfoSec written test, because they mix statistics with real security problems.
এই section সব কিছুকে security-র সাথে যুক্ত করে। InfoSec written test-এ এগুলো আসার সম্ভাবনা খুব বেশি, কারণ এখানে statistics আর বাস্তব security problem একসাথে।
7.1 The base-rate fallacy (Bayes and IDS)7.1 Base-rate fallacy (Bayes আর IDS)
An Intrusion Detection System (IDS) looks "99% accurate". Yet most of its alarms can be false. Why? Because attacks are rare. Ignoring how rare an event is (its base rate) is called the base-rate fallacy. We use Bayes' theorem (see Chapter 04, Section 4).
একটা Intrusion Detection System (IDS) দেখতে "99% accurate"। তবুও এর বেশিরভাগ alarm false হতে পারে। কেন? কারণ attack বিরল। কোনো event কতটা বিরল (এর base rate) সেটা ভুলে যাওয়াকে বলে base-rate fallacy। আমরা Bayes' theorem ব্যবহার করি (দেখো Chapter 04, Section 4)।
Step 1 — \( P(\text{alarm}) = 0.99 \times 0.001 + 0.01 \times 0.999 = 0.00099 + 0.00999 = 0.01098 \).
Step 2 — \( P(A \mid \text{alarm}) = \frac{0.00099}{0.01098} = \mathbf{0.090} \), about 9%.
So about 91% of alarms are false, even with a "99% accurate" IDS. Analysts get tired of false alarms and start ignoring them (alert fatigue).
Natural-frequency check: out of 1,000,000 connections: 1,000 attacks → 990 alarms; 999,000 normal → 9,990 false alarms. Real share = 990 / 10,980 = 9.0%.
Fix: lower the FPR to 0.1%: \( P(A \mid \text{alarm}) = \frac{0.00099}{0.00099 + 0.000999} = 0.498 \) ≈ 50%. For rare events, FPR matters more than detection rate.
Step 1 — \( P(\text{alarm}) = 0.99 \times 0.001 + 0.01 \times 0.999 = 0.00099 + 0.00999 = 0.01098 \)।
Step 2 — \( P(A \mid \text{alarm}) = \frac{0.00099}{0.01098} = \mathbf{0.090} \), প্রায় 9%।
মানে "99% accurate" IDS হলেও প্রায় 91% alarm false। Analyst-রা false alarm-এ ক্লান্ত হয়ে সেগুলো ignore করা শুরু করে (alert fatigue)।
Natural-frequency check: 10,00,000 connection-এর মধ্যে: 1,000 attack → 990 alarm; 999,000 normal → 9,990 false alarm। আসল ভাগ = 990 / 10,980 = 9.0%।
সমাধান: FPR কমিয়ে 0.1% করলে: \( P(A \mid \text{alarm}) = \frac{0.00099}{0.00099 + 0.000999} = 0.498 \) ≈ 50%। বিরল event-এ detection rate-এর চেয়ে FPR বেশি গুরুত্বপূর্ণ।
7.2 Anomaly detection with z-scores (3-sigma rule)7.2 z-score দিয়ে anomaly detection (3-sigma rule)
Learn what "normal" looks like (mean \( \mu \) and SD \( \sigma \) of some metric), then flag values that are too far away. For normal data:
- about 68% lies within \( \mu \pm 1\sigma \),
- about 95% within \( \mu \pm 2\sigma \),
- about 99.7% within \( \mu \pm 3\sigma \).
3-sigma rule: flag a value as an anomaly if \( |z| > 3 \). For normal data this gives a false-alarm rate of only about 0.27%.
"Normal" দেখতে কেমন শেখো (কোনো metric-এর mean \( \mu \) আর SD \( \sigma \)), তারপর অনেক দূরের value flag করো। Normal data-তে:
- প্রায় 68% থাকে \( \mu \pm 1\sigma \)-এর মধ্যে,
- প্রায় 95% থাকে \( \mu \pm 2\sigma \)-এর মধ্যে,
- প্রায় 99.7% থাকে \( \mu \pm 3\sigma \)-এর মধ্যে।
3-sigma rule: \( |z| > 3 \) হলে value-টাকে anomaly হিসেবে flag করো। Normal data-তে এতে false-alarm rate মাত্র প্রায় 0.27%।
\( z = \frac{190 - 120}{15} = \frac{70}{15} = 4.67 \). Since \( 4.67 > 3 \), flag it — maybe a credential-stuffing attack.
Anything above \( 120 + 3 \times 15 = 165 \) or below \( 120 - 45 = 75 \) would be flagged. (A very low count can also be suspicious, for example if logging was switched off.)
Cost of the rule: if we check 1,000 normal hours, we expect about \( 1000 \times 0.0027 \approx 2.7 \) false alarms.
\( z = \frac{190 - 120}{15} = \frac{70}{15} = 4.67 \)। \( 4.67 > 3 \), তাই flag করো — হয়তো credential-stuffing attack।
\( 120 + 3 \times 15 = 165 \)-এর উপরে বা \( 120 - 45 = 75 \)-এর নিচে যেকোনো কিছু flag হবে। (খুব কম count-ও সন্দেহজনক হতে পারে, যেমন logging বন্ধ করে দেওয়া হলে।)
Rule-এর খরচ: 1,000টা normal ঘণ্টা check করলে প্রায় \( 1000 \times 0.0027 \approx 2.7 \)টা false alarm আশা করা যায়।
7.3 Confusion matrix metrics for an IDS7.3 IDS-এর confusion matrix metrics
Compare what the IDS said with the truth. "Positive" = attack.
IDS যা বলেছে তা সত্যের সাথে তুলনা করো। "Positive" = attack।
| Actually attackআসলে attack | Actually normalআসলে normal | |
|---|---|---|
| IDS says attackIDS বলে attack | TP = 90 | FP = 40 (Type I)(Type I) |
| IDS says normalIDS বলে normal | FN = 10 (Type II)(Type II) | TN = 860 |
Precision = 90 / 130 = 0.692 — when the IDS alarms, it is right 69% of the time.
Recall = 90 / 100 = 0.90 — it catches 90% of attacks.
FPR = 40 / 900 = 0.044 — it alarms on 4.4% of normal connections.
Accuracy = (90 + 860) / 1000 = 0.95. F1 = \( \frac{2 \times 0.692 \times 0.9}{0.692 + 0.9} = 0.783 \).
Warning: accuracy can fool you. An IDS that says "normal" for everything would get 90% accuracy here but catch zero attacks. For rare attacks, report precision, recall and FPR.
Precision = 90 / 130 = 0.692 — IDS alarm দিলে 69% সময় ঠিক।
Recall = 90 / 100 = 0.90 — 90% attack ধরে।
FPR = 40 / 900 = 0.044 — normal connection-এর 4.4%-এ alarm দেয়।
Accuracy = (90 + 860) / 1000 = 0.95। F1 = \( \frac{2 \times 0.692 \times 0.9}{0.692 + 0.9} = 0.783 \)।
সতর্কতা: accuracy ধোঁকা দিতে পারে। যে IDS সবকিছুকে "normal" বলে, সে এখানে 90% accuracy পাবে কিন্তু একটাও attack ধরবে না। বিরল attack-এর ক্ষেত্রে precision, recall আর FPR দেখাও।
7.4 Entropy of passwords and keys7.4 Password আর key-এর entropy
Entropy (in bits) measures how hard something is to guess. If a password is chosen uniformly at random from a charset of size \(N\) with length \(L\), the number of possible passwords is \( N^L \), and:
Entropy (bits-এ) মাপে কোনো কিছু guess করা কতটা কঠিন। Size \(N\)-এর charset থেকে length \(L\)-এর password uniformly randomভাবে বাছলে সম্ভাব্য password \( N^L \)টা, আর:
| Password typePassword type | N | L | Entropy (bits)Entropy (bits) |
|---|---|---|---|
| 4-digit PIN4-digit PIN | 10 | 4 | \( 4 \times 3.322 = 13.3 \) |
| 8 lowercase letters8টা lowercase letter | 26 | 8 | \( 8 \times 4.700 = 37.6 \) |
| 8 printable ASCII8টা printable ASCII | 94 | 8 | \( 8 \times 6.555 = 52.4 \) |
| 12 letters + digits12টা letter + digit | 62 | 12 | \( 12 \times 5.954 = 71.5 \) |
| AES-128 random keyAES-128 random key | 2 | 128 | 128 |
Step 1 — Entropy: \( 8 \log_2 94 = 8 \times 6.555 = 52.4 \) bits.
Step 2 — Total passwords: \( 94^8 \approx 6.10 \times 10^{15} \) (≈ \( 2^{52.4} \)).
Step 3 — On average the attacker finds it after trying half: \( \frac{6.10 \times 10^{15}}{2 \times 10^{10}} = 3.05 \times 10^5 \) s ≈ 3.5 days.
Each extra bit doubles the work. Adding 4 more random characters (12 total, \( \approx 78.7 \) bits) makes it about \( 94^4 \approx 78 \) million times harder.
Step 1 — Entropy: \( 8 \log_2 94 = 8 \times 6.555 = 52.4 \) bits।
Step 2 — মোট password: \( 94^8 \approx 6.10 \times 10^{15} \) (≈ \( 2^{52.4} \))।
Step 3 — গড়ে অর্ধেক try করার পর পাওয়া যায়: \( \frac{6.10 \times 10^{15}}{2 \times 10^{10}} = 3.05 \times 10^5 \) s ≈ 3.5 দিন।
প্রতি extra bit-এ কাজ দ্বিগুণ। আরও 4টা random character যোগ করলে (মোট 12, \( \approx 78.7 \) bits) প্রায় \( 94^4 \approx 7.8 \) কোটি গুণ কঠিন হয়।
\( H = -(0.9 \log_2 0.9 + 0.1 \log_2 0.1) = -(0.9 \times (-0.152) + 0.1 \times (-3.322)) = 0.137 + 0.332 = 0.469 \) bits.
A fair bit has 1 bit of entropy. This biased source gives less than half a bit per output, so it is a bad source for keys.
\( H = -(0.9 \log_2 0.9 + 0.1 \log_2 0.1) = 0.137 + 0.332 = 0.469 \) bits।
Fair bit-এর entropy 1 bit। এই biased source প্রতি output-এ অর্ধেক bit-এরও কম দেয়, তাই এটা key-এর জন্য খারাপ source।
Practice Questions (Admission Style)Practice Questions (Admission Style)
20 questions, easy to hard: 7 MCQs and 13 written/calculation problems like the IICT InfoSec written test. Solve each on paper with the 5-step method before opening the answer. Use the tables in Sections 1, 3 and 5. 20টা প্রশ্ন, সহজ থেকে কঠিন: 7টা MCQ আর 13টা written/calculation problem, IICT InfoSec written test-এর মতো। Answer খোলার আগে 5-step method দিয়ে কাগজে solve করো। Section 1, 3 আর 5-এর table ব্যবহার করো।
Show Answerউত্তর দেখুন
Show Answerউত্তর দেখুন
Show Answerউত্তর দেখুন
Show Answerউত্তর দেখুন
Show Answerউত্তর দেখুন
Show Answerউত্তর দেখুন
Show Answerউত্তর দেখুন
Show Answerউত্তর দেখুন
Step 1 — The data is sorted, \( n = 11 \) (odd). Median = 6th value = 24.
Step 2 — Lower half (leave out the median): 15, 18, 20, 21, 22 → Q1 = 20.
Step 3 — Upper half: 25, 27, 29, 31, 60 → Q3 = 29.
Step 4 — IQR = 29 − 20 = 9.
Step 5 — Fences: lower = 20 − 13.5 = 6.5; upper = 29 + 13.5 = 42.5.
Step 6 — 60 > 42.5, so 60 is an outlier. Nothing is below 6.5.
Box plot: box from 20 to 29 with a line at 24; left whisker to 15; right whisker to 31 (largest non-outlier); a separate dot at 60. The data is right-skewed.
Step 1 — Data sorted, \( n = 11 \) (odd)। Median = 6th value = 24।
Step 2 — নিচের অর্ধেক (median বাদ দিয়ে): 15, 18, 20, 21, 22 → Q1 = 20।
Step 3 — উপরের অর্ধেক: 25, 27, 29, 31, 60 → Q3 = 29।
Step 4 — IQR = 29 − 20 = 9।
Step 5 — Fence: lower = 20 − 13.5 = 6.5; upper = 29 + 13.5 = 42.5।
Step 6 — 60 > 42.5, তাই 60 একটা outlier। 6.5-এর নিচে কিছু নেই।
Box plot: box 20 থেকে 29, ভেতরে 24-এ line; বাম whisker 15 পর্যন্ত; ডান whisker 31 পর্যন্ত (সবচেয়ে বড় non-outlier); 60-এ আলাদা dot। Data right-skewed।
Show Answerউত্তর দেখুন
Step 1 — \( z_A = \frac{72 - 65}{5} = \frac{7}{5} = 1.4 \).
Step 2 — \( z_B = \frac{80 - 74}{4} = \frac{6}{4} = 1.5 \).
Step 3 — \( 1.5 > 1.4 \), so B did relatively better, being further above the class mean in SD units.
Step 4 — \( P(Z < 1.5) = \Phi(1.5) = 0.9332 \) → about 93.3% of Networking students scored below B.
Step 1 — \( z_A = \frac{72 - 65}{5} = 1.4 \)।
Step 2 — \( z_B = \frac{80 - 74}{4} = 1.5 \)।
Step 3 — \( 1.5 > 1.4 \), তাই B তুলনামূলক ভালো করেছে — SD unit-এ class mean থেকে বেশি উপরে।
Step 4 — \( P(Z < 1.5) = \Phi(1.5) = 0.9332 \) → Networking-এর প্রায় 93.3% student B-এর চেয়ে কম পেয়েছে।
Show Answerউত্তর দেখুন
(a) \( H = 10 \log_2 36 = 10 \times 5.170 = \mathbf{51.7} \) bits.
(b) Number of passwords \( = 36^{10} \approx 3.656 \times 10^{15} \). Time \( = \frac{3.656 \times 10^{15}}{10^9} = 3.656 \times 10^6 \) s. Divide by 86,400 s/day → ≈ 42.3 days (average ≈ 21.2 days).
(c) \( 8 \log_2 94 = 52.4 \) bits; \( 94^8 \approx 6.10 \times 10^{15} \) → \( 6.10 \times 10^6 \) s ≈ 70.6 days. So 8 characters from a big charset beat 10 characters from a small one here — but only by 0.7 bits. Length and charset size both matter.
(a) \( H = 10 \log_2 36 = 10 \times 5.170 = \mathbf{51.7} \) bits।
(b) Password সংখ্যা \( = 36^{10} \approx 3.656 \times 10^{15} \)। সময় \( = 3.656 \times 10^6 \) s। 86,400 s/দিন দিয়ে ভাগ → ≈ 42.3 দিন (গড়ে ≈ 21.2 দিন)।
(c) \( 8 \log_2 94 = 52.4 \) bits; \( 94^8 \approx 6.10 \times 10^{15} \) → \( 6.10 \times 10^6 \) s ≈ 70.6 দিন। তাই এখানে বড় charset-এর 8 character ছোট charset-এর 10 character-কে হারায় — তবে মাত্র 0.7 bit-এ। Length আর charset size দুটোই গুরুত্বপূর্ণ।
Show Answerউত্তর দেখুন
(a) Step 1 — \( n = 100 \ge 30 \), so by CLT \( \bar{X} \) is about normal.
Step 2 — \( SE = \frac{0.5}{\sqrt{100}} = 0.05 \).
Step 3 — \( z_1 = \frac{1.9 - 2.0}{0.05} = -2 \), \( z_2 = \frac{2.1 - 2.0}{0.05} = 2 \).
Step 4 — \( P = \Phi(2) - \Phi(-2) = 0.9772 - 0.0228 = \mathbf{0.9545} \).
(b) No. CLT is about the mean of many files. One file follows the population distribution, which is unknown and skewed. We cannot use the normal table for a single file.
(a) Step 1 — \( n = 100 \ge 30 \), তাই CLT অনুযায়ী \( \bar{X} \) প্রায় normal।
Step 2 — \( SE = \frac{0.5}{10} = 0.05 \)।
Step 3 — \( z_1 = -2 \), \( z_2 = 2 \)।
Step 4 — \( P = \Phi(2) - \Phi(-2) = 0.9772 - 0.0228 = \mathbf{0.9545} \)।
(b) না। CLT অনেক file-এর mean নিয়ে। একটা file population distribution follow করে, যেটা অজানা আর skewed। একটা file-এর জন্য normal table ব্যবহার করা যায় না।
Show Answerউত্তর দেখুন
(a) Step 1 — \( \sigma \) unknown, \( n = 9 \) small → t with \( df = 8 \).
Step 2 — \( t_{0.025,8} = 2.306 \). \( SE = \frac{6}{\sqrt{9}} = 2 \).
Step 3 — \( E = 2.306 \times 2 = 4.612 \).
Step 4 — CI = \( 48 \pm 4.612 = \mathbf{(43.39,\ 52.61)} \).
(b) 55 is outside the interval. So a two-tailed t-test of \( H_0: \mu = 55 \) at \( \alpha = 0.05 \) would reject it. The data does not support the claim — the team seems faster than 55 minutes. (A 95% CI and a two-tailed 5% test always agree like this.)
(a) Step 1 — \( \sigma \) অজানা, \( n = 9 \) ছোট → \( df = 8 \) সহ t।
Step 2 — \( t_{0.025,8} = 2.306 \)। \( SE = \frac{6}{3} = 2 \)।
Step 3 — \( E = 2.306 \times 2 = 4.612 \)।
Step 4 — CI = \( 48 \pm 4.612 = \mathbf{(43.39,\ 52.61)} \)।
(b) 55 interval-এর বাইরে। তাই \( \alpha = 0.05 \)-এ \( H_0: \mu = 55 \)-এর two-tailed t-test এটাকে reject করত। Data দাবিটা support করে না — team 55 মিনিটের চেয়ে দ্রুত মনে হচ্ছে। (95% CI আর two-tailed 5% test সবসময় এভাবে মিলে যায়।)
Show Answerউত্তর দেখুন
(a) Step 1 — \( \hat{p} = 60/500 = 0.12 \). Check: \( 500 \times 0.12 = 60 \ge 10 \) and \( 500 \times 0.88 = 440 \ge 10 \).
Step 2 — \( SE = \sqrt{\frac{0.12 \times 0.88}{500}} = \sqrt{0.0002112} = 0.01453 \).
Step 3 — 90% → \( z = 1.645 \). \( E = 1.645 \times 0.01453 = 0.0239 \).
Step 4 — CI = \( 0.12 \pm 0.0239 = \mathbf{(0.096,\ 0.144)} \), i.e. 9.6% to 14.4% spam.
(b) \( n = \frac{1.645^2 \times 0.12 \times 0.88}{0.02^2} = \frac{2.706 \times 0.1056}{0.0004} = 714.39 \) → round up → 715.
(a) Step 1 — \( \hat{p} = 60/500 = 0.12 \)। Check: \( 500 \times 0.12 = 60 \ge 10 \), \( 500 \times 0.88 = 440 \ge 10 \)।
Step 2 — \( SE = \sqrt{\frac{0.12 \times 0.88}{500}} = 0.01453 \)।
Step 3 — 90% → \( z = 1.645 \)। \( E = 1.645 \times 0.01453 = 0.0239 \)।
Step 4 — CI = \( 0.12 \pm 0.0239 = \mathbf{(0.096,\ 0.144)} \), মানে 9.6% থেকে 14.4% spam।
(b) \( n = \frac{1.645^2 \times 0.12 \times 0.88}{0.02^2} = \frac{2.706 \times 0.1056}{0.0004} = 714.39 \) → উপরে round → 715।
Show Answerউত্তর দেখুন
Step 1: \( H_0: \mu = 50 \), \( H_1: \mu \ne 50 \) ("differs" → two-tailed).
Step 2: \( \alpha = 0.05 \).
Step 3: \( SE = \frac{6}{\sqrt{36}} = 1 \). \( z = \frac{52.1 - 50}{1} = 2.1 \).
Step 4: Critical ±1.96. p-value \( = 2 \times P(Z > 2.1) = 2 \times (1 - 0.9821) = 0.0357 \).
Step 5: \( 2.1 > 1.96 \) and \( 0.036 < 0.05 \) → reject \( H_0 \). The mean encryption time is not 50 ms (it seems slower).
At \( \alpha = 0.01 \): critical ±2.576, and \( 2.1 < 2.576 \) (also \( 0.036 > 0.01 \)) → fail to reject. The evidence is not strong enough at the stricter level.
Step 1: \( H_0: \mu = 50 \), \( H_1: \mu \ne 50 \) ("আলাদা" → two-tailed)।
Step 2: \( \alpha = 0.05 \)।
Step 3: \( SE = \frac{6}{6} = 1 \)। \( z = \frac{52.1 - 50}{1} = 2.1 \)।
Step 4: Critical ±1.96। p-value \( = 2 \times (1 - 0.9821) = 0.0357 \)।
Step 5: \( 2.1 > 1.96 \) আর \( 0.036 < 0.05 \) → \( H_0 \) reject। Mean encryption time 50 ms না (আরও ধীর মনে হচ্ছে)।
\( \alpha = 0.01 \)-এ: critical ±2.576, আর \( 2.1 < 2.576 \) → fail to reject। কড়া level-এ প্রমাণ যথেষ্ট শক্ত না।
Show Answerউত্তর দেখুন
Step 1: \( H_0: \mu = 12 \), \( H_1: \mu > 12 \) ("increased" → right-tailed).
Step 2: \( \alpha = 0.05 \).
Step 3: Sum = 106, \( \bar{x} = 13.25 \).
Squared deviations: 1.5625, 3.0625, 5.0625, 0.5625, 0.0625, 7.5625, 10.5625, 3.0625. Sum = 31.5.
\( s^2 = 31.5 / 7 = 4.5 \), \( s = 2.121 \). \( SE = 2.121 / \sqrt{8} = 0.75 \).
\( t = \frac{13.25 - 12}{0.75} = 1.667 \), \( df = 7 \).
Step 4: One-tailed \( t_{0.05,7} = 1.895 \). (Exact p ≈ 0.070.)
Step 5: \( 1.667 < 1.895 \) → fail to reject \( H_0 \). There is not enough evidence at the 5% level that reports increased.
Careful: this does NOT prove the campaign had no effect. The sample mean did go up; with only 8 days, the test has low power. Collect more days.
Step 1: \( H_0: \mu = 12 \), \( H_1: \mu > 12 \) ("বেড়েছে" → right-tailed)।
Step 2: \( \alpha = 0.05 \)।
Step 3: Sum = 106, \( \bar{x} = 13.25 \)।
Deviation-এর square-এর sum = 31.5।
\( s^2 = 31.5 / 7 = 4.5 \), \( s = 2.121 \)। \( SE = 2.121 / \sqrt{8} = 0.75 \)।
\( t = \frac{1.25}{0.75} = 1.667 \), \( df = 7 \)।
Step 4: One-tailed \( t_{0.05,7} = 1.895 \)। (Exact p ≈ 0.070।)
Step 5: \( 1.667 < 1.895 \) → \( H_0 \) fail to reject। 5% level-এ report বেড়েছে বলার মতো যথেষ্ট প্রমাণ নেই।
সাবধান: এটা প্রমাণ করে না যে campaign-এর কোনো effect নেই। Sample mean বেড়েছে ঠিকই; মাত্র 8 দিনে test-এর power কম। আরও দিনের data নাও।
Old: 30, 28, 35, 32, 27. New: 26, 27, 30, 29, 25.
At \( \alpha = 0.05 \), is there a difference in mean scan time? Why is a paired test correct here?
পুরনো: 30, 28, 35, 32, 27। নতুন: 26, 27, 30, 29, 25।
\( \alpha = 0.05 \)-এ mean scan time-এ কি পার্থক্য আছে? এখানে paired test কেন ঠিক?
Show Answerউত্তর দেখুন
Paired, because the same machines were used for both versions. Each machine's own speed cancels out in the difference.
Step 1: \( d = \) old − new. \( H_0: \mu_d = 0 \), \( H_1: \mu_d \ne 0 \).
Step 2: \( \alpha = 0.05 \).
Step 3: \( d = 4, 1, 5, 3, 2 \). \( \bar{d} = 15/5 = 3 \).
\( \sum (d - \bar{d})^2 = 1 + 4 + 4 + 0 + 1 = 10 \). \( s_d^2 = 10/4 = 2.5 \), \( s_d = 1.581 \).
\( SE = 1.581 / \sqrt{5} = 0.707 \). \( t = 3 / 0.707 = 4.24 \), \( df = 4 \).
Step 4: \( t_{0.025,4} = 2.776 \). (Exact p ≈ 0.013.)
Step 5: \( 4.24 > 2.776 \) → reject \( H_0 \). The mean scan times differ; the new version saves about 3 minutes per scan.
Paired, কারণ দুই version-এর জন্য একই machine ব্যবহার হয়েছে। প্রতিটা machine-এর নিজস্ব speed difference-এ কেটে যায়।
Step 1: \( d = \) পুরনো − নতুন। \( H_0: \mu_d = 0 \), \( H_1: \mu_d \ne 0 \)।
Step 2: \( \alpha = 0.05 \)।
Step 3: \( d = 4, 1, 5, 3, 2 \)। \( \bar{d} = 3 \)।
\( \sum (d - \bar{d})^2 = 10 \)। \( s_d^2 = 2.5 \), \( s_d = 1.581 \)।
\( SE = 0.707 \)। \( t = 3 / 0.707 = 4.24 \), \( df = 4 \)।
Step 4: \( t_{0.025,4} = 2.776 \)। (Exact p ≈ 0.013।)
Step 5: \( 4.24 > 2.776 \) → \( H_0 \) reject। Mean scan time আলাদা; নতুন version প্রতি scan-এ প্রায় 3 মিনিট বাঁচায়।
| Clicked linkLink-এ click করেছে | Did not clickClick করেনি | TotalTotal | |
|---|---|---|---|
| IT | 10 | 90 | 100 |
| HR | 30 | 70 | 100 |
| TotalTotal | 40 | 160 | 200 |
Show Answerউত্তর দেখুন
Step 1: \( H_0 \): clicking and department are independent. \( H_1 \): they are related.
Step 2: \( \alpha = 0.05 \).
Step 3: Expected: IT-click = \( \frac{100 \times 40}{200} = 20 \), IT-no = 80, HR-click = 20, HR-no = 80.
\( \chi^2 = \frac{(10-20)^2}{20} + \frac{(90-80)^2}{80} + \frac{(30-20)^2}{20} + \frac{(70-80)^2}{80} = 5 + 1.25 + 5 + 1.25 = 12.5 \).
Step 4: \( df = (2-1)(2-1) = 1 \); critical = 3.841. (p ≈ 0.0004.)
Step 5: \( 12.5 > 3.841 \) → reject \( H_0 \). Clicking depends on department: HR clicked 30% of the time vs IT 10%. HR needs more awareness training.
Step 1: \( H_0 \): click আর department independent। \( H_1 \): এরা সম্পর্কিত।
Step 2: \( \alpha = 0.05 \)।
Step 3: Expected: IT-click = \( \frac{100 \times 40}{200} = 20 \), IT-no = 80, HR-click = 20, HR-no = 80।
\( \chi^2 = 5 + 1.25 + 5 + 1.25 = 12.5 \)।
Step 4: \( df = 1 \); critical = 3.841। (p ≈ 0.0004।)
Step 5: \( 12.5 > 3.841 \) → \( H_0 \) reject। Click করা department-এর উপর নির্ভর করে: HR 30% বার click করেছে, IT 10%। HR-এর আরও awareness training দরকার।
x: 2, 4, 6, 8, 10 y: 3, 7, 5, 11, 14.
(a) Find Pearson's r. (b) Find the least-squares line \( \hat{y} = a + bx \). (c) Predict the risk score for 7 open ports. (d) Find \( R^2 \) and interpret it.
x: 2, 4, 6, 8, 10 y: 3, 7, 5, 11, 14।
(a) Pearson's r বের করো। (b) Least-squares line \( \hat{y} = a + bx \) বের করো। (c) 7টা open port-এ risk score predict করো। (d) \( R^2 \) বের করে ব্যাখ্যা করো।
Show Answerউত্তর দেখুন
Step 1 — \( \bar{x} = 30/5 = 6 \), \( \bar{y} = 40/5 = 8 \).
Step 2 — \( x - \bar{x} \): −4, −2, 0, 2, 4. \( y - \bar{y} \): −5, −1, −3, 3, 6.
\( S_{xx} = 16 + 4 + 0 + 4 + 16 = 40 \).
\( S_{yy} = 25 + 1 + 9 + 9 + 36 = 80 \).
\( S_{xy} = 20 + 2 + 0 + 6 + 24 = 52 \).
(a) \( r = \frac{52}{\sqrt{40 \times 80}} = \frac{52}{56.57} = \mathbf{0.919} \) — strong positive.
(b) \( b = 52/40 = 1.3 \), \( a = 8 - 1.3 \times 6 = 0.2 \) → \( \hat{y} = 0.2 + 1.3x \).
(c) \( \hat{y}(7) = 0.2 + 9.1 = \mathbf{9.3} \) (x = 7 is inside the data range, so this is interpolation — safe).
(d) \( R^2 = r^2 = 0.845 \). Check with residuals: \( e = 0.2, 1.6, -3.0, 0.4, 0.8 \); SSE = 0.04 + 2.56 + 9 + 0.16 + 0.64 = 12.4; \( R^2 = 1 - 12.4/80 = 0.845 \) ✓. About 84.5% of the variation in risk score is explained by the number of open ports.
Step 1 — \( \bar{x} = 6 \), \( \bar{y} = 8 \)।
Step 2 — \( x - \bar{x} \): −4, −2, 0, 2, 4। \( y - \bar{y} \): −5, −1, −3, 3, 6।
\( S_{xx} = 40 \), \( S_{yy} = 80 \), \( S_{xy} = 20 + 2 + 0 + 6 + 24 = 52 \)।
(a) \( r = \frac{52}{\sqrt{3200}} = \frac{52}{56.57} = \mathbf{0.919} \) — strong positive।
(b) \( b = 52/40 = 1.3 \), \( a = 8 - 1.3 \times 6 = 0.2 \) → \( \hat{y} = 0.2 + 1.3x \)।
(c) \( \hat{y}(7) = 0.2 + 9.1 = \mathbf{9.3} \) (x = 7 data range-এর ভেতরে, তাই এটা interpolation — নিরাপদ)।
(d) \( R^2 = r^2 = 0.845 \)। Residual দিয়ে check: \( e = 0.2, 1.6, -3.0, 0.4, 0.8 \); SSE = 12.4; \( R^2 = 1 - 12.4/80 = 0.845 \) ✓। Risk score-এর variation-এর প্রায় 84.5% open port-এর সংখ্যা দিয়ে ব্যাখ্যা হয়।
Show Answerউত্তর দেখুন
Let \( M \) = malicious. \( P(M) = 0.02 \), \( P(\text{alarm} \mid M) = 0.95 \), \( P(\text{alarm} \mid \neg M) = 0.05 \).
(a) \( P(\text{alarm}) = 0.95 \times 0.02 + 0.05 \times 0.98 = 0.019 + 0.049 = 0.068 \).
\( P(M \mid \text{alarm}) = \frac{0.019}{0.068} = \mathbf{0.279} \). Only about 28% of alarms are real — base-rate fallacy again.
(b) \( P(\text{quiet} \mid M) = 0.05 \), \( P(\text{quiet} \mid \neg M) = 0.95 \).
\( P(M \mid \text{quiet}) = \frac{0.05 \times 0.02}{0.05 \times 0.02 + 0.95 \times 0.98} = \frac{0.001}{0.001 + 0.931} = \mathbf{0.00107} \). A quiet IDS is very reassuring.
(c) Need \( \frac{0.019}{0.019 + 0.98 f} \ge 0.5 \) → \( 0.019 \ge 0.5(0.019 + 0.98f) \) → \( 0.0095 \ge 0.49 f \) → \( f \le 0.0194 \). So the FPR must drop from 5% to about 1.94% or less.
ধরো \( M \) = malicious। \( P(M) = 0.02 \), \( P(\text{alarm} \mid M) = 0.95 \), \( P(\text{alarm} \mid \neg M) = 0.05 \)।
(a) \( P(\text{alarm}) = 0.019 + 0.049 = 0.068 \)।
\( P(M \mid \text{alarm}) = \frac{0.019}{0.068} = \mathbf{0.279} \)। মাত্র প্রায় 28% alarm আসল — আবার base-rate fallacy।
(b) \( P(M \mid \text{quiet}) = \frac{0.05 \times 0.02}{0.001 + 0.95 \times 0.98} = \frac{0.001}{0.932} = \mathbf{0.00107} \)। IDS চুপ থাকলে বেশ নিশ্চিন্ত থাকা যায়।
(c) দরকার \( \frac{0.019}{0.019 + 0.98 f} \ge 0.5 \) → \( 0.0095 \ge 0.49 f \) → \( f \le 0.0194 \)। তাই FPR 5% থেকে কমিয়ে প্রায় 1.94% বা তার নিচে আনতে হবে।
Config A: 10, 12, 11, 13 Config B: 14, 15, 13, 16 Config C: 11, 10, 12, 11.
Use one-way ANOVA at \( \alpha = 0.05 \) (\( F_{0.05}(2, 9) = 4.26 \)) to test whether the mean latencies are equal. Show the ANOVA table.
Config A: 10, 12, 11, 13 Config B: 14, 15, 13, 16 Config C: 11, 10, 12, 11।
\( \alpha = 0.05 \)-এ (\( F_{0.05}(2, 9) = 4.26 \)) one-way ANOVA দিয়ে test করো mean latency সমান কিনা। ANOVA table দেখাও।
Show Answerউত্তর দেখুন
Step 1: \( H_0: \mu_A = \mu_B = \mu_C \); \( H_1 \): at least one mean differs.
Step 2: \( \alpha = 0.05 \).
Step 3: Group means: A = 46/4 = 11.5, B = 58/4 = 14.5, C = 44/4 = 11. Grand mean = 148/12 = 12.333.
\( SSB = 4[(11.5 - 12.333)^2 + (14.5 - 12.333)^2 + (11 - 12.333)^2] = 4[0.694 + 4.694 + 1.778] = 4 \times 7.167 = 28.667 \).
\( SSW \): A: 2.25 + 0.25 + 0.25 + 2.25 = 5; B: 0.25 + 0.25 + 2.25 + 2.25 = 5; C: 0 + 1 + 1 + 0 = 2. Total = 12.
\( MSB = 28.667 / 2 = 14.333 \); \( MSW = 12 / 9 = 1.333 \); \( F = 14.333 / 1.333 = 10.75 \).
Step 1: \( H_0: \mu_A = \mu_B = \mu_C \); \( H_1 \): অন্তত একটা mean আলাদা।
Step 2: \( \alpha = 0.05 \)।
Step 3: Group mean: A = 11.5, B = 14.5, C = 11। Grand mean = 148/12 = 12.333।
\( SSB = 4[0.694 + 4.694 + 1.778] = 28.667 \)।
\( SSW \): A: 5; B: 5; C: 2। মোট = 12।
\( MSB = 14.333 \); \( MSW = 12 / 9 = 1.333 \); \( F = 10.75 \)।
| Source | SS | df | MS | F |
|---|---|---|---|---|
| Between | 28.667 | 2 | 14.333 | 10.75 |
| Within | 12 | 9 | 1.333 | |
| Total | 40.667 | 11 |
Step 5: \( 10.75 > 4.26 \) → reject \( H_0 \). The configurations do not all have the same mean latency; Config B looks slowest. A post-hoc test would confirm which pairs differ.
Step 5: \( 10.75 > 4.26 \) → \( H_0 \) reject। সব configuration-এর mean latency এক না; Config B সবচেয়ে ধীর মনে হচ্ছে। কোন pair আলাদা, সেটা post-hoc test নিশ্চিত করবে।