How to draw reliable conclusions about millions from just hundreds of observations
Statistical Inference: Conclusions from Samples
The Election Polling Problem
It’s election night. With only 2% of votes counted, news networks are already predicting the winner with 95% confidence.How is that possible? They’ve only seen a tiny fraction of the votes!This is the power of statistical inference - the science of drawing conclusions about a large group (population) by studying a small part of it (sample).
The fundamental challenge: We want to know the parameter, but we can only calculate the statistic.Analogy: Imagine you are trying to figure out the average temperature of an entire ocean. You cannot measure every single water molecule — that is the population parameter. Instead, you dip thermometers at various points — those are your samples. The art of inference is taking those thermometer readings and making reliable statements about the whole ocean, along with an honest assessment of how wrong you might be.
ML Application — Training vs. Test Performance: Statistical inference is exactly the problem ML faces. Your training set is a sample, and you want to know how the model performs on the population (all future data it will ever see). This is why cross-validation exists — it simulates drawing multiple samples to estimate how much your performance metric varies. When you report “accuracy = 92% plus or minus 2%”, you are doing inference: using sample statistics to estimate a population parameter.
import numpy as np# Imagine this is the TRUE population (we normally don't know this!)np.random.seed(42)population = np.random.choice(['A', 'B'], size=10_000_000, p=[0.52, 0.48])true_proportion = np.mean(population == 'A')print(f"TRUE population proportion for A: {true_proportion:.4f}") # ~0.52# But we can only survey 1000 peoplesample = np.random.choice(population, size=1000, replace=False)sample_proportion = np.mean(sample == 'A')print(f"Sample proportion for A: {sample_proportion:.4f}") # Varies!
Sampling Distributions: The Key Insight
Here’s the crucial question: If we took many different samples, how would our estimates vary?
# Take 1000 different samples of 500 people eachsample_proportions = []for _ in range(1000): sample = np.random.choice(population, size=500, replace=False) prop = np.mean(sample == 'A') sample_proportions.append(prop)sample_proportions = np.array(sample_proportions)print(f"Mean of sample proportions: {np.mean(sample_proportions):.4f}")print(f"Std of sample proportions: {np.std(sample_proportions):.4f}")print(f"True proportion: {true_proportion:.4f}")
Output:
Mean of sample proportions: 0.5198Std of sample proportions: 0.0223True proportion: 0.5200
The samples cluster around the true value, and they form a normal distribution.
Standard Error: Quantifying Uncertainty
The standard error measures how much sample statistics vary from sample to sample.For a proportion:SE=np(1−p)For a mean:SE=nσ
def standard_error_proportion(p, n): """Standard error for a sample proportion.""" return np.sqrt(p * (1 - p) / n)def standard_error_mean(std_dev, n): """Standard error for a sample mean.""" return std_dev / np.sqrt(n)# Example: Poll with 52% for candidate A, n=1000se = standard_error_proportion(0.52, 1000)print(f"Standard error: {se:.4f}") # 0.0158 or about 1.58%# With larger samplese_large = standard_error_proportion(0.52, 4000)print(f"SE with n=4000: {se_large:.4f}") # 0.0079 or about 0.79%
Key Insight: Standard error decreases with square root of sample size. To halve the error, you need 4x the sample size.Analogy: Think of standard error as the “blurriness” of a photograph. More data is like more megapixels — the picture gets sharper. But the improvement is diminishing: going from 100 to 400 data points (4x) only cuts the blur in half. Going from 400 to 1,600 (another 4x) cuts it in half again. This is why data scientists obsess over whether more data is actually worth the collection cost.
Statistical Mistake in ML — Trusting Small Validation Sets: If you evaluate your model on a test set of only 50 samples and report “95% accuracy,” the standard error is roughly sqrt(0.95 times 0.05 / 50) = 3.1%. Your true accuracy could easily be anywhere from 89% to 100%. With 500 samples, that error drops to about 1%. Always compute confidence intervals around your ML metrics, especially when comparing models. A “2% improvement” on a small test set is often statistical noise.
Confidence Intervals: Expressing Uncertainty
A confidence interval gives a range of plausible values for the true parameter.
The Formula
For a proportion with 95% confidence:p^±z∗⋅SE=p^±1.96⋅np^(1−p^)
from scipy import statsdef confidence_interval_proportion(p_hat, n, confidence=0.95): """Calculate confidence interval for a proportion.""" # Z-score for desired confidence level z = stats.norm.ppf((1 + confidence) / 2) # Standard error se = np.sqrt(p_hat * (1 - p_hat) / n) # Margin of error moe = z * se return (p_hat - moe, p_hat + moe), moe# Poll result: 52% with n=1000p_hat = 0.52n = 1000ci, moe = confidence_interval_proportion(p_hat, n)print(f"Point estimate: {p_hat:.1%}")print(f"Margin of error: ±{moe:.1%}")print(f"95% CI: ({ci[0]:.1%}, {ci[1]:.1%})")
Output:
Point estimate: 52.0%Margin of error: ±3.1%95% CI: (48.9%, 55.1%)
What Does “95% Confidence” Mean?
It does NOT mean “95% probability the true value is in this interval.”It means: If we repeated this process many times, 95% of the intervals we construct would contain the true value.
# Demonstrate: Create 100 confidence intervalsintervals_containing_truth = 0true_p = 0.52 # Known true value (in real life, unknown)for _ in range(100): # Take a sample sample = np.random.choice(['A', 'B'], size=1000, p=[true_p, 1-true_p]) p_hat = np.mean(sample == 'A') # Calculate CI ci, _ = confidence_interval_proportion(p_hat, 1000) # Check if CI contains true value if ci[0] <= true_p <= ci[1]: intervals_containing_truth += 1print(f"{intervals_containing_truth}% of intervals contained the true value")# Should be close to 95!
Confidence Intervals for Means
When estimating an average (like average house price):
def confidence_interval_mean(data, confidence=0.95): """Calculate confidence interval for a mean using t-distribution.""" n = len(data) mean = np.mean(data) std_err = stats.sem(data) # Standard error of the mean # Use t-distribution for small samples t_crit = stats.t.ppf((1 + confidence) / 2, df=n-1) moe = t_crit * std_err return (mean - moe, mean + moe), moe# Example: House prices (in thousands)house_prices = np.array([ 425, 389, 445, 520, 478, 395, 510, 462, 398, 485, 512, 445, 468, 502, 389, 475, 498, 415, 528, 459, 442, 495, 478, 410, 525, 465, 488, 435, 505, 472])ci, moe = confidence_interval_mean(house_prices)print(f"Sample mean: ${np.mean(house_prices):.1f}K")print(f"Margin of error: ±${moe:.1f}K")print(f"95% CI: (${ci[0]:.1f}K, ${ci[1]:.1f}K)")
Output:
Sample mean: $463.5KMargin of error: ±$15.1K95% CI: ($448.4K, $478.6K)
The t-Distribution: For Small Samples
When sample size is small (n < 30), we use the t-distribution instead of the normal distribution.Why? Small samples have more uncertainty about the true standard deviation.
# Compare t and normal distributionsx = np.linspace(-4, 4, 1000)normal = stats.norm.pdf(x)t_5 = stats.t.pdf(x, df=5) # 5 degrees of freedomt_30 = stats.t.pdf(x, df=30) # 30 degrees of freedomimport matplotlib.pyplot as pltplt.figure(figsize=(10, 5))plt.plot(x, normal, label='Normal', linewidth=2)plt.plot(x, t_5, label='t (df=5)', linestyle='--', linewidth=2)plt.plot(x, t_30, label='t (df=30)', linestyle=':', linewidth=2)plt.xlabel('x')plt.ylabel('Density')plt.title('Normal vs t-Distribution')plt.legend()plt.show()
The t-distribution has heavier tails, meaning it accounts for more uncertainty. As sample size increases, it approaches the normal distribution.
Sample Size Planning
How large a sample do you need? It depends on:
Desired margin of error
Desired confidence level
Expected variability
For Proportions
n=(MOEz∗)2⋅p(1−p)
def sample_size_proportion(moe, p=0.5, confidence=0.95): """Calculate required sample size for a proportion.""" z = stats.norm.ppf((1 + confidence) / 2) n = (z / moe) ** 2 * p * (1 - p) return int(np.ceil(n))# Want ±3% margin of error at 95% confidencen_needed = sample_size_proportion(moe=0.03)print(f"Need {n_needed} respondents for ±3% MOE") # 1068# For ±1% (much more precise)n_needed_1pct = sample_size_proportion(moe=0.01)print(f"Need {n_needed_1pct} respondents for ±1% MOE") # 9604# Notice: 3x more precision requires 9x more sample!
For Means
n=(MOEz∗⋅σ)2
def sample_size_mean(moe, std_dev, confidence=0.95): """Calculate required sample size for a mean.""" z = stats.norm.ppf((1 + confidence) / 2) n = (z * std_dev / moe) ** 2 return int(np.ceil(n))# House prices: want ±$10K, estimated std dev is $50Kn_houses = sample_size_mean(moe=10, std_dev=50)print(f"Need {n_houses} houses for ±$10K MOE") # 97
Mini-Project: Election Poll Analyzer
Build a complete polling analysis system:
import numpy as npfrom scipy import statsclass PollAnalyzer: """ Analyze election poll results with proper uncertainty quantification. """ def __init__(self, candidate_a_votes, total_votes, confidence=0.95): self.n = total_votes self.a_votes = candidate_a_votes self.b_votes = total_votes - candidate_a_votes self.p_a = candidate_a_votes / total_votes self.p_b = 1 - self.p_a self.confidence = confidence def margin_of_error(self): """Calculate margin of error for candidate A's proportion.""" z = stats.norm.ppf((1 + self.confidence) / 2) se = np.sqrt(self.p_a * self.p_b / self.n) return z * se def confidence_interval(self): """Calculate confidence interval for candidate A.""" moe = self.margin_of_error() return (self.p_a - moe, self.p_a + moe) def probability_a_wins(self): """ Estimate probability that candidate A is truly ahead. This uses the normal approximation. """ # We want P(true_p_a > 0.5) # The difference (p_a - 0.5) follows approximately normal diff = self.p_a - 0.5 se = np.sqrt(self.p_a * self.p_b / self.n) # Z-score for the difference from 0.5 z = diff / se # Probability that true proportion > 0.5 return stats.norm.cdf(z) def required_sample_for_call(self, min_confidence=0.95): """ Calculate sample size needed to call the race at given confidence. Returns None if current lead is too small. """ # We need the CI to not cross 50% # This happens when |p_a - 0.5| > MOE lead = abs(self.p_a - 0.5) z = stats.norm.ppf((1 + min_confidence) / 2) # Solve: z * sqrt(p*q/n) = lead # n = (z^2 * p * q) / lead^2 if lead == 0: return float('inf') n = (z ** 2 * self.p_a * self.p_b) / (lead ** 2) return int(np.ceil(n)) def report(self): """Generate comprehensive poll report.""" ci = self.confidence_interval() print("\n" + "=" * 60) print("ELECTION POLL ANALYSIS") print("=" * 60) print(f"Sample Size: {self.n:,} voters") print(f"Confidence Level: {self.confidence:.0%}") print("-" * 60) print(f"Candidate A: {self.p_a:.1%} ({self.a_votes:,} votes)") print(f"Candidate B: {self.p_b:.1%} ({self.b_votes:,} votes)") print("-" * 60) print(f"Margin of Error: ±{self.margin_of_error():.1%}") print(f"95% CI for A: ({ci[0]:.1%}, {ci[1]:.1%})") print("-" * 60) p_wins = self.probability_a_wins() if p_wins > 0.99: call = "PROJECTED WINNER: Candidate A" elif p_wins < 0.01: call = "PROJECTED WINNER: Candidate B" elif p_wins > 0.95: call = "LIKELY WINNER: Candidate A" elif p_wins < 0.05: call = "LIKELY WINNER: Candidate B" else: call = "TOO CLOSE TO CALL" print(f"P(A is truly ahead): {p_wins:.1%}") print(f"Status: {call}") if 0.05 < p_wins < 0.95: n_needed = self.required_sample_for_call() if n_needed < float('inf'): print(f"Need ~{n_needed:,} votes to call at 95%") print("=" * 60)# Example 1: Early results (close race)print("\n--- EARLY RESULTS ---")poll1 = PollAnalyzer(candidate_a_votes=520, total_votes=1000)poll1.report()# Example 2: More data (still close)print("\n--- UPDATED RESULTS ---")poll2 = PollAnalyzer(candidate_a_votes=5200, total_votes=10000)poll2.report()# Example 3: Clear leadprint("\n--- CLEAR LEAD ---")poll3 = PollAnalyzer(candidate_a_votes=5500, total_votes=10000)poll3.report()
Output:
--- EARLY RESULTS ---============================================================ELECTION POLL ANALYSIS============================================================Sample Size: 1,000 votersConfidence Level: 95%------------------------------------------------------------Candidate A: 52.0% (520 votes)Candidate B: 48.0% (480 votes)------------------------------------------------------------Margin of Error: ±3.1%95% CI for A: (48.9%, 55.1%)------------------------------------------------------------P(A is truly ahead): 89.7%Status: TOO CLOSE TO CALLNeed ~2,397 votes to call at 95%============================================================--- UPDATED RESULTS ---============================================================ELECTION POLL ANALYSIS============================================================Sample Size: 10,000 votersConfidence Level: 95%------------------------------------------------------------Candidate A: 52.0% (5,200 votes)Candidate B: 48.0% (4,800 votes)------------------------------------------------------------Margin of Error: ±1.0%95% CI for A: (51.0%, 53.0%)------------------------------------------------------------P(A is truly ahead): 100.0%Status: PROJECTED WINNER: Candidate A============================================================
Common Mistakes in Inference
Mistake 1: Ignoring Sample Bias
# BAD: Survey only people who answer phones during business hours# This systematically excludes working people!# GOOD: Random sampling from entire population
Common Mistakes to Avoid
Mistake 1: Misleading Margin of ErrorA headline saying “Poll shows 52% support (±3%)” means the 95% CI is 49-55%. But if the race is 52% vs 48%, the intervals overlap and the race is actually too close to call!
Mistake 2: Small Sample, Big Claims
# Survey of 30 people shows 60% prefer product Aci, moe = confidence_interval_proportion(0.60, 30)print(f"95% CI: ({ci[0]:.1%}, {ci[1]:.1%})")# CI: (42.4%, 77.6%) - way too wide to claim victory!
Mistake 3: Confusing Confidence Level with Probability
# WRONG: "There's a 95% chance the true value is between 48.9% and 55.1%"# RIGHT: "We're 95% confident our method produces intervals containing the true value"
Question: Your A/B test shows the new feature increased click-through rate from 2.0% to 2.3%, with a 95% CI of [2.1%, 2.5%] for the new version. What can you conclude?
Answer:
We’re 95% confident the true CTR for the new version is between 2.1% and 2.5%
Since the entire CI is above 2.0% (the control), we have evidence of a real improvement
The minimum expected improvement is 0.1 percentage points (2.1% - 2.0%)
For business decisions, consider if a 0.1-0.5 pp improvement justifies the change
Note: If the CI included 2.0%, we couldn’t conclude there’s a real difference.
Question 2: Sample Size Planning (Amazon)
Question: You want to estimate the proportion of customers who will buy a new product. You need ±5% precision with 95% confidence. How many customers should you survey?
Answer:
# Use p = 0.5 for maximum sample size (conservative)# Formula: n = (z²×p×(1-p)) / E²z = 1.96p = 0.5 # Conservative assumptionE = 0.05 # Desired margin of errorn = (z**2 * p * (1-p)) / (E**2)print(f"Sample size needed: {int(np.ceil(n))}") # 385
Key insight: Using p = 0.5 gives the largest sample size because that’s where variance is maximized. If you know approximately what p will be, you can use that value for a smaller required sample.
Question 3: Standard Error Application (Facebook/Meta)
Question: Daily active users (DAU) over the past 100 days had mean 50M with standard deviation 5M. What’s the 95% CI for the true mean DAU?
The true average DAU is likely between 49M and 51M with 95% confidence.
Question 4: Bias in Sampling (Tech Companies)
Question: You survey users who contacted customer support about a new feature. 80% say they dislike it. Is this valid for all users?
Answer: No! This is selection bias.Users who contact support are more likely to have problems. The sample is not representative of all users. You’re measuring “satisfaction among users with issues” not “overall satisfaction.”To get a valid estimate, you need:
Random sampling from all users
Or stratified sampling to ensure representation
Consider that satisfied users rarely reach out
This is called “sampling bias” or “survivorship bias” and is a major concern in ML training data as well.
Practice Challenge
Challenge: Power Analysis for A/B Test
You’re planning an A/B test. The current conversion rate is 5%. You want to detect a 20% relative improvement (5% → 6%). How many users do you need per group?
# This is called a power analysis# We need to balance:# - Significance level (α): probability of false positive# - Power (1-β): probability of detecting a real effect# - Effect size: the difference we want to detect# - Sample size: what we're solving forfrom scipy import statsimport numpy as npdef required_sample_size_ab(p1, p2, alpha=0.05, power=0.8): """ Calculate required sample size per group for A/B test. p1: baseline conversion rate p2: expected conversion rate after improvement alpha: significance level (typically 0.05) power: probability of detecting effect if real (typically 0.8) """ # Effect size (Cohen's h) h = 2 * (np.arcsin(np.sqrt(p2)) - np.arcsin(np.sqrt(p1))) # Z-scores z_alpha = stats.norm.ppf(1 - alpha/2) # Two-tailed z_beta = stats.norm.ppf(power) # Sample size per group n = 2 * ((z_alpha + z_beta) / h) ** 2 return int(np.ceil(n))# Your task: Calculate and interpretp_baseline = 0.05p_improved = 0.06n_per_group = required_sample_size_ab(p_baseline, p_improved)print(f"Need {n_per_group} users per group")print(f"Total users: {2 * n_per_group}")# Also calculate for different scenarios:# 1. What if you want to detect a 10% improvement (5% → 5.5%)?# 2. What if power needs to be 90% instead of 80%?
Solution:
# Base case: 5% → 6% (20% relative improvement)n_base = required_sample_size_ab(0.05, 0.06)print(f"Base case: {n_base:,} per group") # ~4,794# Scenario 1: 5% → 5.5% (10% relative improvement)n_smaller = required_sample_size_ab(0.05, 0.055)print(f"Smaller effect: {n_smaller:,} per group") # ~19,177# 4x more users for half the effect size!# Scenario 2: 90% powern_high_power = required_sample_size_ab(0.05, 0.06, power=0.9)print(f"Higher power: {n_high_power:,} per group") # ~6,420# ~34% more users for 10% more power# Key insight: Sample size grows QUADRATICALLY with smaller effect sizes# This is why A/B testing small improvements is expensive!
📝 Practice Exercises
Exercise 1
Calculate confidence intervals for proportions
Exercise 2
Determine required sample sizes for precision
Exercise 3
Construct confidence intervals for means
Exercise 4
Real-world: Election polling analysis
Key Takeaways
Population vs Sample
Population: entire group of interest
Sample: subset we actually observe
Statistics estimate parameters
Standard Error
Measures variability of sample statistics
Decreases with sqrt(n)
Foundation of confidence intervals
Confidence Intervals
Range of plausible values for parameter
Width = 2 x margin of error
Higher confidence = wider interval
Sample Size
More precision requires more data
Quadratic relationship (2x precision = 4x data)
Plan before collecting data
Common Pitfalls
Inference Mistakes to Avoid:
Misinterpreting Confidence Intervals - “95% confident the true value is in this range” NOT “95% chance the parameter is here”
Ignoring Sample Bias - Non-random samples lead to biased estimates regardless of sample size
Confusing Confidence Level with Precision - 99% confidence is wider, not more precise
Forgetting Standard Error Shrinks with √n - To halve SE, you need 4x the data, not 2x
Using z when t is appropriate - For small samples (n < 30), t-distribution accounts for extra uncertainty
Connection to Machine Learning
Inference Concept
ML Application
Confidence intervals
Uncertainty in predictions
Standard error
Error bars, prediction intervals
Sample size
Training set size planning
t-distribution
Small data regimes, regularization
Bias in sampling
Training/test split, data collection
ML Connection: When you report model accuracy as “92% ± 2%”, you’re using confidence intervals! Cross-validation provides multiple samples, and the standard error tells you how much your accuracy estimate might vary.
Coming up next: We’ll learn about Hypothesis Testing - how to determine if a difference is real or just random noise. This is the foundation of A/B testing and scientific validation of ML models.
Next: Hypothesis Testing
Learn to distinguish real effects from random noise
Interview Deep-Dive
A colleague says: 'The 95% confidence interval is 4.2% to 5.8%, so there is a 95% probability the true rate is in that range.' Is this correct?
Strong Answer:
This is one of the most common misconceptions in statistics, and it is wrong. The true population parameter is a fixed number — it either is or is not in that interval. There is no probability about it. The 95% refers to the procedure, not to any single interval.
The correct interpretation: if we repeated this experiment many times and constructed a 95% confidence interval each time, approximately 95% of those intervals would contain the true parameter. For any single interval, we do not know if it is one of the 95% that captured the truth or one of the 5% that missed.
In practice, most people (including many data scientists) use the Bayesian-sounding interpretation because it is more intuitive for decision-making. And with a flat prior, the Bayesian credible interval actually gives you the statement your colleague was trying to make. But in a frequentist framework, the distinction matters because it affects how you communicate uncertainty.
The practical consequence: when reporting results to stakeholders, I usually say “we are 95% confident that the true rate lies between 4.2% and 5.8%” which is technically correct, rather than “there is a 95% chance” which is technically not. But I also explain that the interval gives us a range of plausible values, and values outside the interval are implausible given our data.
Follow-up: When would you recommend switching from a frequentist confidence interval to a Bayesian credible interval?I would switch to Bayesian methods when prior information is genuinely available and important. For example, if we are estimating conversion rates for a new checkout flow, we have strong prior knowledge that conversion rates for e-commerce sites typically fall between 1% and 10%. A Bayesian approach with an informative prior can produce tighter, more useful intervals, especially with small sample sizes. The Bayesian credible interval also answers the question people actually want to ask: “What is the probability the parameter is in this range?” Another scenario is online A/B testing where you want to continuously update your beliefs as data arrives. Bayesian methods allow natural sequential updating without the multiple testing penalties that plague frequentist approaches when you peek at results.
You need to estimate the mean order value for a new product line, but you only have 12 orders so far. Walk me through the right approach.
Strong Answer:
With n=12, we are firmly in small-sample territory, so I would use a t-distribution rather than a normal distribution for the confidence interval. The t-distribution has heavier tails than the normal, which accounts for the extra uncertainty in estimating the population standard deviation from such a small sample.
Specifically, I would compute the sample mean and sample standard deviation, then build a t-based confidence interval: x-bar plus or minus t-critical times (s / sqrt(12)), where t-critical comes from the t-distribution with 11 degrees of freedom. For 95% confidence, t-critical is approximately 2.201, compared to 1.96 for the normal — about 12% wider.
Before trusting this interval, I would check the normality assumption. With only 12 observations, I cannot reliably test normality with formal tests (they have very low power at n=12), but I would look at a Q-Q plot and check for obvious outliers or extreme skewness. If the data is heavily skewed (which order values often are due to a long right tail), I would consider either a log transformation or a bootstrap confidence interval instead.
I would also be transparent about the limitations. A 95% CI from 12 observations will be very wide — potentially too wide to be useful for decision-making. I would tell stakeholders: “Here is our best estimate and its range, but we need at least 50-100 orders before this estimate stabilizes enough to base pricing or inventory decisions on it.”
Follow-up: How does the bootstrap approach work for this problem, and why might it be better than the t-interval?Bootstrap resamples the 12 observations with replacement thousands of times, computes the mean of each resample, and uses the distribution of those means to form a confidence interval. The key advantage is that it makes no assumption about the underlying distribution — no normality required. For order values, which are often right-skewed with occasional large orders, this matters because the t-interval assumes approximate normality of the sampling distribution, which may not hold well at n=12 with skewed data. The bootstrap percentile interval (2.5th and 97.5th percentiles of the bootstrap means) will naturally be asymmetric if the data is skewed, giving a more honest representation of uncertainty. The downside is that with only 12 original data points, the bootstrap has limited “material” to work with, so its coverage properties are not guaranteed. With very small n, the bias-corrected and accelerated (BCa) bootstrap is preferred over the simple percentile method.
What is the difference between standard error and standard deviation, and why do candidates confuse them?
Strong Answer:
Standard deviation (SD) measures the spread of individual observations in your data. If heights have SD = 3 inches, that tells you individual people vary by about 3 inches from the average height.
Standard error (SE) measures the precision of a sample statistic — how much that statistic would vary if you repeated the experiment. The standard error of the mean is SD / sqrt(n). With n=100 and SD=3, the SE is 0.3 inches. This tells you your sample mean is precise to about 0.3 inches.
Candidates confuse them because both involve similar-looking formulas and both measure “variability.” The critical distinction is what is varying: SD describes variability of the data, SE describes variability of the estimate. Doubling the sample size barely changes the SD but cuts the SE by a factor of sqrt(2).
In practice, the confusion causes real errors. If someone reports “mean response time is 200ms with standard deviation 50ms” and someone else interprets that 50ms as the standard error, they would think the mean is extremely precisely estimated (CI of roughly 200 plus or minus 100ms) when actually the standard error might be 5ms (CI of 200 plus or minus 10ms) — a very different statement about confidence.
Follow-up: In a research paper, the error bars on a chart could represent SD, SE, or a 95% CI. How do you tell which, and why does it matter?You check the figure legend or methods section — responsible papers specify which measure is used. If they do not, that is already a red flag. The visual impact is dramatically different: SE bars are roughly sqrt(n) times smaller than SD bars, and 95% CI bars are about 2x wider than SE bars. A chart with SD bars looks like the data is noisy and the groups overlap heavily. The same data with SE bars looks like the groups are cleanly separated. This is why some researchers have been criticized for cherry-picking: showing SE bars when they want to emphasize differences and SD bars when they want to show the “spread.” The gold standard is to show 95% CI bars, because they directly communicate the precision of the estimate and allow the reader to visually assess significance.
{"docsConfig":{"theme":"mint","$schema":"https://mintlify.com/docs.json","name":"Dev Weekends","colors":{"primary":"#000000","light":"#6B7280","dark":"#000000"},"favicon":"https://mintcdn.com/devweeekends/uFspW_ITEafc8XbV/images/logo.png?fit=max\u0026auto=format\u0026n=uFspW_ITEafc8XbV\u0026q=85\u0026s=24941b53d3f0793eb83974749e82df4f","navbar":{"links":[{"href":"https://devweekends.com","label":"Back to Site"}]},"footer":{"socials":{"youtube":"https://www.youtube.com/@devweekends","github":"https://github.com/DevWeekends","linkedin":"https://www.linkedin.com/company/dev-weekends"}},"contextual":{"options":["copy","view","chatgpt","claude","perplexity","mcp","cursor","vscode"],"display":"header"},"styling":{"latex":true},"navigation":{"global":{"anchors":[{"anchor":"DevWeekends","icon":"globe","href":"https://devweekends.com"}]},"pages":[]}},"deployment":{"deploymentMetadataValue":{"subdomain":"devweeekends","hasAudioNarration":false,"actualSubdomain":"devweeekends","customDomains":["resources.devweekends.com"],"gitSource":{"type":"github","owner":"devweekends","repo":"docs","deployBranch":"main","contentDirectory":"","isPrivate":false,"mountPath":"","label":""},"entitlements":{},"buildId":"6ad5cb977e3343e90aaa7f7f","clientVersion":"0.0.4177","searchFilterCounts":[{"language":"default","tag":"Courses","count":785},{"language":"default","tag":"Crash Courses","count":145},{"language":"default","tag":"Interview Prep","count":69},{"language":"default","tag":"AI Engineering","count":60},{"language":"default","tag":"Distributed System Tools","count":60},{"language":"default","tag":"Deep Learning Mastery","count":48},{"language":"default","tag":"DevOps Tools","count":38},{"language":"default","tag":"Think Like an Engineer","count":38},{"language":"default","tag":"Competitive Programming","count":37},{"language":"default","tag":"Angular Master Course","count":34}]},"assistantConfig":{"enableAskAiButton":false,"enableStarterQuestions":false,"enableAskAiSearchBar":true},"basePath":"","hasChatPermissions":false,"hasWebMcpPermissions":false,"toggles":[{"name":"kill-isr","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"custom-rbac-roles","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-mintlify-slack","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-integrations-settings","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"rbac-expansion","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-pr-grouping","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"custom-prefix","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"analytics-v7","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"user-flows-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"no-publish-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-onboarding","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving-live","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"stripTemperatureMiddleware","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"support-platform-pylon-zendesk","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"instant-rollback","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications-server","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-fable","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fixed-ai-action-pricing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automation-resolve-merge-conflict","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"scoped-publishing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"mintql","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"page-level-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-version-history-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"billing-page-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"full-page-search","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workspace-projects","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"assistant-v5","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fork-pr-previews","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"revalidation-jwt","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-sso-scim","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"hobby-abuse-scan","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"dashboard-inbox","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-signup","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"turbopuffer-dual-write","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-enabled","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"approve-review-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-metadata","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"sso-setup-deadline-banner","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"turbopuffer-serve","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"live-agents","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"starter-pricing","enabled":true,"variant":{"name":"control","enabled":true,"payload":{"type":"string","value":"control"},"feature_enabled":true},"impressionData":false},{"name":"llms-txt-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false}],"googleFontsInlined":false},"customCss":[],"page":{"pagePath":"courses/statistics-for-ml/05-inference","slug":"/courses/statistics-for-ml/05-inference","pageMetadata":{"title":"Statistical Inference: Conclusions from Samples","sidebarTitle":"Inference","description":"How to draw reliable conclusions about millions from just hundreds of observations","icon":"magnifying-glass-chart","href":"/courses/statistics-for-ml/05-inference"},"description":{"compiledSource":"\"use strict\";\nconst {jsx: _jsx} = arguments[0];\nconst {useMDXComponents: _provideComponents} = arguments[0];\nfunction _createMdxContent(props) {\n const _components = {\n p: \"p\",\n ..._provideComponents(),\n ...props.components\n };\n return _jsx(_components.p, {\n children: \"How to draw reliable conclusions about millions from just hundreds of observations\"\n });\n}\nfunction MDXContent(props = {}) {\n const {wrapper: MDXLayout} = {\n ..._provideComponents(),\n ...props.components\n };\n return MDXLayout ? _jsx(MDXLayout, {\n ...props,\n children: _jsx(_createMdxContent, {\n ...props\n })\n }) : _createMdxContent(props);\n}\nreturn {\n default: MDXContent\n};\n","frontmatter":{},"scope":{}},"pageType":"default","mdx":{"mdxSource":{"compiledSource":"\"use strict\";const{Fragment:_Fragment,jsx:_jsx,jsxs:_jsxs}=arguments[0];const{useMDXComponents:_provideComponents}=arguments[0];function _createMdxContent(props){const _components={annotation:`annotation`,br:`br`,code:`code`,hr:`hr`,li:`li`,math:`math`,mfrac:`mfrac`,mi:`mi`,mn:`mn`,mo:`mo`,mover:`mover`,mrow:`mrow`,msqrt:`msqrt`,msup:`msup`,ol:`ol`,p:`p`,path:`path`,pre:`pre`,semantics:`semantics`,span:`span`,strong:`strong`,svg:`svg`,tbody:`tbody`,td:`td`,th:`th`,thead:`thead`,tr:`tr`,ul:`ul`,..._provideComponents(),...props.components},{Accordion,AccordionGroup,Card,CardGroup,CodeBlock,Frame,Heading,Info,OptimizedImage,Table,Tip,Warning}=_components;if(!Accordion)_missingMdxReference(`Accordion`,true);if(!AccordionGroup)_missingMdxReference(`AccordionGroup`,true);if(!Card)_missingMdxReference(`Card`,true);if(!CardGroup)_missingMdxReference(`CardGroup`,true);if(!CodeBlock)_missingMdxReference(`CodeBlock`,true);if(!Frame)_missingMdxReference(`Frame`,true);if(!Heading)_missingMdxReference(`Heading`,true);if(!Info)_missingMdxReference(`Info`,true);if(!OptimizedImage)_missingMdxReference(`OptimizedImage`,true);if(!Table)_missingMdxReference(`Table`,true);if(!Tip)_missingMdxReference(`Tip`,true);if(!Warning)_missingMdxReference(`Warning`,true);return _jsxs(_Fragment,{children:[_jsx(Frame,{children:_jsx(OptimizedImage,{src:`https://mintcdn.com/devweeekends/X0Fp4X8lMl-ZftoO/images/courses/statistics-for-ml/inference-real-world.svg?fit=max\u0026auto=format\u0026n=X0Fp4X8lMl-ZftoO\u0026q=85\u0026s=8c805f6b5cd529f3362be441e21ad814`,alt:`Statistical Inference`,\"data-og-width\":`1080`,width:`1080`,\"data-og-height\":`1080`,height:`1080`,\"data-path\":`images/courses/statistics-for-ml/inference-real-world.svg`,\"data-optimize\":`true`,\"data-opv\":`3`,srcset:`https://mintcdn.com/devweeekends/X0Fp4X8lMl-ZftoO/images/courses/statistics-for-ml/inference-real-world.svg?w=280\u0026fit=max\u0026auto=format\u0026n=X0Fp4X8lMl-ZftoO\u0026q=85\u0026s=fdce748f97a128e3fc6544f3a19c46a1 280w, https://mintcdn.com/devweeekends/X0Fp4X8lMl-ZftoO/images/courses/statistics-for-ml/inference-real-world.svg?w=560\u0026fit=max\u0026auto=format\u0026n=X0Fp4X8lMl-ZftoO\u0026q=85\u0026s=99088b09aa3d097232dcc8290d874f81 560w, https://mintcdn.com/devweeekends/X0Fp4X8lMl-ZftoO/images/courses/statistics-for-ml/inference-real-world.svg?w=840\u0026fit=max\u0026auto=format\u0026n=X0Fp4X8lMl-ZftoO\u0026q=85\u0026s=4505d4b9d23529590b0bf47c4213d7ca 840w, https://mintcdn.com/devweeekends/X0Fp4X8lMl-ZftoO/images/courses/statistics-for-ml/inference-real-world.svg?w=1100\u0026fit=max\u0026auto=format\u0026n=X0Fp4X8lMl-ZftoO\u0026q=85\u0026s=ad97419eadce57d1052271bedeb61ef0 1100w, https://mintcdn.com/devweeekends/X0Fp4X8lMl-ZftoO/images/courses/statistics-for-ml/inference-real-world.svg?w=1650\u0026fit=max\u0026auto=format\u0026n=X0Fp4X8lMl-ZftoO\u0026q=85\u0026s=f1e1c220671c3dc01c0dc021d53c5d48 1650w, https://mintcdn.com/devweeekends/X0Fp4X8lMl-ZftoO/images/courses/statistics-for-ml/inference-real-world.svg?w=2500\u0026fit=max\u0026auto=format\u0026n=X0Fp4X8lMl-ZftoO\u0026q=85\u0026s=44382ddec2199e13a358af8fbbc235ca 2500w`})}),`\n`,_jsx(Heading,{level:`1`,id:`statistical-inference-conclusions-from-samples`,children:`Statistical Inference: Conclusions from Samples`}),`\n`,_jsx(Heading,{level:`2`,id:`the-election-polling-problem`,children:`The Election Polling Problem`}),`\n`,_jsx(_components.p,{children:`It’s election night. With only 2% of votes counted, news networks are already predicting the winner with 95% confidence.`}),`\n`,_jsx(_components.p,{children:`How is that possible? They’ve only seen a tiny fraction of the votes!`}),`\n`,_jsxs(_components.p,{children:[`This is the power of `,_jsx(_components.strong,{children:`statistical inference`}),` - the science of drawing conclusions about a large group (population) by studying a small part of it (sample).`]}),`\n`,_jsx(Info,{children:_jsxs(_components.p,{children:[_jsx(_components.strong,{children:`Estimated Time`}),`: 3-4 hours`,_jsx(_components.br,{}),`\n`,_jsx(_components.strong,{children:`Difficulty`}),`: Intermediate`,_jsx(_components.br,{}),`\n`,_jsx(_components.strong,{children:`Prerequisites`}),`: Modules 1-3 (Describing Data, Probability, Distributions)`,_jsx(_components.br,{}),`\n`,_jsx(_components.strong,{children:`What You’ll Build`}),`: Election predictor, survey analyzer`]})}),`\n`,_jsx(_components.hr,{}),`\n`,_jsx(Heading,{level:`2`,id:`population-vs-sample`,children:`Population vs Sample`}),`\n`,_jsxs(Table,{children:[_jsx(_components.thead,{children:_jsxs(_components.tr,{children:[_jsx(_components.th,{children:`Term`}),_jsx(_components.th,{children:`Definition`}),_jsx(_components.th,{children:`Example`})]})}),_jsxs(_components.tbody,{children:[_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.strong,{children:`Population`})}),_jsx(_components.td,{children:`The entire group you want to study`}),_jsx(_components.td,{children:`All 150 million voters`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.strong,{children:`Sample`})}),_jsx(_components.td,{children:`A subset you actually observe`}),_jsx(_components.td,{children:`1,500 surveyed voters`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.strong,{children:`Parameter`})}),_jsx(_components.td,{children:`True value for the population`}),_jsx(_components.td,{children:`Actual vote percentage`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.strong,{children:`Statistic`})}),_jsx(_components.td,{children:`Calculated from the sample`}),_jsx(_components.td,{children:`Survey percentage`})]})]})]}),`\n`,_jsxs(_components.p,{children:[`The fundamental challenge: We want to know the `,_jsx(_components.strong,{children:`parameter`}),`, but we can only calculate the `,_jsx(_components.strong,{children:`statistic`}),`.`]}),`\n`,_jsxs(_components.p,{children:[_jsx(_components.strong,{children:`Analogy`}),`: Imagine you are trying to figure out the average temperature of an entire ocean. You cannot measure every single water molecule — that is the population parameter. Instead, you dip thermometers at various points — those are your samples. The art of inference is taking those thermometer readings and making reliable statements about the whole ocean, along with an honest assessment of how wrong you might be.`]}),`\n`,_jsx(Tip,{children:_jsxs(_components.p,{children:[_jsx(_components.strong,{children:`ML Application — Training vs. Test Performance`}),`: Statistical inference is exactly the problem ML faces. Your training set is a sample, and you want to know how the model performs on the population (all future data it will ever see). This is why cross-validation exists — it simulates drawing multiple samples to estimate how much your performance metric varies. When you report “accuracy = 92% plus or minus 2%”, you are doing inference: using sample statistics to estimate a population parameter.`]})}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`12`,language:`python`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`python`,children:_jsxs(_components.code,{language:`python`,numberOfLines:`12`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` numpy `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`as`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` np`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# Imagine this is the TRUE population (we normally don't know this!)`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`np.random.seed(`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`42`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`population `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` np.random.choice([`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'A'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'B'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`], `}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`size`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`10_000_000`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`p`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`[`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`0.52`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`0.48`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`])`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`true_proportion `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` np.mean(population `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`==`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'A'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:`print`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`f`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"TRUE population proportion for A: `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`{`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`true_proportion`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`:.4f}`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) `}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# ~0.52`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# But we can only survey 1000 people`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`sample `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` np.random.choice(population, `}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`size`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`1000`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`replace`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:`False`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`sample_proportion `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` np.mean(sample `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`==`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'A'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:`print`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`f`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"Sample proportion for A: `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`{`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`sample_proportion`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`:.4f}`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) `}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# Varies!`})]}),`\n`]})})}),`\n`,_jsx(Frame,{children:_jsx(OptimizedImage,{src:`https://mintcdn.com/devweeekends/CHfRzoAmD5TGW2ch/images/courses/statistics-for-ml/sampling-math.svg?fit=max\u0026auto=format\u0026n=CHfRzoAmD5TGW2ch\u0026q=85\u0026s=07eb21e6842b8ddf8dd6f7351c4871bb`,alt:`Population vs Sample Visualization`,\"data-og-width\":`1080`,width:`1080`,\"data-og-height\":`1080`,height:`1080`,\"data-path\":`images/courses/statistics-for-ml/sampling-math.svg`,\"data-optimize\":`true`,\"data-opv\":`3`,srcset:`https://mintcdn.com/devweeekends/CHfRzoAmD5TGW2ch/images/courses/statistics-for-ml/sampling-math.svg?w=280\u0026fit=max\u0026auto=format\u0026n=CHfRzoAmD5TGW2ch\u0026q=85\u0026s=44d245986a959dba92038332caa7ac7f 280w, https://mintcdn.com/devweeekends/CHfRzoAmD5TGW2ch/images/courses/statistics-for-ml/sampling-math.svg?w=560\u0026fit=max\u0026auto=format\u0026n=CHfRzoAmD5TGW2ch\u0026q=85\u0026s=6a4180d2780c6ccc4ecc888eb8a3d3f4 560w, https://mintcdn.com/devweeekends/CHfRzoAmD5TGW2ch/images/courses/statistics-for-ml/sampling-math.svg?w=840\u0026fit=max\u0026auto=format\u0026n=CHfRzoAmD5TGW2ch\u0026q=85\u0026s=8dbcae52a19a37b9d7ea9552d4d1803b 840w, https://mintcdn.com/devweeekends/CHfRzoAmD5TGW2ch/images/courses/statistics-for-ml/sampling-math.svg?w=1100\u0026fit=max\u0026auto=format\u0026n=CHfRzoAmD5TGW2ch\u0026q=85\u0026s=4170cd0d8ac2f66ea4508ac30cd51264 1100w, https://mintcdn.com/devweeekends/CHfRzoAmD5TGW2ch/images/courses/statistics-for-ml/sampling-math.svg?w=1650\u0026fit=max\u0026auto=format\u0026n=CHfRzoAmD5TGW2ch\u0026q=85\u0026s=aa4cd8671b94dd96ddb1cafc040b483c 1650w, https://mintcdn.com/devweeekends/CHfRzoAmD5TGW2ch/images/courses/statistics-for-ml/sampling-math.svg?w=2500\u0026fit=max\u0026auto=format\u0026n=CHfRzoAmD5TGW2ch\u0026q=85\u0026s=c0e4f406c18e242e8fd10f52567c1ec7 2500w`})}),`\n`,_jsx(_components.hr,{}),`\n`,_jsx(Heading,{level:`2`,id:`sampling-distributions-the-key-insight`,children:`Sampling Distributions: The Key Insight`}),`\n`,_jsx(_components.p,{children:`Here’s the crucial question: If we took many different samples, how would our estimates vary?`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`12`,language:`python`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`python`,children:_jsxs(_components.code,{language:`python`,numberOfLines:`12`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# Take 1000 different samples of 500 people each`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`sample_proportions `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` []`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`for`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` _ `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`in`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:` range`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`1000`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`):`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` sample `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` np.random.choice(population, `}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`size`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`500`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`replace`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:`False`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` prop `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` np.mean(sample `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`==`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'A'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` sample_proportions.append(prop)`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`sample_proportions `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` np.array(sample_proportions)`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:`print`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`f`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"Mean of sample proportions: `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`{`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`np.mean(sample_proportions)`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`:.4f}`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:`print`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`f`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"Std of sample proportions: `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`{`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`np.std(sample_proportions)`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`:.4f}`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:`print`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`f`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"True proportion: `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`{`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`true_proportion`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`:.4f}`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`]})})}),`\n`,_jsx(_components.p,{children:_jsx(_components.strong,{children:`Output:`})}),`\n`,_jsx(CodeBlock,{numberOfLines:`4`,language:`text`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`text`,children:_jsxs(_components.code,{language:`text`,numberOfLines:`4`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`Mean of sample proportions: 0.5198`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`Std of sample proportions: 0.0223`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`True proportion: 0.5200`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{})})]})})}),`\n`,_jsxs(_components.p,{children:[`The samples cluster around the true value, and they form a `,_jsx(_components.strong,{children:`normal distribution`}),`.`]}),`\n`,_jsx(Frame,{children:_jsx(OptimizedImage,{src:`https://mintcdn.com/devweeekends/CHfRzoAmD5TGW2ch/images/courses/statistics-for-ml/sampling-distribution-real-world.svg?fit=max\u0026auto=format\u0026n=CHfRzoAmD5TGW2ch\u0026q=85\u0026s=451b3675bfe9ab996a9da7582545ff51`,alt:`Sampling Distribution of Poll Results`,\"data-og-width\":`1080`,width:`1080`,\"data-og-height\":`1080`,height:`1080`,\"data-path\":`images/courses/statistics-for-ml/sampling-distribution-real-world.svg`,\"data-optimize\":`true`,\"data-opv\":`3`,srcset:`https://mintcdn.com/devweeekends/CHfRzoAmD5TGW2ch/images/courses/statistics-for-ml/sampling-distribution-real-world.svg?w=280\u0026fit=max\u0026auto=format\u0026n=CHfRzoAmD5TGW2ch\u0026q=85\u0026s=317f7eedaf4a886e8aa60e34f73b10f1 280w, https://mintcdn.com/devweeekends/CHfRzoAmD5TGW2ch/images/courses/statistics-for-ml/sampling-distribution-real-world.svg?w=560\u0026fit=max\u0026auto=format\u0026n=CHfRzoAmD5TGW2ch\u0026q=85\u0026s=985dbf4c96396c9a00efb70be0aaf046 560w, https://mintcdn.com/devweeekends/CHfRzoAmD5TGW2ch/images/courses/statistics-for-ml/sampling-distribution-real-world.svg?w=840\u0026fit=max\u0026auto=format\u0026n=CHfRzoAmD5TGW2ch\u0026q=85\u0026s=6dcbbd6a140f4e787a92f01b558515ef 840w, https://mintcdn.com/devweeekends/CHfRzoAmD5TGW2ch/images/courses/statistics-for-ml/sampling-distribution-real-world.svg?w=1100\u0026fit=max\u0026auto=format\u0026n=CHfRzoAmD5TGW2ch\u0026q=85\u0026s=5e73f33dee022a3a01017e6b31a138ea 1100w, https://mintcdn.com/devweeekends/CHfRzoAmD5TGW2ch/images/courses/statistics-for-ml/sampling-distribution-real-world.svg?w=1650\u0026fit=max\u0026auto=format\u0026n=CHfRzoAmD5TGW2ch\u0026q=85\u0026s=feac9dedcb3b0713e98dd5a44f9f0e95 1650w, https://mintcdn.com/devweeekends/CHfRzoAmD5TGW2ch/images/courses/statistics-for-ml/sampling-distribution-real-world.svg?w=2500\u0026fit=max\u0026auto=format\u0026n=CHfRzoAmD5TGW2ch\u0026q=85\u0026s=dac49c68d73e98c0c9d29294d8743095 2500w`})}),`\n`,_jsx(_components.hr,{}),`\n`,_jsx(Heading,{level:`2`,id:`standard-error-quantifying-uncertainty`,children:`Standard Error: Quantifying Uncertainty`}),`\n`,_jsxs(_components.p,{children:[`The `,_jsx(_components.strong,{children:`standard error`}),` measures how much sample statistics vary from sample to sample.`]}),`\n`,_jsx(_components.p,{children:`For a proportion:`}),`\n`,_jsx(_components.span,{className:`katex-display`,children:_jsxs(_components.span,{className:`katex`,children:[_jsx(_components.span,{className:`katex-mathml`,children:_jsx(_components.math,{xmlns:`http://www.w3.org/1998/Math/MathML`,display:`block`,children:_jsxs(_components.semantics,{children:[_jsxs(_components.mrow,{children:[_jsx(_components.mi,{children:`S`}),_jsx(_components.mi,{children:`E`}),_jsx(_components.mo,{children:`=`}),_jsx(_components.msqrt,{children:_jsxs(_components.mfrac,{children:[_jsxs(_components.mrow,{children:[_jsx(_components.mi,{children:`p`}),_jsx(_components.mo,{stretchy:`false`,children:`(`}),_jsx(_components.mn,{children:`1`}),_jsx(_components.mo,{children:`−`}),_jsx(_components.mi,{children:`p`}),_jsx(_components.mo,{stretchy:`false`,children:`)`})]}),_jsx(_components.mi,{children:`n`})]})})]}),_jsx(_components.annotation,{encoding:`application/x-tex`,children:`SE = \\\\sqrt{\\\\frac{p(1-p)}{n}}`})]})})}),_jsxs(_components.span,{className:`katex-html`,\"aria-hidden\":`true`,children:[_jsxs(_components.span,{className:`base`,children:[_jsx(_components.span,{className:`strut`,style:{height:`0.6833em`}}),_jsx(_components.span,{className:`mord mathnormal`,style:{marginRight:`0.0576em`},children:`S`}),_jsx(_components.span,{className:`mord mathnormal`,style:{marginRight:`0.0576em`},children:`E`}),_jsx(_components.span,{className:`mspace`,style:{marginRight:`0.2778em`}}),_jsx(_components.span,{className:`mrel`,children:`=`}),_jsx(_components.span,{className:`mspace`,style:{marginRight:`0.2778em`}})]}),_jsxs(_components.span,{className:`base`,children:[_jsx(_components.span,{className:`strut`,style:{height:`2.44em`,verticalAlign:`-0.7356em`}}),_jsx(_components.span,{className:`mord sqrt`,children:_jsxs(_components.span,{className:`vlist-t vlist-t2`,children:[_jsxs(_components.span,{className:`vlist-r`,children:[_jsxs(_components.span,{className:`vlist`,style:{height:`1.7044em`},children:[_jsxs(_components.span,{className:`svg-align`,style:{top:`-4.4em`},children:[_jsx(_components.span,{className:`pstrut`,style:{height:`4.4em`}}),_jsx(_components.span,{className:`mord`,style:{paddingLeft:`1em`},children:_jsxs(_components.span,{className:`mord`,children:[_jsx(_components.span,{className:`mopen nulldelimiter`}),_jsx(_components.span,{className:`mfrac`,children:_jsxs(_components.span,{className:`vlist-t vlist-t2`,children:[_jsxs(_components.span,{className:`vlist-r`,children:[_jsxs(_components.span,{className:`vlist`,style:{height:`1.427em`},children:[_jsxs(_components.span,{style:{top:`-2.314em`},children:[_jsx(_components.span,{className:`pstrut`,style:{height:`3em`}}),_jsx(_components.span,{className:`mord`,children:_jsx(_components.span,{className:`mord mathnormal`,children:`n`})})]}),_jsxs(_components.span,{style:{top:`-3.23em`},children:[_jsx(_components.span,{className:`pstrut`,style:{height:`3em`}}),_jsx(_components.span,{className:`frac-line`,style:{borderBottomWidth:`0.04em`}})]}),_jsxs(_components.span,{style:{top:`-3.677em`},children:[_jsx(_components.span,{className:`pstrut`,style:{height:`3em`}}),_jsxs(_components.span,{className:`mord`,children:[_jsx(_components.span,{className:`mord mathnormal`,children:`p`}),_jsx(_components.span,{className:`mopen`,children:`(`}),_jsx(_components.span,{className:`mord`,children:`1`}),_jsx(_components.span,{className:`mspace`,style:{marginRight:`0.2222em`}}),_jsx(_components.span,{className:`mbin`,children:`−`}),_jsx(_components.span,{className:`mspace`,style:{marginRight:`0.2222em`}}),_jsx(_components.span,{className:`mord mathnormal`,children:`p`}),_jsx(_components.span,{className:`mclose`,children:`)`})]})]})]}),_jsx(_components.span,{className:`vlist-s`,children:``})]}),_jsx(_components.span,{className:`vlist-r`,children:_jsx(_components.span,{className:`vlist`,style:{height:`0.686em`},children:_jsx(_components.span,{})})})]})}),_jsx(_components.span,{className:`mclose nulldelimiter`})]})})]}),_jsxs(_components.span,{style:{top:`-3.6644em`},children:[_jsx(_components.span,{className:`pstrut`,style:{height:`4.4em`}}),_jsx(_components.span,{className:`hide-tail`,style:{minWidth:`1.02em`,height:`2.48em`},children:_jsx(_components.svg,{xmlns:`http://www.w3.org/2000/svg`,width:`400em`,height:`2.48em`,viewBox:`0 0 400000 2592`,preserveAspectRatio:`xMinYMin slice`,children:_jsx(_components.path,{d:`M424,2478\nc-1.3,-0.7,-38.5,-172,-111.5,-514c-73,-342,-109.8,-513.3,-110.5,-514\nc0,-2,-10.7,14.3,-32,49c-4.7,7.3,-9.8,15.7,-15.5,25c-5.7,9.3,-9.8,16,-12.5,20\ns-5,7,-5,7c-4,-3.3,-8.3,-7.7,-13,-13s-13,-13,-13,-13s76,-122,76,-122s77,-121,77,-121\ns209,968,209,968c0,-2,84.7,-361.7,254,-1079c169.3,-717.3,254.7,-1077.7,256,-1081\nl0 -0c4,-6.7,10,-10,18,-10 H400000\nv40H1014.6\ns-87.3,378.7,-272.6,1166c-185.3,787.3,-279.3,1182.3,-282,1185\nc-2,6,-10,9,-24,9\nc-8,0,-12,-0.7,-12,-2z M1001 80\nh400000v40h-400000z`})})})]})]}),_jsx(_components.span,{className:`vlist-s`,children:``})]}),_jsx(_components.span,{className:`vlist-r`,children:_jsx(_components.span,{className:`vlist`,style:{height:`0.7356em`},children:_jsx(_components.span,{})})})]})})]})]})]})}),`\n`,_jsx(_components.p,{children:`For a mean:`}),`\n`,_jsx(_components.span,{className:`katex-display`,children:_jsxs(_components.span,{className:`katex`,children:[_jsx(_components.span,{className:`katex-mathml`,children:_jsx(_components.math,{xmlns:`http://www.w3.org/1998/Math/MathML`,display:`block`,children:_jsxs(_components.semantics,{children:[_jsxs(_components.mrow,{children:[_jsx(_components.mi,{children:`S`}),_jsx(_components.mi,{children:`E`}),_jsx(_components.mo,{children:`=`}),_jsxs(_components.mfrac,{children:[_jsx(_components.mi,{children:`σ`}),_jsx(_components.msqrt,{children:_jsx(_components.mi,{children:`n`})})]})]}),_jsx(_components.annotation,{encoding:`application/x-tex`,children:`SE = \\\\frac{\\\\sigma}{\\\\sqrt{n}}`})]})})}),_jsxs(_components.span,{className:`katex-html`,\"aria-hidden\":`true`,children:[_jsxs(_components.span,{className:`base`,children:[_jsx(_components.span,{className:`strut`,style:{height:`0.6833em`}}),_jsx(_components.span,{className:`mord mathnormal`,style:{marginRight:`0.0576em`},children:`S`}),_jsx(_components.span,{className:`mord mathnormal`,style:{marginRight:`0.0576em`},children:`E`}),_jsx(_components.span,{className:`mspace`,style:{marginRight:`0.2778em`}}),_jsx(_components.span,{className:`mrel`,children:`=`}),_jsx(_components.span,{className:`mspace`,style:{marginRight:`0.2778em`}})]}),_jsxs(_components.span,{className:`base`,children:[_jsx(_components.span,{className:`strut`,style:{height:`2.0376em`,verticalAlign:`-0.93em`}}),_jsxs(_components.span,{className:`mord`,children:[_jsx(_components.span,{className:`mopen nulldelimiter`}),_jsx(_components.span,{className:`mfrac`,children:_jsxs(_components.span,{className:`vlist-t vlist-t2`,children:[_jsxs(_components.span,{className:`vlist-r`,children:[_jsxs(_components.span,{className:`vlist`,style:{height:`1.1076em`},children:[_jsxs(_components.span,{style:{top:`-2.3097em`},children:[_jsx(_components.span,{className:`pstrut`,style:{height:`3em`}}),_jsx(_components.span,{className:`mord`,children:_jsx(_components.span,{className:`mord sqrt`,children:_jsxs(_components.span,{className:`vlist-t vlist-t2`,children:[_jsxs(_components.span,{className:`vlist-r`,children:[_jsxs(_components.span,{className:`vlist`,style:{height:`0.8003em`},children:[_jsxs(_components.span,{className:`svg-align`,style:{top:`-3em`},children:[_jsx(_components.span,{className:`pstrut`,style:{height:`3em`}}),_jsx(_components.span,{className:`mord`,style:{paddingLeft:`0.833em`},children:_jsx(_components.span,{className:`mord mathnormal`,children:`n`})})]}),_jsxs(_components.span,{style:{top:`-2.7603em`},children:[_jsx(_components.span,{className:`pstrut`,style:{height:`3em`}}),_jsx(_components.span,{className:`hide-tail`,style:{minWidth:`0.853em`,height:`1.08em`},children:_jsx(_components.svg,{xmlns:`http://www.w3.org/2000/svg`,width:`400em`,height:`1.08em`,viewBox:`0 0 400000 1080`,preserveAspectRatio:`xMinYMin slice`,children:_jsx(_components.path,{d:`M95,702\nc-2.7,0,-7.17,-2.7,-13.5,-8c-5.8,-5.3,-9.5,-10,-9.5,-14\nc0,-2,0.3,-3.3,1,-4c1.3,-2.7,23.83,-20.7,67.5,-54\nc44.2,-33.3,65.8,-50.3,66.5,-51c1.3,-1.3,3,-2,5,-2c4.7,0,8.7,3.3,12,10\ns173,378,173,378c0.7,0,35.3,-71,104,-213c68.7,-142,137.5,-285,206.5,-429\nc69,-144,104.5,-217.7,106.5,-221\nl0 -0\nc5.3,-9.3,12,-14,20,-14\nH400000v40H845.2724\ns-225.272,467,-225.272,467s-235,486,-235,486c-2.7,4.7,-9,7,-19,7\nc-6,0,-10,-1,-12,-3s-194,-422,-194,-422s-65,47,-65,47z\nM834 80h400000v40h-400000z`})})})]})]}),_jsx(_components.span,{className:`vlist-s`,children:``})]}),_jsx(_components.span,{className:`vlist-r`,children:_jsx(_components.span,{className:`vlist`,style:{height:`0.2397em`},children:_jsx(_components.span,{})})})]})})})]}),_jsxs(_components.span,{style:{top:`-3.23em`},children:[_jsx(_components.span,{className:`pstrut`,style:{height:`3em`}}),_jsx(_components.span,{className:`frac-line`,style:{borderBottomWidth:`0.04em`}})]}),_jsxs(_components.span,{style:{top:`-3.677em`},children:[_jsx(_components.span,{className:`pstrut`,style:{height:`3em`}}),_jsx(_components.span,{className:`mord`,children:_jsx(_components.span,{className:`mord mathnormal`,style:{marginRight:`0.0359em`},children:`σ`})})]})]}),_jsx(_components.span,{className:`vlist-s`,children:``})]}),_jsx(_components.span,{className:`vlist-r`,children:_jsx(_components.span,{className:`vlist`,style:{height:`0.93em`},children:_jsx(_components.span,{})})})]})}),_jsx(_components.span,{className:`mclose nulldelimiter`})]})]})]})]})}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`15`,language:`python`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`python`,children:_jsxs(_components.code,{language:`python`,numberOfLines:`15`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`def`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` standard_error_proportion`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`p`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`n`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`):`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"\"\"Standard error for a sample proportion.\"\"\"`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` return`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` np.sqrt(p `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`*`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`1`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` -`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` p) `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`/`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` n)`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`def`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` standard_error_mean`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`std_dev`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`n`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`):`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"\"\"Standard error for a sample mean.\"\"\"`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` return`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` std_dev `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`/`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` np.sqrt(n)`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# Example: Poll with 52% for candidate A, n=1000`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`se `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` standard_error_proportion(`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`0.52`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`1000`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:`print`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`f`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"Standard error: `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`{`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`se`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`:.4f}`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) `}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# 0.0158 or about 1.58%`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# With larger sample`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`se_large `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` standard_error_proportion(`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`0.52`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`4000`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:`print`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`f`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"SE with n=4000: `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`{`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`se_large`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`:.4f}`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) `}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# 0.0079 or about 0.79%`})]}),`\n`]})})}),`\n`,_jsxs(_components.p,{children:[_jsx(_components.strong,{children:`Key Insight`}),`: Standard error decreases with square root of sample size. To halve the error, you need 4x the sample size.`]}),`\n`,_jsxs(_components.p,{children:[_jsx(_components.strong,{children:`Analogy`}),`: Think of standard error as the “blurriness” of a photograph. More data is like more megapixels — the picture gets sharper. But the improvement is diminishing: going from 100 to 400 data points (4x) only cuts the blur in half. Going from 400 to 1,600 (another 4x) cuts it in half again. This is why data scientists obsess over whether more data is actually worth the collection cost.`]}),`\n`,_jsx(Warning,{children:_jsxs(_components.p,{children:[_jsx(_components.strong,{children:`Statistical Mistake in ML — Trusting Small Validation Sets`}),`: If you evaluate your model on a test set of only 50 samples and report “95% accuracy,” the standard error is roughly sqrt(0.95 times 0.05 / 50) = 3.1%. Your true accuracy could easily be anywhere from 89% to 100%. With 500 samples, that error drops to about 1%. Always compute confidence intervals around your ML metrics, especially when comparing models. A “2% improvement” on a small test set is often statistical noise.`]})}),`\n`,_jsx(_components.hr,{}),`\n`,_jsx(Heading,{level:`2`,id:`confidence-intervals-expressing-uncertainty`,children:`Confidence Intervals: Expressing Uncertainty`}),`\n`,_jsxs(_components.p,{children:[`A `,_jsx(_components.strong,{children:`confidence interval`}),` gives a range of plausible values for the true parameter.`]}),`\n`,_jsx(Heading,{level:`3`,id:`the-formula`,children:`The Formula`}),`\n`,_jsx(_components.p,{children:`For a proportion with 95% confidence:`}),`\n`,_jsx(_components.span,{className:`katex-display`,children:_jsxs(_components.span,{className:`katex`,children:[_jsx(_components.span,{className:`katex-mathml`,children:_jsx(_components.math,{xmlns:`http://www.w3.org/1998/Math/MathML`,display:`block`,children:_jsxs(_components.semantics,{children:[_jsxs(_components.mrow,{children:[_jsxs(_components.mover,{accent:`true`,children:[_jsx(_components.mi,{children:`p`}),_jsx(_components.mo,{children:`^`})]}),_jsx(_components.mo,{children:`±`}),_jsxs(_components.msup,{children:[_jsx(_components.mi,{children:`z`}),_jsx(_components.mo,{children:`∗`})]}),_jsx(_components.mo,{children:`⋅`}),_jsx(_components.mi,{children:`S`}),_jsx(_components.mi,{children:`E`}),_jsx(_components.mo,{children:`=`}),_jsxs(_components.mover,{accent:`true`,children:[_jsx(_components.mi,{children:`p`}),_jsx(_components.mo,{children:`^`})]}),_jsx(_components.mo,{children:`±`}),_jsx(_components.mn,{children:`1.96`}),_jsx(_components.mo,{children:`⋅`}),_jsx(_components.msqrt,{children:_jsxs(_components.mfrac,{children:[_jsxs(_components.mrow,{children:[_jsxs(_components.mover,{accent:`true`,children:[_jsx(_components.mi,{children:`p`}),_jsx(_components.mo,{children:`^`})]}),_jsx(_components.mo,{stretchy:`false`,children:`(`}),_jsx(_components.mn,{children:`1`}),_jsx(_components.mo,{children:`−`}),_jsxs(_components.mover,{accent:`true`,children:[_jsx(_components.mi,{children:`p`}),_jsx(_components.mo,{children:`^`})]}),_jsx(_components.mo,{stretchy:`false`,children:`)`})]}),_jsx(_components.mi,{children:`n`})]})})]}),_jsx(_components.annotation,{encoding:`application/x-tex`,children:`\\\\hat{p} \\\\pm z^* \\\\cdot SE = \\\\hat{p} \\\\pm 1.96 \\\\cdot \\\\sqrt{\\\\frac{\\\\hat{p}(1-\\\\hat{p})}{n}}`})]})})}),_jsxs(_components.span,{className:`katex-html`,\"aria-hidden\":`true`,children:[_jsxs(_components.span,{className:`base`,children:[_jsx(_components.span,{className:`strut`,style:{height:`0.8889em`,verticalAlign:`-0.1944em`}}),_jsx(_components.span,{className:`mord accent`,children:_jsxs(_components.span,{className:`vlist-t vlist-t2`,children:[_jsxs(_components.span,{className:`vlist-r`,children:[_jsxs(_components.span,{className:`vlist`,style:{height:`0.6944em`},children:[_jsxs(_components.span,{style:{top:`-3em`},children:[_jsx(_components.span,{className:`pstrut`,style:{height:`3em`}}),_jsx(_components.span,{className:`mord mathnormal`,children:`p`})]}),_jsxs(_components.span,{style:{top:`-3em`},children:[_jsx(_components.span,{className:`pstrut`,style:{height:`3em`}}),_jsx(_components.span,{className:`accent-body`,style:{left:`-0.1667em`},children:_jsx(_components.span,{className:`mord`,children:`^`})})]})]}),_jsx(_components.span,{className:`vlist-s`,children:``})]}),_jsx(_components.span,{className:`vlist-r`,children:_jsx(_components.span,{className:`vlist`,style:{height:`0.1944em`},children:_jsx(_components.span,{})})})]})}),_jsx(_components.span,{className:`mspace`,style:{marginRight:`0.2222em`}}),_jsx(_components.span,{className:`mbin`,children:`±`}),_jsx(_components.span,{className:`mspace`,style:{marginRight:`0.2222em`}})]}),_jsxs(_components.span,{className:`base`,children:[_jsx(_components.span,{className:`strut`,style:{height:`0.7387em`}}),_jsxs(_components.span,{className:`mord`,children:[_jsx(_components.span,{className:`mord mathnormal`,style:{marginRight:`0.044em`},children:`z`}),_jsx(_components.span,{className:`msupsub`,children:_jsx(_components.span,{className:`vlist-t`,children:_jsx(_components.span,{className:`vlist-r`,children:_jsx(_components.span,{className:`vlist`,style:{height:`0.7387em`},children:_jsxs(_components.span,{style:{top:`-3.113em`,marginRight:`0.05em`},children:[_jsx(_components.span,{className:`pstrut`,style:{height:`2.7em`}}),_jsx(_components.span,{className:`sizing reset-size6 size3 mtight`,children:_jsx(_components.span,{className:`mbin mtight`,children:`∗`})})]})})})})})]}),_jsx(_components.span,{className:`mspace`,style:{marginRight:`0.2222em`}}),_jsx(_components.span,{className:`mbin`,children:`⋅`}),_jsx(_components.span,{className:`mspace`,style:{marginRight:`0.2222em`}})]}),_jsxs(_components.span,{className:`base`,children:[_jsx(_components.span,{className:`strut`,style:{height:`0.6833em`}}),_jsx(_components.span,{className:`mord mathnormal`,style:{marginRight:`0.0576em`},children:`S`}),_jsx(_components.span,{className:`mord mathnormal`,style:{marginRight:`0.0576em`},children:`E`}),_jsx(_components.span,{className:`mspace`,style:{marginRight:`0.2778em`}}),_jsx(_components.span,{className:`mrel`,children:`=`}),_jsx(_components.span,{className:`mspace`,style:{marginRight:`0.2778em`}})]}),_jsxs(_components.span,{className:`base`,children:[_jsx(_components.span,{className:`strut`,style:{height:`0.8889em`,verticalAlign:`-0.1944em`}}),_jsx(_components.span,{className:`mord accent`,children:_jsxs(_components.span,{className:`vlist-t vlist-t2`,children:[_jsxs(_components.span,{className:`vlist-r`,children:[_jsxs(_components.span,{className:`vlist`,style:{height:`0.6944em`},children:[_jsxs(_components.span,{style:{top:`-3em`},children:[_jsx(_components.span,{className:`pstrut`,style:{height:`3em`}}),_jsx(_components.span,{className:`mord mathnormal`,children:`p`})]}),_jsxs(_components.span,{style:{top:`-3em`},children:[_jsx(_components.span,{className:`pstrut`,style:{height:`3em`}}),_jsx(_components.span,{className:`accent-body`,style:{left:`-0.1667em`},children:_jsx(_components.span,{className:`mord`,children:`^`})})]})]}),_jsx(_components.span,{className:`vlist-s`,children:``})]}),_jsx(_components.span,{className:`vlist-r`,children:_jsx(_components.span,{className:`vlist`,style:{height:`0.1944em`},children:_jsx(_components.span,{})})})]})}),_jsx(_components.span,{className:`mspace`,style:{marginRight:`0.2222em`}}),_jsx(_components.span,{className:`mbin`,children:`±`}),_jsx(_components.span,{className:`mspace`,style:{marginRight:`0.2222em`}})]}),_jsxs(_components.span,{className:`base`,children:[_jsx(_components.span,{className:`strut`,style:{height:`0.6444em`}}),_jsx(_components.span,{className:`mord`,children:`1.96`}),_jsx(_components.span,{className:`mspace`,style:{marginRight:`0.2222em`}}),_jsx(_components.span,{className:`mbin`,children:`⋅`}),_jsx(_components.span,{className:`mspace`,style:{marginRight:`0.2222em`}})]}),_jsxs(_components.span,{className:`base`,children:[_jsx(_components.span,{className:`strut`,style:{height:`2.44em`,verticalAlign:`-0.7356em`}}),_jsx(_components.span,{className:`mord sqrt`,children:_jsxs(_components.span,{className:`vlist-t vlist-t2`,children:[_jsxs(_components.span,{className:`vlist-r`,children:[_jsxs(_components.span,{className:`vlist`,style:{height:`1.7044em`},children:[_jsxs(_components.span,{className:`svg-align`,style:{top:`-4.4em`},children:[_jsx(_components.span,{className:`pstrut`,style:{height:`4.4em`}}),_jsx(_components.span,{className:`mord`,style:{paddingLeft:`1em`},children:_jsxs(_components.span,{className:`mord`,children:[_jsx(_components.span,{className:`mopen nulldelimiter`}),_jsx(_components.span,{className:`mfrac`,children:_jsxs(_components.span,{className:`vlist-t vlist-t2`,children:[_jsxs(_components.span,{className:`vlist-r`,children:[_jsxs(_components.span,{className:`vlist`,style:{height:`1.427em`},children:[_jsxs(_components.span,{style:{top:`-2.314em`},children:[_jsx(_components.span,{className:`pstrut`,style:{height:`3em`}}),_jsx(_components.span,{className:`mord`,children:_jsx(_components.span,{className:`mord mathnormal`,children:`n`})})]}),_jsxs(_components.span,{style:{top:`-3.23em`},children:[_jsx(_components.span,{className:`pstrut`,style:{height:`3em`}}),_jsx(_components.span,{className:`frac-line`,style:{borderBottomWidth:`0.04em`}})]}),_jsxs(_components.span,{style:{top:`-3.677em`},children:[_jsx(_components.span,{className:`pstrut`,style:{height:`3em`}}),_jsxs(_components.span,{className:`mord`,children:[_jsx(_components.span,{className:`mord accent`,children:_jsxs(_components.span,{className:`vlist-t vlist-t2`,children:[_jsxs(_components.span,{className:`vlist-r`,children:[_jsxs(_components.span,{className:`vlist`,style:{height:`0.6944em`},children:[_jsxs(_components.span,{style:{top:`-3em`},children:[_jsx(_components.span,{className:`pstrut`,style:{height:`3em`}}),_jsx(_components.span,{className:`mord mathnormal`,children:`p`})]}),_jsxs(_components.span,{style:{top:`-3em`},children:[_jsx(_components.span,{className:`pstrut`,style:{height:`3em`}}),_jsx(_components.span,{className:`accent-body`,style:{left:`-0.1667em`},children:_jsx(_components.span,{className:`mord`,children:`^`})})]})]}),_jsx(_components.span,{className:`vlist-s`,children:``})]}),_jsx(_components.span,{className:`vlist-r`,children:_jsx(_components.span,{className:`vlist`,style:{height:`0.1944em`},children:_jsx(_components.span,{})})})]})}),_jsx(_components.span,{className:`mopen`,children:`(`}),_jsx(_components.span,{className:`mord`,children:`1`}),_jsx(_components.span,{className:`mspace`,style:{marginRight:`0.2222em`}}),_jsx(_components.span,{className:`mbin`,children:`−`}),_jsx(_components.span,{className:`mspace`,style:{marginRight:`0.2222em`}}),_jsx(_components.span,{className:`mord accent`,children:_jsxs(_components.span,{className:`vlist-t vlist-t2`,children:[_jsxs(_components.span,{className:`vlist-r`,children:[_jsxs(_components.span,{className:`vlist`,style:{height:`0.6944em`},children:[_jsxs(_components.span,{style:{top:`-3em`},children:[_jsx(_components.span,{className:`pstrut`,style:{height:`3em`}}),_jsx(_components.span,{className:`mord mathnormal`,children:`p`})]}),_jsxs(_components.span,{style:{top:`-3em`},children:[_jsx(_components.span,{className:`pstrut`,style:{height:`3em`}}),_jsx(_components.span,{className:`accent-body`,style:{left:`-0.1667em`},children:_jsx(_components.span,{className:`mord`,children:`^`})})]})]}),_jsx(_components.span,{className:`vlist-s`,children:``})]}),_jsx(_components.span,{className:`vlist-r`,children:_jsx(_components.span,{className:`vlist`,style:{height:`0.1944em`},children:_jsx(_components.span,{})})})]})}),_jsx(_components.span,{className:`mclose`,children:`)`})]})]})]}),_jsx(_components.span,{className:`vlist-s`,children:``})]}),_jsx(_components.span,{className:`vlist-r`,children:_jsx(_components.span,{className:`vlist`,style:{height:`0.686em`},children:_jsx(_components.span,{})})})]})}),_jsx(_components.span,{className:`mclose nulldelimiter`})]})})]}),_jsxs(_components.span,{style:{top:`-3.6644em`},children:[_jsx(_components.span,{className:`pstrut`,style:{height:`4.4em`}}),_jsx(_components.span,{className:`hide-tail`,style:{minWidth:`1.02em`,height:`2.48em`},children:_jsx(_components.svg,{xmlns:`http://www.w3.org/2000/svg`,width:`400em`,height:`2.48em`,viewBox:`0 0 400000 2592`,preserveAspectRatio:`xMinYMin slice`,children:_jsx(_components.path,{d:`M424,2478\nc-1.3,-0.7,-38.5,-172,-111.5,-514c-73,-342,-109.8,-513.3,-110.5,-514\nc0,-2,-10.7,14.3,-32,49c-4.7,7.3,-9.8,15.7,-15.5,25c-5.7,9.3,-9.8,16,-12.5,20\ns-5,7,-5,7c-4,-3.3,-8.3,-7.7,-13,-13s-13,-13,-13,-13s76,-122,76,-122s77,-121,77,-121\ns209,968,209,968c0,-2,84.7,-361.7,254,-1079c169.3,-717.3,254.7,-1077.7,256,-1081\nl0 -0c4,-6.7,10,-10,18,-10 H400000\nv40H1014.6\ns-87.3,378.7,-272.6,1166c-185.3,787.3,-279.3,1182.3,-282,1185\nc-2,6,-10,9,-24,9\nc-8,0,-12,-0.7,-12,-2z M1001 80\nh400000v40h-400000z`})})})]})]}),_jsx(_components.span,{className:`vlist-s`,children:``})]}),_jsx(_components.span,{className:`vlist-r`,children:_jsx(_components.span,{className:`vlist`,style:{height:`0.7356em`},children:_jsx(_components.span,{})})})]})})]})]})]})}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`23`,language:`python`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`python`,children:_jsxs(_components.code,{language:`python`,numberOfLines:`23`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`from`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` scipy `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` stats`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`def`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` confidence_interval_proportion`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`p_hat`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`n`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`confidence`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`0.95`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`):`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"\"\"Calculate confidence interval for a proportion.\"\"\"`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` # Z-score for desired confidence level`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` z `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` stats.norm.ppf((`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`1`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` +`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` confidence) `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`/`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 2`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` `})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` # Standard error`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` se `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` np.sqrt(p_hat `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`*`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`1`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` -`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` p_hat) `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`/`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` n)`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` `})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` # Margin of error`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` moe `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` z `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`*`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` se`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` `})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` return`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (p_hat `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`-`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` moe, p_hat `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`+`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` moe), moe`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# Poll result: 52% with n=1000`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`p_hat `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 0.52`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`n `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 1000`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`ci, moe `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` confidence_interval_proportion(p_hat, n)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:`print`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`f`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"Point estimate: `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`{`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`p_hat`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`:.1%}`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:`print`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`f`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"Margin of error: ±`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`{`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`moe`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`:.1%}`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:`print`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`f`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"95% CI: (`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`{`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`ci[`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`0`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`]`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`:.1%}`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`, `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`{`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`ci[`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`1`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`]`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`:.1%}`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`)\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`]})})}),`\n`,_jsx(_components.p,{children:_jsx(_components.strong,{children:`Output:`})}),`\n`,_jsx(CodeBlock,{numberOfLines:`4`,language:`text`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`text`,children:_jsxs(_components.code,{language:`text`,numberOfLines:`4`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`Point estimate: 52.0%`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`Margin of error: ±3.1%`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`95% CI: (48.9%, 55.1%)`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{})})]})})}),`\n`,_jsx(Heading,{level:`3`,id:`what-does-“95%-confidence”-mean`,children:`What Does “95% Confidence” Mean?`}),`\n`,_jsx(_components.p,{children:`It does NOT mean “95% probability the true value is in this interval.”`}),`\n`,_jsx(_components.p,{children:`It means: If we repeated this process many times, 95% of the intervals we construct would contain the true value.`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`18`,language:`python`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`python`,children:_jsxs(_components.code,{language:`python`,numberOfLines:`18`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# Demonstrate: Create 100 confidence intervals`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`intervals_containing_truth `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 0`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`true_p `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 0.52`}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` # Known true value (in real life, unknown)`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`for`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` _ `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`in`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:` range`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`100`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`):`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` # Take a sample`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` sample `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` np.random.choice([`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'A'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'B'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`], `}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`size`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`1000`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`p`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`[true_p, `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`1`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`-`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`true_p])`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` p_hat `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` np.mean(sample `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`==`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'A'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` `})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` # Calculate CI`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` ci, _ `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` confidence_interval_proportion(p_hat, `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`1000`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` `})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` # Check if CI contains true value`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` if`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` ci[`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`0`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`] `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`\u003c=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` true_p `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`\u003c=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` ci[`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`1`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`]:`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` intervals_containing_truth `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`+=`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 1`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:`print`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`f`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`{`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`intervals_containing_truth`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`}`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`% of intervals contained the true value\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# Should be close to 95!`})}),`\n`]})})}),`\n`,_jsx(_components.hr,{}),`\n`,_jsx(Heading,{level:`2`,id:`confidence-intervals-for-means`,children:`Confidence Intervals for Means`}),`\n`,_jsx(_components.p,{children:`When estimating an average (like average house price):`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`23`,language:`python`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`python`,children:_jsxs(_components.code,{language:`python`,numberOfLines:`23`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`def`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` confidence_interval_mean`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`data`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`confidence`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`0.95`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`):`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"\"\"Calculate confidence interval for a mean using t-distribution.\"\"\"`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` n `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:` len`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(data)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` mean `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` np.mean(data)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` std_err `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` stats.sem(data) `}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# Standard error of the mean`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` `})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` # Use t-distribution for small samples`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` t_crit `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` stats.t.ppf((`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`1`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` +`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` confidence) `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`/`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 2`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`df`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`n`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`-`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`1`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` `})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` moe `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` t_crit `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`*`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` std_err`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` return`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (mean `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`-`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` moe, mean `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`+`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` moe), moe`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# Example: House prices (in thousands)`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`house_prices `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` np.array([`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 425`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`389`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`445`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`520`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`478`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`395`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`510`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`462`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`398`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`485`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 512`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`445`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`468`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`502`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`389`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`475`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`498`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`415`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`528`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`459`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 442`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`495`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`478`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`410`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`525`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`465`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`488`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`435`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`505`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`472`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`])`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`ci, moe `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` confidence_interval_mean(house_prices)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:`print`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`f`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"Sample mean: $`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`{`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`np.mean(house_prices)`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`:.1f}`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`K\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:`print`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`f`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"Margin of error: ±$`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`{`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`moe`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`:.1f}`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`K\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:`print`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`f`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"95% CI: ($`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`{`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`ci[`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`0`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`]`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`:.1f}`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`K, $`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`{`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`ci[`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`1`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`]`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`:.1f}`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`K)\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`]})})}),`\n`,_jsx(_components.p,{children:_jsx(_components.strong,{children:`Output:`})}),`\n`,_jsx(CodeBlock,{numberOfLines:`4`,language:`text`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`text`,children:_jsxs(_components.code,{language:`text`,numberOfLines:`4`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`Sample mean: $463.5K`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`Margin of error: ±$15.1K`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`95% CI: ($448.4K, $478.6K)`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{})})]})})}),`\n`,_jsx(_components.hr,{}),`\n`,_jsx(Heading,{level:`2`,id:`thet-distribution-for-small-samples`,children:`The t-Distribution: For Small Samples`}),`\n`,_jsxs(_components.p,{children:[`When sample size is small (n \u003c 30), we use the `,_jsx(_components.strong,{children:`t-distribution`}),` instead of the normal distribution.`]}),`\n`,_jsx(_components.p,{children:`Why? Small samples have more uncertainty about the true standard deviation.`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`16`,language:`python`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`python`,children:_jsxs(_components.code,{language:`python`,numberOfLines:`16`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# Compare t and normal distributions`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`x `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` np.linspace(`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`-`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`4`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`4`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`1000`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`normal `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` stats.norm.pdf(x)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`t_5 `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` stats.t.pdf(x, `}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`df`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`5`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) `}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# 5 degrees of freedom`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`t_30 `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` stats.t.pdf(x, `}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`df`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`30`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) `}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# 30 degrees of freedom`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` matplotlib.pyplot `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`as`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` plt`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`plt.figure(`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`figsize`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`10`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`5`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`))`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`plt.plot(x, normal, `}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`label`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'Normal'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`linewidth`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`2`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`plt.plot(x, t_5, `}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`label`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'t (df=5)'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`linestyle`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'--'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`linewidth`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`2`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`plt.plot(x, t_30, `}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`label`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'t (df=30)'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`linestyle`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`':'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`linewidth`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`2`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`plt.xlabel(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'x'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`plt.ylabel(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'Density'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`plt.title(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'Normal vs t-Distribution'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`plt.legend()`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`plt.show()`})}),`\n`]})})}),`\n`,_jsx(_components.p,{children:`The t-distribution has heavier tails, meaning it accounts for more uncertainty. As sample size increases, it approaches the normal distribution.`}),`\n`,_jsx(_components.hr,{}),`\n`,_jsx(Heading,{level:`2`,id:`sample-size-planning`,children:`Sample Size Planning`}),`\n`,_jsx(_components.p,{children:`How large a sample do you need? It depends on:`}),`\n`,_jsxs(_components.ol,{children:[`\n`,_jsx(_components.li,{children:`Desired margin of error`}),`\n`,_jsx(_components.li,{children:`Desired confidence level`}),`\n`,_jsx(_components.li,{children:`Expected variability`}),`\n`]}),`\n`,_jsx(Heading,{level:`3`,id:`for-proportions`,children:`For Proportions`}),`\n`,_jsx(_components.span,{className:`katex-display`,children:_jsxs(_components.span,{className:`katex`,children:[_jsx(_components.span,{className:`katex-mathml`,children:_jsx(_components.math,{xmlns:`http://www.w3.org/1998/Math/MathML`,display:`block`,children:_jsxs(_components.semantics,{children:[_jsxs(_components.mrow,{children:[_jsx(_components.mi,{children:`n`}),_jsx(_components.mo,{children:`=`}),_jsxs(_components.msup,{children:[_jsxs(_components.mrow,{children:[_jsx(_components.mo,{fence:`true`,children:`(`}),_jsxs(_components.mfrac,{children:[_jsxs(_components.msup,{children:[_jsx(_components.mi,{children:`z`}),_jsx(_components.mo,{children:`∗`})]}),_jsxs(_components.mrow,{children:[_jsx(_components.mi,{children:`M`}),_jsx(_components.mi,{children:`O`}),_jsx(_components.mi,{children:`E`})]})]}),_jsx(_components.mo,{fence:`true`,children:`)`})]}),_jsx(_components.mn,{children:`2`})]}),_jsx(_components.mo,{children:`⋅`}),_jsx(_components.mi,{children:`p`}),_jsx(_components.mo,{stretchy:`false`,children:`(`}),_jsx(_components.mn,{children:`1`}),_jsx(_components.mo,{children:`−`}),_jsx(_components.mi,{children:`p`}),_jsx(_components.mo,{stretchy:`false`,children:`)`})]}),_jsx(_components.annotation,{encoding:`application/x-tex`,children:`n = \\\\left(\\\\frac{z^*}{MOE}\\\\right)^2 \\\\cdot p(1-p)`})]})})}),_jsxs(_components.span,{className:`katex-html`,\"aria-hidden\":`true`,children:[_jsxs(_components.span,{className:`base`,children:[_jsx(_components.span,{className:`strut`,style:{height:`0.4306em`}}),_jsx(_components.span,{className:`mord mathnormal`,children:`n`}),_jsx(_components.span,{className:`mspace`,style:{marginRight:`0.2778em`}}),_jsx(_components.span,{className:`mrel`,children:`=`}),_jsx(_components.span,{className:`mspace`,style:{marginRight:`0.2778em`}})]}),_jsxs(_components.span,{className:`base`,children:[_jsx(_components.span,{className:`strut`,style:{height:`2.604em`,verticalAlign:`-0.95em`}}),_jsxs(_components.span,{className:`minner`,children:[_jsxs(_components.span,{className:`minner`,children:[_jsx(_components.span,{className:`mopen delimcenter`,style:{top:`0em`},children:_jsx(_components.span,{className:`delimsizing size3`,children:`(`})}),_jsxs(_components.span,{className:`mord`,children:[_jsx(_components.span,{className:`mopen nulldelimiter`}),_jsx(_components.span,{className:`mfrac`,children:_jsxs(_components.span,{className:`vlist-t vlist-t2`,children:[_jsxs(_components.span,{className:`vlist-r`,children:[_jsxs(_components.span,{className:`vlist`,style:{height:`1.3657em`},children:[_jsxs(_components.span,{style:{top:`-2.314em`},children:[_jsx(_components.span,{className:`pstrut`,style:{height:`3em`}}),_jsxs(_components.span,{className:`mord`,children:[_jsx(_components.span,{className:`mord mathnormal`,style:{marginRight:`0.109em`},children:`M`}),_jsx(_components.span,{className:`mord mathnormal`,style:{marginRight:`0.0278em`},children:`O`}),_jsx(_components.span,{className:`mord mathnormal`,style:{marginRight:`0.0576em`},children:`E`})]})]}),_jsxs(_components.span,{style:{top:`-3.23em`},children:[_jsx(_components.span,{className:`pstrut`,style:{height:`3em`}}),_jsx(_components.span,{className:`frac-line`,style:{borderBottomWidth:`0.04em`}})]}),_jsxs(_components.span,{style:{top:`-3.677em`},children:[_jsx(_components.span,{className:`pstrut`,style:{height:`3em`}}),_jsx(_components.span,{className:`mord`,children:_jsxs(_components.span,{className:`mord`,children:[_jsx(_components.span,{className:`mord mathnormal`,style:{marginRight:`0.044em`},children:`z`}),_jsx(_components.span,{className:`msupsub`,children:_jsx(_components.span,{className:`vlist-t`,children:_jsx(_components.span,{className:`vlist-r`,children:_jsx(_components.span,{className:`vlist`,style:{height:`0.6887em`},children:_jsxs(_components.span,{style:{top:`-3.063em`,marginRight:`0.05em`},children:[_jsx(_components.span,{className:`pstrut`,style:{height:`2.7em`}}),_jsx(_components.span,{className:`sizing reset-size6 size3 mtight`,children:_jsx(_components.span,{className:`mbin mtight`,children:`∗`})})]})})})})})]})})]})]}),_jsx(_components.span,{className:`vlist-s`,children:``})]}),_jsx(_components.span,{className:`vlist-r`,children:_jsx(_components.span,{className:`vlist`,style:{height:`0.686em`},children:_jsx(_components.span,{})})})]})}),_jsx(_components.span,{className:`mclose nulldelimiter`})]}),_jsx(_components.span,{className:`mclose delimcenter`,style:{top:`0em`},children:_jsx(_components.span,{className:`delimsizing size3`,children:`)`})})]}),_jsx(_components.span,{className:`msupsub`,children:_jsx(_components.span,{className:`vlist-t`,children:_jsx(_components.span,{className:`vlist-r`,children:_jsx(_components.span,{className:`vlist`,style:{height:`1.654em`},children:_jsxs(_components.span,{style:{top:`-3.9029em`,marginRight:`0.05em`},children:[_jsx(_components.span,{className:`pstrut`,style:{height:`2.7em`}}),_jsx(_components.span,{className:`sizing reset-size6 size3 mtight`,children:_jsx(_components.span,{className:`mord mtight`,children:`2`})})]})})})})})]}),_jsx(_components.span,{className:`mspace`,style:{marginRight:`0.2222em`}}),_jsx(_components.span,{className:`mbin`,children:`⋅`}),_jsx(_components.span,{className:`mspace`,style:{marginRight:`0.2222em`}})]}),_jsxs(_components.span,{className:`base`,children:[_jsx(_components.span,{className:`strut`,style:{height:`1em`,verticalAlign:`-0.25em`}}),_jsx(_components.span,{className:`mord mathnormal`,children:`p`}),_jsx(_components.span,{className:`mopen`,children:`(`}),_jsx(_components.span,{className:`mord`,children:`1`}),_jsx(_components.span,{className:`mspace`,style:{marginRight:`0.2222em`}}),_jsx(_components.span,{className:`mbin`,children:`−`}),_jsx(_components.span,{className:`mspace`,style:{marginRight:`0.2222em`}})]}),_jsxs(_components.span,{className:`base`,children:[_jsx(_components.span,{className:`strut`,style:{height:`1em`,verticalAlign:`-0.25em`}}),_jsx(_components.span,{className:`mord mathnormal`,children:`p`}),_jsx(_components.span,{className:`mclose`,children:`)`})]})]})]})}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`15`,language:`python`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`python`,children:_jsxs(_components.code,{language:`python`,numberOfLines:`15`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`def`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` sample_size_proportion`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`moe`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`p`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`0.5`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`confidence`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`0.95`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`):`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"\"\"Calculate required sample size for a proportion.\"\"\"`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` z `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` stats.norm.ppf((`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`1`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` +`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` confidence) `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`/`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 2`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` n `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (z `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`/`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` moe) `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`**`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 2`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` *`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` p `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`*`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`1`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` -`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` p)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` return`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:` int`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(np.ceil(n))`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# Want ±3% margin of error at 95% confidence`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`n_needed `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` sample_size_proportion(`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`moe`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`0.03`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:`print`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`f`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"Need `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`{`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`n_needed`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`}`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` respondents for ±3% MOE\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) `}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# 1068`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# For ±1% (much more precise)`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`n_needed_1pct `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` sample_size_proportion(`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`moe`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`0.01`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:`print`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`f`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"Need `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`{`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`n_needed_1pct`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`}`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` respondents for ±1% MOE\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) `}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# 9604`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# Notice: 3x more precision requires 9x more sample!`})}),`\n`]})})}),`\n`,_jsx(Heading,{level:`3`,id:`for-means`,children:`For Means`}),`\n`,_jsx(_components.span,{className:`katex-display`,children:_jsxs(_components.span,{className:`katex`,children:[_jsx(_components.span,{className:`katex-mathml`,children:_jsx(_components.math,{xmlns:`http://www.w3.org/1998/Math/MathML`,display:`block`,children:_jsxs(_components.semantics,{children:[_jsxs(_components.mrow,{children:[_jsx(_components.mi,{children:`n`}),_jsx(_components.mo,{children:`=`}),_jsxs(_components.msup,{children:[_jsxs(_components.mrow,{children:[_jsx(_components.mo,{fence:`true`,children:`(`}),_jsxs(_components.mfrac,{children:[_jsxs(_components.mrow,{children:[_jsxs(_components.msup,{children:[_jsx(_components.mi,{children:`z`}),_jsx(_components.mo,{children:`∗`})]}),_jsx(_components.mo,{children:`⋅`}),_jsx(_components.mi,{children:`σ`})]}),_jsxs(_components.mrow,{children:[_jsx(_components.mi,{children:`M`}),_jsx(_components.mi,{children:`O`}),_jsx(_components.mi,{children:`E`})]})]}),_jsx(_components.mo,{fence:`true`,children:`)`})]}),_jsx(_components.mn,{children:`2`})]})]}),_jsx(_components.annotation,{encoding:`application/x-tex`,children:`n = \\\\left(\\\\frac{z^* \\\\cdot \\\\sigma}{MOE}\\\\right)^2`})]})})}),_jsxs(_components.span,{className:`katex-html`,\"aria-hidden\":`true`,children:[_jsxs(_components.span,{className:`base`,children:[_jsx(_components.span,{className:`strut`,style:{height:`0.4306em`}}),_jsx(_components.span,{className:`mord mathnormal`,children:`n`}),_jsx(_components.span,{className:`mspace`,style:{marginRight:`0.2778em`}}),_jsx(_components.span,{className:`mrel`,children:`=`}),_jsx(_components.span,{className:`mspace`,style:{marginRight:`0.2778em`}})]}),_jsxs(_components.span,{className:`base`,children:[_jsx(_components.span,{className:`strut`,style:{height:`2.604em`,verticalAlign:`-0.95em`}}),_jsxs(_components.span,{className:`minner`,children:[_jsxs(_components.span,{className:`minner`,children:[_jsx(_components.span,{className:`mopen delimcenter`,style:{top:`0em`},children:_jsx(_components.span,{className:`delimsizing size3`,children:`(`})}),_jsxs(_components.span,{className:`mord`,children:[_jsx(_components.span,{className:`mopen nulldelimiter`}),_jsx(_components.span,{className:`mfrac`,children:_jsxs(_components.span,{className:`vlist-t vlist-t2`,children:[_jsxs(_components.span,{className:`vlist-r`,children:[_jsxs(_components.span,{className:`vlist`,style:{height:`1.3657em`},children:[_jsxs(_components.span,{style:{top:`-2.314em`},children:[_jsx(_components.span,{className:`pstrut`,style:{height:`3em`}}),_jsxs(_components.span,{className:`mord`,children:[_jsx(_components.span,{className:`mord mathnormal`,style:{marginRight:`0.109em`},children:`M`}),_jsx(_components.span,{className:`mord mathnormal`,style:{marginRight:`0.0278em`},children:`O`}),_jsx(_components.span,{className:`mord mathnormal`,style:{marginRight:`0.0576em`},children:`E`})]})]}),_jsxs(_components.span,{style:{top:`-3.23em`},children:[_jsx(_components.span,{className:`pstrut`,style:{height:`3em`}}),_jsx(_components.span,{className:`frac-line`,style:{borderBottomWidth:`0.04em`}})]}),_jsxs(_components.span,{style:{top:`-3.677em`},children:[_jsx(_components.span,{className:`pstrut`,style:{height:`3em`}}),_jsxs(_components.span,{className:`mord`,children:[_jsxs(_components.span,{className:`mord`,children:[_jsx(_components.span,{className:`mord mathnormal`,style:{marginRight:`0.044em`},children:`z`}),_jsx(_components.span,{className:`msupsub`,children:_jsx(_components.span,{className:`vlist-t`,children:_jsx(_components.span,{className:`vlist-r`,children:_jsx(_components.span,{className:`vlist`,style:{height:`0.6887em`},children:_jsxs(_components.span,{style:{top:`-3.063em`,marginRight:`0.05em`},children:[_jsx(_components.span,{className:`pstrut`,style:{height:`2.7em`}}),_jsx(_components.span,{className:`sizing reset-size6 size3 mtight`,children:_jsx(_components.span,{className:`mbin mtight`,children:`∗`})})]})})})})})]}),_jsx(_components.span,{className:`mspace`,style:{marginRight:`0.2222em`}}),_jsx(_components.span,{className:`mbin`,children:`⋅`}),_jsx(_components.span,{className:`mspace`,style:{marginRight:`0.2222em`}}),_jsx(_components.span,{className:`mord mathnormal`,style:{marginRight:`0.0359em`},children:`σ`})]})]})]}),_jsx(_components.span,{className:`vlist-s`,children:``})]}),_jsx(_components.span,{className:`vlist-r`,children:_jsx(_components.span,{className:`vlist`,style:{height:`0.686em`},children:_jsx(_components.span,{})})})]})}),_jsx(_components.span,{className:`mclose nulldelimiter`})]}),_jsx(_components.span,{className:`mclose delimcenter`,style:{top:`0em`},children:_jsx(_components.span,{className:`delimsizing size3`,children:`)`})})]}),_jsx(_components.span,{className:`msupsub`,children:_jsx(_components.span,{className:`vlist-t`,children:_jsx(_components.span,{className:`vlist-r`,children:_jsx(_components.span,{className:`vlist`,style:{height:`1.654em`},children:_jsxs(_components.span,{style:{top:`-3.9029em`,marginRight:`0.05em`},children:[_jsx(_components.span,{className:`pstrut`,style:{height:`2.7em`}}),_jsx(_components.span,{className:`sizing reset-size6 size3 mtight`,children:_jsx(_components.span,{className:`mord mtight`,children:`2`})})]})})})})})]})]})]})]})}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`9`,language:`python`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`python`,children:_jsxs(_components.code,{language:`python`,numberOfLines:`9`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`def`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` sample_size_mean`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`moe`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`std_dev`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`confidence`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`0.95`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`):`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"\"\"Calculate required sample size for a mean.\"\"\"`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` z `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` stats.norm.ppf((`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`1`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` +`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` confidence) `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`/`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 2`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` n `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (z `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`*`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` std_dev `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`/`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` moe) `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`**`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 2`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` return`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:` int`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(np.ceil(n))`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# House prices: want ±$10K, estimated std dev is $50K`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`n_houses `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` sample_size_mean(`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`moe`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`10`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`std_dev`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`50`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:`print`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`f`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"Need `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`{`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`n_houses`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`}`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` houses for ±$10K MOE\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) `}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# 97`})]}),`\n`]})})}),`\n`,_jsx(_components.hr,{}),`\n`,_jsx(Heading,{level:`2`,id:`mini-project-election-poll-analyzer`,children:`Mini-Project: Election Poll Analyzer`}),`\n`,_jsx(_components.p,{children:`Build a complete polling analysis system:`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`117`,language:`python`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`python`,children:_jsxs(_components.code,{language:`python`,numberOfLines:`117`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` numpy `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`as`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` np`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`from`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` scipy `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` stats`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`class`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#4EC9B0`},children:` PollAnalyzer`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`:`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"\"\"`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` Analyze election poll results with proper uncertainty quantification.`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"\"\"`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` `})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` def`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:` __init__`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`self`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`candidate_a_votes`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`total_votes`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`confidence`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`0.95`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`):`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` self`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.n `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` total_votes`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` self`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.a_votes `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` candidate_a_votes`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` self`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.b_votes `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` total_votes `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`-`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` candidate_a_votes`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` self`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.p_a `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` candidate_a_votes `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`/`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` total_votes`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` self`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.p_b `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 1`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` -`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` self`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.p_a`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` self`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.confidence `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` confidence`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` `})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` def`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` margin_of_error`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`self`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`):`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"\"\"Calculate margin of error for candidate A's proportion.\"\"\"`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` z `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` stats.norm.ppf((`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`1`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` +`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` self`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.confidence) `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`/`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 2`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` se `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` np.sqrt(`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:`self`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.p_a `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`*`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` self`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.p_b `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`/`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` self`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.n)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` return`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` z `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`*`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` se`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` `})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` def`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` confidence_interval`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`self`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`):`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"\"\"Calculate confidence interval for candidate A.\"\"\"`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` moe `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` self`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.margin_of_error()`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` return`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:`self`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.p_a `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`-`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` moe, `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:`self`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.p_a `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`+`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` moe)`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` `})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` def`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` probability_a_wins`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`self`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`):`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"\"\"`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` Estimate probability that candidate A is truly ahead.`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` This uses the normal approximation.`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"\"\"`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` # We want P(true_p_a > 0.5)`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` # The difference (p_a - 0.5) follows approximately normal`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` diff `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` self`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.p_a `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`-`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 0.5`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` se `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` np.sqrt(`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:`self`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.p_a `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`*`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` self`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.p_b `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`/`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` self`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.n)`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` `})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` # Z-score for the difference from 0.5`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` z `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` diff `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`/`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` se`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` `})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` # Probability that true proportion > 0.5`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` return`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` stats.norm.cdf(z)`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` `})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` def`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` required_sample_for_call`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`self`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`min_confidence`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`0.95`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`):`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"\"\"`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` Calculate sample size needed to call the race at given confidence.`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` Returns None if current lead is too small.`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"\"\"`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` # We need the CI to not cross 50%`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` # This happens when |p_a - 0.5| > MOE`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` `})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` lead `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:` abs`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:`self`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.p_a `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`-`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 0.5`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` z `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` stats.norm.ppf((`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`1`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` +`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` min_confidence) `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`/`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 2`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` `})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` # Solve: z * sqrt(p*q/n) = lead`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` # n = (z^2 * p * q) / lead^2`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` `})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` if`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` lead `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`==`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 0`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`:`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` return`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:` float`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'inf'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` `})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` n `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (z `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`**`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 2`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` *`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` self`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.p_a `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`*`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` self`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.p_b) `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`/`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (lead `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`**`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 2`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` return`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:` int`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(np.ceil(n))`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` `})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` def`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` report`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`self`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`):`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"\"\"Generate comprehensive poll report.\"\"\"`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` ci `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` self`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.confidence_interval()`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` `})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:` print`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:`\\\\n`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` +`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"=\"`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` *`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 60`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:` print`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"ELECTION POLL ANALYSIS\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:` print`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"=\"`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` *`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 60`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:` print`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`f`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"Sample Size: `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`{`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:`self`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.n`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`:,}`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` voters\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:` print`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`f`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"Confidence Level: `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`{`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:`self`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.confidence`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`:.0%}`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:` print`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"-\"`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` *`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 60`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:` print`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`f`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"Candidate A: `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`{`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:`self`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.p_a`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`:.1%}`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` (`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`{`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:`self`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.a_votes`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`:,}`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` votes)\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:` print`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`f`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"Candidate B: `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`{`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:`self`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.p_b`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`:.1%}`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` (`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`{`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:`self`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.b_votes`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`:,}`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` votes)\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:` print`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"-\"`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` *`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 60`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:` print`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`f`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"Margin of Error: ±`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`{`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:`self`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.margin_of_error()`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`:.1%}`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:` print`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`f`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"95% CI for A: (`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`{`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`ci[`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`0`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`]`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`:.1%}`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`, `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`{`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`ci[`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`1`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`]`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`:.1%}`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`)\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:` print`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"-\"`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` *`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 60`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` `})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` p_wins `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` self`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.probability_a_wins()`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` if`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` p_wins `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`>`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 0.99`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`:`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` call `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"PROJECTED WINNER: Candidate A\"`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` elif`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` p_wins `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`\u003c`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 0.01`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`:`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` call `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"PROJECTED WINNER: Candidate B\"`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` elif`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` p_wins `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`>`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 0.95`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`:`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` call `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"LIKELY WINNER: Candidate A\"`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` elif`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` p_wins `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`\u003c`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 0.05`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`:`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` call `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"LIKELY WINNER: Candidate B\"`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` else`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`:`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` call `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"TOO CLOSE TO CALL\"`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` `})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:` print`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`f`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"P(A is truly ahead): `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`{`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`p_wins`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`:.1%}`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:` print`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`f`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"Status: `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`{`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`call`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`}`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` `})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` if`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 0.05`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` \u003c`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` p_wins `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`\u003c`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 0.95`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`:`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` n_needed `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` self`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.required_sample_for_call()`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` if`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` n_needed `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`\u003c`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:` float`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'inf'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`):`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:` print`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`f`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"Need ~`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`{`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`n_needed`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`:,}`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` votes to call at 95%\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` `})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:` print`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"=\"`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` *`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 60`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# Example 1: Early results (close race)`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:`print`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:`\\\\n`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`--- EARLY RESULTS ---\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`poll1 `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` PollAnalyzer(`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`candidate_a_votes`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`520`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`total_votes`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`1000`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`poll1.report()`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# Example 2: More data (still close)`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:`print`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:`\\\\n`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`--- UPDATED RESULTS ---\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`poll2 `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` PollAnalyzer(`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`candidate_a_votes`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`5200`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`total_votes`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`10000`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`poll2.report()`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# Example 3: Clear lead`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:`print`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:`\\\\n`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`--- CLEAR LEAD ---\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`poll3 `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` PollAnalyzer(`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`candidate_a_votes`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`5500`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`total_votes`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`10000`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`poll3.report()`})}),`\n`]})})}),`\n`,_jsx(_components.p,{children:_jsx(_components.strong,{children:`Output:`})}),`\n`,_jsx(CodeBlock,{numberOfLines:`37`,language:`text`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`text`,children:_jsxs(_components.code,{language:`text`,numberOfLines:`37`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`--- EARLY RESULTS ---`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`============================================================`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`ELECTION POLL ANALYSIS`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`============================================================`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`Sample Size: 1,000 voters`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`Confidence Level: 95%`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`------------------------------------------------------------`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`Candidate A: 52.0% (520 votes)`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`Candidate B: 48.0% (480 votes)`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`------------------------------------------------------------`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`Margin of Error: ±3.1%`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`95% CI for A: (48.9%, 55.1%)`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`------------------------------------------------------------`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`P(A is truly ahead): 89.7%`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`Status: TOO CLOSE TO CALL`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`Need ~2,397 votes to call at 95%`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`============================================================`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`--- UPDATED RESULTS ---`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`============================================================`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`ELECTION POLL ANALYSIS`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`============================================================`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`Sample Size: 10,000 voters`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`Confidence Level: 95%`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`------------------------------------------------------------`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`Candidate A: 52.0% (5,200 votes)`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`Candidate B: 48.0% (4,800 votes)`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`------------------------------------------------------------`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`Margin of Error: ±1.0%`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`95% CI for A: (51.0%, 53.0%)`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`------------------------------------------------------------`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`P(A is truly ahead): 100.0%`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`Status: PROJECTED WINNER: Candidate A`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`============================================================`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{})})]})})}),`\n`,_jsx(_components.hr,{}),`\n`,_jsx(Heading,{level:`2`,id:`common-mistakes-in-inference`,children:`Common Mistakes in Inference`}),`\n`,_jsx(Heading,{level:`3`,id:`mistake-1-ignoring-sample-bias`,children:`Mistake 1: Ignoring Sample Bias`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`4`,language:`python`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`python`,children:_jsxs(_components.code,{language:`python`,numberOfLines:`4`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# BAD: Survey only people who answer phones during business hours`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# This systematically excludes working people!`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# GOOD: Random sampling from entire population`})}),`\n`]})})}),`\n`,_jsx(_components.hr,{}),`\n`,_jsx(Heading,{level:`2`,id:`common-mistakes-to-avoid`,children:`Common Mistakes to Avoid`}),`\n`,_jsxs(Warning,{children:[_jsx(_components.p,{children:_jsx(_components.strong,{children:`Mistake 1: Misleading Margin of Error`})}),_jsx(_components.p,{children:`A headline saying “Poll shows 52% support (±3%)” means the 95% CI is 49-55%. But if the race is 52% vs 48%, the intervals overlap and the race is actually too close to call!`})]}),`\n`,_jsxs(Warning,{children:[_jsx(_components.p,{children:_jsx(_components.strong,{children:`Mistake 2: Small Sample, Big Claims`})}),_jsx(CodeBlock,{filename:``,numberOfLines:`4`,language:`python`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`python`,children:_jsxs(_components.code,{language:`python`,numberOfLines:`4`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# Survey of 30 people shows 60% prefer product A`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`ci, moe `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` confidence_interval_proportion(`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`0.60`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`30`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:`print`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`f`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"95% CI: (`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`{`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`ci[`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`0`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`]`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`:.1%}`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`, `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`{`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`ci[`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`1`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`]`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`:.1%}`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`)\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# CI: (42.4%, 77.6%) - way too wide to claim victory!`})}),`\n`]})})})]}),`\n`,_jsxs(Warning,{children:[_jsx(_components.p,{children:_jsx(_components.strong,{children:`Mistake 3: Confusing Confidence Level with Probability`})}),_jsx(CodeBlock,{filename:``,numberOfLines:`2`,language:`python`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`python`,children:_jsxs(_components.code,{language:`python`,numberOfLines:`2`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# WRONG: \"There's a 95% chance the true value is between 48.9% and 55.1%\"`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# RIGHT: \"We're 95% confident our method produces intervals containing the true value\"`})}),`\n`]})})})]}),`\n`,_jsx(_components.hr,{}),`\n`,_jsx(Heading,{level:`2`,id:`interview-questions`,children:`Interview Questions`}),`\n`,_jsxs(Accordion,{title:`Question 1: Confidence Interval Interpretation (Google)`,id:`question-1-confidence-interval-interpretation-google`,children:[_jsxs(_components.p,{children:[_jsx(_components.strong,{children:`Question`}),`: Your A/B test shows the new feature increased click-through rate from 2.0% to 2.3%, with a 95% CI of [2.1%, 2.5%] for the new version. What can you conclude?`]}),_jsxs(Tip,{children:[_jsxs(_components.p,{children:[_jsx(_components.strong,{children:`Answer`}),`:`]}),_jsxs(_components.ul,{children:[`\n`,_jsx(_components.li,{children:`We’re 95% confident the true CTR for the new version is between 2.1% and 2.5%`}),`\n`,_jsx(_components.li,{children:`Since the entire CI is above 2.0% (the control), we have evidence of a real improvement`}),`\n`,_jsx(_components.li,{children:`The minimum expected improvement is 0.1 percentage points (2.1% - 2.0%)`}),`\n`,_jsx(_components.li,{children:`For business decisions, consider if a 0.1-0.5 pp improvement justifies the change`}),`\n`]}),_jsx(_components.p,{children:`Note: If the CI included 2.0%, we couldn’t conclude there’s a real difference.`})]})]}),`\n`,_jsxs(Accordion,{title:`Question 2: Sample Size Planning (Amazon)`,id:`question-2-sample-size-planning-amazon`,children:[_jsxs(_components.p,{children:[_jsx(_components.strong,{children:`Question`}),`: You want to estimate the proportion of customers who will buy a new product. You need ±5% precision with 95% confidence. How many customers should you survey?`]}),_jsxs(Tip,{children:[_jsxs(_components.p,{children:[_jsx(_components.strong,{children:`Answer`}),`:`]}),_jsx(CodeBlock,{filename:``,numberOfLines:`8`,language:`python`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`python`,children:_jsxs(_components.code,{language:`python`,numberOfLines:`8`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# Use p = 0.5 for maximum sample size (conservative)`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# Formula: n = (z²×p×(1-p)) / E²`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`z `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 1.96`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`p `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 0.5`}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` # Conservative assumption`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`E `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 0.05`}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` # Desired margin of error`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`n `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (z`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`**`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`2`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` *`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` p `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`*`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`1`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`-`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`p)) `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`/`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (E`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`**`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`2`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:`print`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`f`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"Sample size needed: `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`{`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:`int`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(np.ceil(n))`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`}`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) `}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# 385`})]}),`\n`]})})}),_jsx(_components.p,{children:`Key insight: Using p = 0.5 gives the largest sample size because that’s where variance is maximized. If you know approximately what p will be, you can use that value for a smaller required sample.`})]})]}),`\n`,_jsxs(Accordion,{title:`Question 3: Standard Error Application (Facebook/Meta)`,id:`question-3-standard-error-application-facebook-meta`,children:[_jsxs(_components.p,{children:[_jsx(_components.strong,{children:`Question`}),`: Daily active users (DAU) over the past 100 days had mean 50M with standard deviation 5M. What’s the 95% CI for the true mean DAU?`]}),_jsxs(Tip,{children:[_jsxs(_components.p,{children:[_jsx(_components.strong,{children:`Answer`}),`:`]}),_jsx(CodeBlock,{filename:``,numberOfLines:`12`,language:`python`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`python`,children:_jsxs(_components.code,{language:`python`,numberOfLines:`12`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`mean_dau `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 50`}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` # millions`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`std_dau `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 5`}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` # millions`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`n `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 100`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# Standard error`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`se `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` std_dau `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`/`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` np.sqrt(n) `}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# 0.5 million`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# 95% CI`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`z `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 1.96`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`ci `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (mean_dau `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`-`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` z`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`*`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`se, mean_dau `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`+`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` z`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`*`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`se)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:`print`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`f`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"95% CI: (`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`{`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`ci[`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`0`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`]`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`:.1f}`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`M, `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`{`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`ci[`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`1`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`]`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`:.1f}`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`M)\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# (49.02M, 50.98M)`})}),`\n`]})})}),_jsx(_components.p,{children:`The true average DAU is likely between 49M and 51M with 95% confidence.`})]})]}),`\n`,_jsxs(Accordion,{title:`Question 4: Bias in Sampling (Tech Companies)`,id:`question-4-bias-in-sampling-tech-companies`,children:[_jsxs(_components.p,{children:[_jsx(_components.strong,{children:`Question`}),`: You survey users who contacted customer support about a new feature. 80% say they dislike it. Is this valid for all users?`]}),_jsxs(Tip,{children:[_jsxs(_components.p,{children:[_jsx(_components.strong,{children:`Answer`}),`: No! This is selection bias.`]}),_jsx(_components.p,{children:`Users who contact support are more likely to have problems. The sample is not representative of all users. You’re measuring “satisfaction among users with issues” not “overall satisfaction.”`}),_jsx(_components.p,{children:`To get a valid estimate, you need:`}),_jsxs(_components.ul,{children:[`\n`,_jsx(_components.li,{children:`Random sampling from all users`}),`\n`,_jsx(_components.li,{children:`Or stratified sampling to ensure representation`}),`\n`,_jsx(_components.li,{children:`Consider that satisfied users rarely reach out`}),`\n`]}),_jsx(_components.p,{children:`This is called “sampling bias” or “survivorship bias” and is a major concern in ML training data as well.`})]})]}),`\n`,_jsx(_components.hr,{}),`\n`,_jsx(Heading,{level:`2`,id:`practice-challenge`,children:`Practice Challenge`}),`\n`,_jsxs(Accordion,{title:`Challenge: Power Analysis for A/B Test`,id:`challenge-power-analysis-for-a-b-test`,children:[_jsx(_components.p,{children:`You’re planning an A/B test. The current conversion rate is 5%. You want to detect a 20% relative improvement (5% → 6%). How many users do you need per group?`}),_jsx(CodeBlock,{filename:``,numberOfLines:`42`,language:`python`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`python`,children:_jsxs(_components.code,{language:`python`,numberOfLines:`42`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# This is called a power analysis`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# We need to balance:`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# - Significance level (α): probability of false positive`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# - Power (1-β): probability of detecting a real effect`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# - Effect size: the difference we want to detect`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# - Sample size: what we're solving for`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`from`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` scipy `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` stats`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` numpy `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`as`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` np`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`def`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` required_sample_size_ab`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`p1`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`p2`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`alpha`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`0.05`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`power`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`0.8`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`):`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"\"\"`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` Calculate required sample size per group for A/B test.`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` `})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` p1: baseline conversion rate`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` p2: expected conversion rate after improvement`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` alpha: significance level (typically 0.05)`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` power: probability of detecting effect if real (typically 0.8)`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"\"\"`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` # Effect size (Cohen's h)`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` h `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 2`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` *`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (np.arcsin(np.sqrt(p2)) `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`-`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` np.arcsin(np.sqrt(p1)))`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` `})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` # Z-scores`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` z_alpha `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` stats.norm.ppf(`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`1`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` -`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` alpha`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`/`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`2`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) `}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# Two-tailed`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` z_beta `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` stats.norm.ppf(power)`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` `})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` # Sample size per group`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` n `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 2`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` *`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` ((z_alpha `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`+`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` z_beta) `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`/`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` h) `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`**`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 2`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` `})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` return`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:` int`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(np.ceil(n))`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# Your task: Calculate and interpret`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`p_baseline `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 0.05`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`p_improved `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 0.06`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`n_per_group `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` required_sample_size_ab(p_baseline, p_improved)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:`print`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`f`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"Need `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`{`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`n_per_group`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`}`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` users per group\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:`print`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`f`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"Total users: `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`{`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`2`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` *`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` n_per_group`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`}`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# Also calculate for different scenarios:`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# 1. What if you want to detect a 10% improvement (5% → 5.5%)?`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# 2. What if power needs to be 90% instead of 80%?`})}),`\n`]})})}),_jsxs(_components.p,{children:[_jsx(_components.strong,{children:`Solution`}),`:`]}),_jsx(CodeBlock,{filename:``,numberOfLines:`16`,language:`python`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`python`,children:_jsxs(_components.code,{language:`python`,numberOfLines:`16`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# Base case: 5% → 6% (20% relative improvement)`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`n_base `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` required_sample_size_ab(`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`0.05`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`0.06`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:`print`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`f`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"Base case: `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`{`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`n_base`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`:,}`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` per group\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) `}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# ~4,794`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# Scenario 1: 5% → 5.5% (10% relative improvement)`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`n_smaller `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` required_sample_size_ab(`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`0.05`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`0.055`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:`print`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`f`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"Smaller effect: `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`{`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`n_smaller`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`:,}`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` per group\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) `}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# ~19,177`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# 4x more users for half the effect size!`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# Scenario 2: 90% power`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`n_high_power `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` required_sample_size_ab(`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`0.05`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`0.06`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`power`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`0.9`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:`print`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`f`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"Higher power: `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`{`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`n_high_power`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`:,}`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` per group\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) `}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# ~6,420`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# ~34% more users for 10% more power`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# Key insight: Sample size grows QUADRATICALLY with smaller effect sizes`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# This is why A/B testing small improvements is expensive!`})}),`\n`]})})})]}),`\n`,_jsx(_components.hr,{}),`\n`,_jsx(Heading,{level:`2`,id:`-practice-exercises`,children:`📝 Practice Exercises`}),`\n`,_jsxs(CardGroup,{cols:2,children:[_jsx(Card,{title:`Exercise 1`,icon:`arrows-left-right`,color:`#3B82F6`,children:_jsx(_components.p,{children:`Calculate confidence intervals for proportions`})}),_jsx(Card,{title:`Exercise 2`,icon:`users`,color:`#10B981`,children:_jsx(_components.p,{children:`Determine required sample sizes for precision`})}),_jsx(Card,{title:`Exercise 3`,icon:`chart-line`,color:`#8B5CF6`,children:_jsx(_components.p,{children:`Construct confidence intervals for means`})}),_jsx(Card,{title:`Exercise 4`,icon:`chart-pie`,color:`#F59E0B`,children:_jsx(_components.p,{children:`Real-world: Election polling analysis`})})]}),`\n`,`\n`,`\n`,`\n`,`\n`,_jsx(_components.hr,{}),`\n`,_jsx(Heading,{level:`2`,id:`key-takeaways`,children:`Key Takeaways`}),`\n`,_jsxs(CardGroup,{cols:2,children:[_jsx(Card,{title:`Population vs Sample`,icon:`users`,children:_jsxs(_components.ul,{children:[`\n`,_jsx(_components.li,{children:`Population: entire group of interest`}),`\n`,_jsx(_components.li,{children:`Sample: subset we actually observe`}),`\n`,_jsx(_components.li,{children:`Statistics estimate parameters`}),`\n`]})}),_jsx(Card,{title:`Standard Error`,icon:`arrows-left-right`,children:_jsxs(_components.ul,{children:[`\n`,_jsx(_components.li,{children:`Measures variability of sample statistics`}),`\n`,_jsx(_components.li,{children:`Decreases with sqrt(n)`}),`\n`,_jsx(_components.li,{children:`Foundation of confidence intervals`}),`\n`]})}),_jsx(Card,{title:`Confidence Intervals`,icon:`brackets-curly`,children:_jsxs(_components.ul,{children:[`\n`,_jsx(_components.li,{children:`Range of plausible values for parameter`}),`\n`,_jsx(_components.li,{children:`Width = 2 x margin of error`}),`\n`,_jsx(_components.li,{children:`Higher confidence = wider interval`}),`\n`]})}),_jsx(Card,{title:`Sample Size`,icon:`calculator`,children:_jsxs(_components.ul,{children:[`\n`,_jsx(_components.li,{children:`More precision requires more data`}),`\n`,_jsx(_components.li,{children:`Quadratic relationship (2x precision = 4x data)`}),`\n`,_jsx(_components.li,{children:`Plan before collecting data`}),`\n`]})})]}),`\n`,_jsx(_components.hr,{}),`\n`,_jsx(Heading,{level:`2`,id:`common-pitfalls`,children:`Common Pitfalls`}),`\n`,_jsxs(Warning,{children:[_jsxs(_components.p,{children:[_jsx(_components.strong,{children:`Inference Mistakes to Avoid`}),`:`]}),_jsxs(_components.ol,{children:[`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Misinterpreting Confidence Intervals`}),` - “95% confident the true value is in this range” NOT “95% chance the parameter is here”`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Ignoring Sample Bias`}),` - Non-random samples lead to biased estimates regardless of sample size`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Confusing Confidence Level with Precision`}),` - 99% confidence is wider, not more precise`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Forgetting Standard Error Shrinks with √n`}),` - To halve SE, you need 4x the data, not 2x`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Using z when t is appropriate`}),` - For small samples (n \u003c 30), t-distribution accounts for extra uncertainty`]}),`\n`]})]}),`\n`,_jsx(_components.hr,{}),`\n`,_jsx(Heading,{level:`2`,id:`connection-to-machine-learning`,children:`Connection to Machine Learning`}),`\n`,_jsxs(Table,{children:[_jsx(_components.thead,{children:_jsxs(_components.tr,{children:[_jsx(_components.th,{children:`Inference Concept`}),_jsx(_components.th,{children:`ML Application`})]})}),_jsxs(_components.tbody,{children:[_jsxs(_components.tr,{children:[_jsx(_components.td,{children:`Confidence intervals`}),_jsx(_components.td,{children:`Uncertainty in predictions`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:`Standard error`}),_jsx(_components.td,{children:`Error bars, prediction intervals`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:`Sample size`}),_jsx(_components.td,{children:`Training set size planning`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:`t-distribution`}),_jsx(_components.td,{children:`Small data regimes, regularization`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:`Bias in sampling`}),_jsx(_components.td,{children:`Training/test split, data collection`})]})]})]}),`\n`,_jsx(Tip,{children:_jsxs(_components.p,{children:[_jsx(_components.strong,{children:`ML Connection`}),`: When you report model accuracy as “92% ± 2%”, you’re using confidence intervals! Cross-validation provides multiple samples, and the standard error tells you how much your accuracy estimate might vary.`]})}),`\n`,_jsxs(_components.p,{children:[_jsx(_components.strong,{children:`Coming up next`}),`: We’ll learn about `,_jsx(_components.strong,{children:`Hypothesis Testing`}),` - how to determine if a difference is real or just random noise. This is the foundation of A/B testing and scientific validation of ML models.`]}),`\n`,_jsx(Card,{title:`Next: Hypothesis Testing`,icon:`arrow-right`,href:`/courses/statistics-for-ml/06-hypothesis-testing`,children:_jsx(_components.p,{children:`Learn to distinguish real effects from random noise`})}),`\n`,_jsx(_components.hr,{}),`\n`,_jsx(Heading,{level:`2`,id:`interview-deep-dive`,children:`Interview Deep-Dive`}),`\n`,_jsxs(AccordionGroup,{children:[_jsxs(Accordion,{title:`A colleague says: 'The 95% confidence interval is 4.2% to 5.8%, so there is a 95% probability the true rate is in that range.' Is this correct?`,id:`a-colleague-says-the-95-confidence-interval-is-4-2-to-5-8-so-there-is-a-95-probability-the-true-rate-is-in-that-range-is-this-correct`,children:[_jsx(_components.p,{children:_jsx(_components.strong,{children:`Strong Answer:`})}),_jsxs(_components.ul,{children:[`\n`,_jsx(_components.li,{children:`This is one of the most common misconceptions in statistics, and it is wrong. The true population parameter is a fixed number — it either is or is not in that interval. There is no probability about it. The 95% refers to the procedure, not to any single interval.`}),`\n`,_jsx(_components.li,{children:`The correct interpretation: if we repeated this experiment many times and constructed a 95% confidence interval each time, approximately 95% of those intervals would contain the true parameter. For any single interval, we do not know if it is one of the 95% that captured the truth or one of the 5% that missed.`}),`\n`,_jsx(_components.li,{children:`In practice, most people (including many data scientists) use the Bayesian-sounding interpretation because it is more intuitive for decision-making. And with a flat prior, the Bayesian credible interval actually gives you the statement your colleague was trying to make. But in a frequentist framework, the distinction matters because it affects how you communicate uncertainty.`}),`\n`,_jsx(_components.li,{children:`The practical consequence: when reporting results to stakeholders, I usually say “we are 95% confident that the true rate lies between 4.2% and 5.8%” which is technically correct, rather than “there is a 95% chance” which is technically not. But I also explain that the interval gives us a range of plausible values, and values outside the interval are implausible given our data.`}),`\n`]}),_jsx(_components.p,{children:_jsx(_components.strong,{children:`Follow-up: When would you recommend switching from a frequentist confidence interval to a Bayesian credible interval?`})}),_jsx(_components.p,{children:`I would switch to Bayesian methods when prior information is genuinely available and important. For example, if we are estimating conversion rates for a new checkout flow, we have strong prior knowledge that conversion rates for e-commerce sites typically fall between 1% and 10%. A Bayesian approach with an informative prior can produce tighter, more useful intervals, especially with small sample sizes. The Bayesian credible interval also answers the question people actually want to ask: “What is the probability the parameter is in this range?” Another scenario is online A/B testing where you want to continuously update your beliefs as data arrives. Bayesian methods allow natural sequential updating without the multiple testing penalties that plague frequentist approaches when you peek at results.`})]}),_jsxs(Accordion,{title:`You need to estimate the mean order value for a new product line, but you only have 12 orders so far. Walk me through the right approach.`,id:`you-need-to-estimate-the-mean-order-value-for-a-new-product-line-but-you-only-have-12-orders-so-far-walk-me-through-the-right-approach`,children:[_jsx(_components.p,{children:_jsx(_components.strong,{children:`Strong Answer:`})}),_jsxs(_components.ul,{children:[`\n`,_jsx(_components.li,{children:`With n=12, we are firmly in small-sample territory, so I would use a t-distribution rather than a normal distribution for the confidence interval. The t-distribution has heavier tails than the normal, which accounts for the extra uncertainty in estimating the population standard deviation from such a small sample.`}),`\n`,_jsx(_components.li,{children:`Specifically, I would compute the sample mean and sample standard deviation, then build a t-based confidence interval: x-bar plus or minus t-critical times (s / sqrt(12)), where t-critical comes from the t-distribution with 11 degrees of freedom. For 95% confidence, t-critical is approximately 2.201, compared to 1.96 for the normal — about 12% wider.`}),`\n`,_jsx(_components.li,{children:`Before trusting this interval, I would check the normality assumption. With only 12 observations, I cannot reliably test normality with formal tests (they have very low power at n=12), but I would look at a Q-Q plot and check for obvious outliers or extreme skewness. If the data is heavily skewed (which order values often are due to a long right tail), I would consider either a log transformation or a bootstrap confidence interval instead.`}),`\n`,_jsx(_components.li,{children:`I would also be transparent about the limitations. A 95% CI from 12 observations will be very wide — potentially too wide to be useful for decision-making. I would tell stakeholders: “Here is our best estimate and its range, but we need at least 50-100 orders before this estimate stabilizes enough to base pricing or inventory decisions on it.”`}),`\n`]}),_jsx(_components.p,{children:_jsx(_components.strong,{children:`Follow-up: How does the bootstrap approach work for this problem, and why might it be better than the t-interval?`})}),_jsx(_components.p,{children:`Bootstrap resamples the 12 observations with replacement thousands of times, computes the mean of each resample, and uses the distribution of those means to form a confidence interval. The key advantage is that it makes no assumption about the underlying distribution — no normality required. For order values, which are often right-skewed with occasional large orders, this matters because the t-interval assumes approximate normality of the sampling distribution, which may not hold well at n=12 with skewed data. The bootstrap percentile interval (2.5th and 97.5th percentiles of the bootstrap means) will naturally be asymmetric if the data is skewed, giving a more honest representation of uncertainty. The downside is that with only 12 original data points, the bootstrap has limited “material” to work with, so its coverage properties are not guaranteed. With very small n, the bias-corrected and accelerated (BCa) bootstrap is preferred over the simple percentile method.`})]}),_jsxs(Accordion,{title:`What is the difference between standard error and standard deviation, and why do candidates confuse them?`,id:`what-is-the-difference-between-standard-error-and-standard-deviation-and-why-do-candidates-confuse-them`,children:[_jsx(_components.p,{children:_jsx(_components.strong,{children:`Strong Answer:`})}),_jsxs(_components.ul,{children:[`\n`,_jsx(_components.li,{children:`Standard deviation (SD) measures the spread of individual observations in your data. If heights have SD = 3 inches, that tells you individual people vary by about 3 inches from the average height.`}),`\n`,_jsx(_components.li,{children:`Standard error (SE) measures the precision of a sample statistic — how much that statistic would vary if you repeated the experiment. The standard error of the mean is SD / sqrt(n). With n=100 and SD=3, the SE is 0.3 inches. This tells you your sample mean is precise to about 0.3 inches.`}),`\n`,_jsx(_components.li,{children:`Candidates confuse them because both involve similar-looking formulas and both measure “variability.” The critical distinction is what is varying: SD describes variability of the data, SE describes variability of the estimate. Doubling the sample size barely changes the SD but cuts the SE by a factor of sqrt(2).`}),`\n`,_jsx(_components.li,{children:`In practice, the confusion causes real errors. If someone reports “mean response time is 200ms with standard deviation 50ms” and someone else interprets that 50ms as the standard error, they would think the mean is extremely precisely estimated (CI of roughly 200 plus or minus 100ms) when actually the standard error might be 5ms (CI of 200 plus or minus 10ms) — a very different statement about confidence.`}),`\n`]}),_jsx(_components.p,{children:_jsx(_components.strong,{children:`Follow-up: In a research paper, the error bars on a chart could represent SD, SE, or a 95% CI. How do you tell which, and why does it matter?`})}),_jsx(_components.p,{children:`You check the figure legend or methods section — responsible papers specify which measure is used. If they do not, that is already a red flag. The visual impact is dramatically different: SE bars are roughly sqrt(n) times smaller than SD bars, and 95% CI bars are about 2x wider than SE bars. A chart with SD bars looks like the data is noisy and the groups overlap heavily. The same data with SE bars looks like the groups are cleanly separated. This is why some researchers have been criticized for cherry-picking: showing SE bars when they want to emphasize differences and SD bars when they want to show the “spread.” The gold standard is to show 95% CI bars, because they directly communicate the precision of the estimate and allow the reader to visually assess significance.`})]})]})]})}function MDXContent(props={}){const{wrapper:MDXLayout}={..._provideComponents(),...props.components};return MDXLayout?_jsx(MDXLayout,{...props,children:_jsx(_createMdxContent,{...props})}):_createMdxContent(props)}return{default:MDXContent};function _missingMdxReference(id,component){throw new Error(`Expected `+(component?`component`:`object`)+\" `\"+id+\"` to be defined: you likely forgot to import, pass, or provide it.\")}","frontmatter":{},"scope":{"config":{},"pageMetadata":{"title":"Statistical Inference: Conclusions from Samples","sidebarTitle":"Inference","description":"How to draw reliable conclusions about millions from just hundreds of observations","icon":"magnifying-glass-chart","href":"/courses/statistics-for-ml/05-inference"}}},"mdxSourceWithNoJs":null},"mdxExtracts":{"tableOfContents":[{"title":"Statistical Inference: Conclusions from Samples","slug":"statistical-inference-conclusions-from-samples","depth":1,"children":[]},{"title":"The Election Polling Problem","slug":"the-election-polling-problem","depth":2,"children":[]},{"title":"Population vs Sample","slug":"population-vs-sample","depth":2,"children":[]},{"title":"Sampling Distributions: The Key Insight","slug":"sampling-distributions-the-key-insight","depth":2,"children":[]},{"title":"Standard Error: Quantifying Uncertainty","slug":"standard-error-quantifying-uncertainty","depth":2,"children":[]},{"title":"Confidence Intervals: Expressing Uncertainty","slug":"confidence-intervals-expressing-uncertainty","depth":2,"children":[{"title":"The Formula","slug":"the-formula","depth":3,"children":[]},{"title":"What Does “95% Confidence” Mean?","slug":"what-does-“95%-confidence”-mean","depth":3,"children":[]}]},{"title":"Confidence Intervals for Means","slug":"confidence-intervals-for-means","depth":2,"children":[]},{"title":"The t-Distribution: For Small Samples","slug":"thet-distribution-for-small-samples","depth":2,"children":[]},{"title":"Sample Size Planning","slug":"sample-size-planning","depth":2,"children":[{"title":"For Proportions","slug":"for-proportions","depth":3,"children":[]},{"title":"For Means","slug":"for-means","depth":3,"children":[]}]},{"title":"Mini-Project: Election Poll Analyzer","slug":"mini-project-election-poll-analyzer","depth":2,"children":[]},{"title":"Common Mistakes in Inference","slug":"common-mistakes-in-inference","depth":2,"children":[{"title":"Mistake 1: Ignoring Sample Bias","slug":"mistake-1-ignoring-sample-bias","depth":3,"children":[]}]},{"title":"Common Mistakes to Avoid","slug":"common-mistakes-to-avoid","depth":2,"children":[]},{"title":"Interview Questions","slug":"interview-questions","depth":2,"children":[]},{"title":"Practice Challenge","slug":"practice-challenge","depth":2,"children":[]},{"title":"📝 Practice Exercises","slug":"-practice-exercises","depth":2,"children":[]},{"title":"Key Takeaways","slug":"key-takeaways","depth":2,"children":[]},{"title":"Common Pitfalls","slug":"common-pitfalls","depth":2,"children":[]},{"title":"Connection to Machine Learning","slug":"connection-to-machine-learning","depth":2,"children":[]},{"title":"Interview Deep-Dive","slug":"interview-deep-dive","depth":2,"children":[]}],"codeExamples":{}},"jsLinks":[],"subdomain":"devweeekends","siteName":"Dev Weekends","title":"Statistical Inference: Conclusions from Samples - Dev Weekends","navMaps":{"firstHrefInVersion":{},"firstHrefInLanguage":{}},"lastModified":"2026-05-16T10:37:06.809Z","originalFileLocation":"courses/statistics-for-ml/05-inference.mdx"},"headHtml":"\u003cscript data-mint-head>(function(){var d=document.documentElement,p=null;if(!p){try{p=localStorage.getItem(\"isDarkMode\")}catch(e){}if(p==='true')p='dark';else if(p==='false')p='light';if(p!=='light'\u0026\u0026p!=='dark'\u0026\u0026p!=='system')p=\"system\"}var r=p==='system'?(matchMedia(\"(prefers-color-scheme: dark)\").matches?'dark':'light'):p;d.classList.remove(r==='dark'?'light':'dark');d.classList.add(r);d.setAttribute(\"data-theme-preference\",p)})();\u003c/script>\u003cmeta data-mint-head name=\"description\" content=\"How to draw reliable conclusions about millions from just hundreds of observations\">\u003cmeta data-mint-head name=\"application-name\" content=\"Dev Weekends\">\u003cmeta data-mint-head name=\"generator\" content=\"Mintlify\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/devweeekends/VN0XII-rWbxEMed4/_generated/favicon/android-chrome-192x192.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"apple-touch-icon\" type=\"image/png\" sizes=\"180x180\" href=\"/mintlify-assets/_mintlify/favicons/devweeekends/VN0XII-rWbxEMed4/_generated/favicon/apple-touch-icon.png\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/devweeekends/VN0XII-rWbxEMed4/_generated/favicon/favicon-16x16.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/devweeekends/VN0XII-rWbxEMed4/_generated/favicon/favicon-32x32.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/devweeekends/VN0XII-rWbxEMed4/_generated/favicon/favicon.ico\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/devweeekends/VN0XII-rWbxEMed4/_generated/favicon-dark/android-chrome-192x192.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/devweeekends/VN0XII-rWbxEMed4/_generated/favicon-dark/favicon-16x16.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/devweeekends/VN0XII-rWbxEMed4/_generated/favicon-dark/favicon-32x32.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/devweeekends/VN0XII-rWbxEMed4/_generated/favicon-dark/favicon.ico\" media=\"(prefers-color-scheme: dark)\">\u003cmeta data-mint-head property=\"og:title\" content=\"Statistical Inference: Conclusions from Samples - Dev Weekends\">\u003cmeta data-mint-head property=\"og:description\" content=\"How to draw reliable conclusions about millions from just hundreds of observations\">\u003cmeta data-mint-head property=\"og:site_name\" content=\"Dev Weekends\">\u003cmeta data-mint-head property=\"og:url\" content=\"https://resources.devweekends.com/courses/statistics-for-ml/05-inference\">\u003cmeta data-mint-head property=\"og:type\" content=\"website\">\u003cmeta data-mint-head property=\"og:image\" content=\"https://devweeekends.mintlify.site/_mintlify/api/og/v2?division=Probability+%26+Statistics+for+ML\u0026amp;title=Statistical+Inference%3A+Conclusions+from+Samples\u0026amp;description=How+to+draw+reliable+conclusions+about+millions+from+just+hundreds+of+observations\u0026amp;theme=97ffacf68ee2a7d59a7fcf65\u0026amp;signature=05b4082a92774e6a75b8bc40ec03455f9495d03bf3a94635cb0cdc39d989b25a\">\u003cmeta data-mint-head property=\"og:image:width\" content=\"1200\">\u003cmeta data-mint-head property=\"og:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"twitter:card\" content=\"summary_large_image\">\u003cmeta data-mint-head name=\"twitter:title\" content=\"Statistical Inference: Conclusions from Samples - Dev Weekends\">\u003cmeta data-mint-head name=\"twitter:description\" content=\"How to draw reliable conclusions about millions from just hundreds of observations\">\u003cmeta data-mint-head name=\"twitter:image\" content=\"https://devweeekends.mintlify.site/_mintlify/api/og/v2?division=Probability+%26+Statistics+for+ML\u0026amp;title=Statistical+Inference%3A+Conclusions+from+Samples\u0026amp;description=How+to+draw+reliable+conclusions+about+millions+from+just+hundreds+of+observations\u0026amp;theme=97ffacf68ee2a7d59a7fcf65\u0026amp;signature=05b4082a92774e6a75b8bc40ec03455f9495d03bf3a94635cb0cdc39d989b25a\">\u003cmeta data-mint-head name=\"twitter:image:width\" content=\"1200\">\u003cmeta data-mint-head name=\"twitter:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"msapplication-config\" content=\"/mintlify-assets/_mintlify/favicons/devweeekends/VN0XII-rWbxEMed4/_generated/favicon/browserconfig.xml\">\u003cmeta data-mint-head name=\"apple-mobile-web-app-title\" content=\"Dev Weekends\">\u003cmeta data-mint-head name=\"msapplication-TileColor\" content=\"#000000\">\u003clink data-mint-head rel=\"canonical\" href=\"https://resources.devweekends.com/courses/statistics-for-ml/05-inference\">\u003clink data-mint-head rel=\"alternate\" type=\"application/xml\" href=\"/sitemap.xml\">\u003clink data-mint-head rel=\"alternate\" type=\"text/markdown\" href=\"/courses/statistics-for-ml/05-inference.md\">\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@graph\":[{\"@type\":\"Organization\",\"@id\":\"https://resources.devweekends.com/#organization\",\"name\":\"Dev Weekends\",\"url\":\"https://resources.devweekends.com\"},{\"@type\":\"WebSite\",\"@id\":\"https://resources.devweekends.com#website\",\"name\":\"Dev Weekends\",\"url\":\"https://resources.devweekends.com\",\"publisher\":{\"@id\":\"https://resources.devweekends.com/#organization\"}},{\"@type\":\"WebPage\",\"@id\":\"https://resources.devweekends.com/courses/statistics-for-ml/05-inference#webpage\",\"url\":\"https://resources.devweekends.com/courses/statistics-for-ml/05-inference\",\"name\":\"Statistical Inference: Conclusions from Samples\",\"description\":\"How to draw reliable conclusions about millions from just hundreds of observations\",\"dateModified\":\"2026-05-16T10:37:06.809Z\",\"isPartOf\":{\"@id\":\"https://resources.devweekends.com#website\"},\"breadcrumb\":{\"@id\":\"https://resources.devweekends.com/courses/statistics-for-ml/05-inference#breadcrumb\"}},{\"@type\":\"BreadcrumbList\",\"@id\":\"https://resources.devweekends.com/courses/statistics-for-ml/05-inference#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Probability \u0026 Statistics for ML\",\"item\":\"https://resources.devweekends.com/courses/statistics-for-ml/01-introduction\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Statistical Inference: Conclusions from Samples\",\"item\":\"https://resources.devweekends.com/courses/statistics-for-ml/05-inference\"}]},{\"@type\":[\"Article\",\"TechArticle\"],\"@id\":\"https://resources.devweekends.com/courses/statistics-for-ml/05-inference#article\",\"headline\":\"Statistical Inference: Conclusions from Samples\",\"name\":\"Statistical Inference: Conclusions from Samples\",\"description\":\"How to draw reliable conclusions about millions from just hundreds of observations\",\"url\":\"https://resources.devweekends.com/courses/statistics-for-ml/05-inference\",\"mainEntityOfPage\":{\"@id\":\"https://resources.devweekends.com/courses/statistics-for-ml/05-inference#webpage\"},\"dateModified\":\"2026-05-16T10:37:06.809Z\",\"publisher\":{\"@id\":\"https://resources.devweekends.com/#organization\"},\"isPartOf\":{\"@id\":\"https://resources.devweekends.com#website\"}}]}\u003c/script>\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@type\":\"WebSite\",\"name\":\"Dev Weekends\",\"publisher\":{\"@type\":\"Organization\",\"name\":\"Dev Weekends\"},\"provider\":{\"@type\":\"Organization\",\"name\":\"Mintlify\",\"url\":\"https://mintlify.com\"}}\u003c/script>","agentPointerHref":"/courses/statistics-for-ml/05-inference.md","siteName":"Dev Weekends","nav":{"global":{"anchors":[{"anchor":"DevWeekends","icon":"globe","href":"https://devweekends.com"}]},"anchors":[{"anchor":"Resources","icon":"book-open","pages":[{"title":"Resources","href":""}]},{"anchor":"Interview Prep","icon":"clipboard-check","pages":[{"title":"Interview Prep","href":"/resources/interview-experiences"}]},{"anchor":"DSA Patterns","icon":"code","pages":[{"title":"DSA Patterns","href":"/dsa-patterns/overview"}]},{"anchor":"Competitive Programming","icon":"trophy","pages":[{"title":"Competitive Programming","href":"/courses/competitive-programming/00-overview"}]},{"anchor":"Courses","icon":"graduation-cap","groups":[{"group":"Overview","pages":[{"title":"All Courses","icon":"graduation-cap","href":"/courses/overview"}]},{"group":"Testing \u0026 Code Quality","icon":"vial","pages":[{"title":"Sonarqube Mastery","sidebarTitle":"Sonarqube","icon":"magnifying-glass-chart","href":"/courses/testing-tools/sonarqube"},{"title":"Playwright Mastery","sidebarTitle":"Playwright","icon":"masks-theater","href":"/courses/testing-tools/playwright"},{"title":"Mocha Mastery","sidebarTitle":"Mocha","icon":"coffee-bean","href":"/courses/testing-tools/mocha"},{"title":"Jest Mastery","sidebarTitle":"Jest","icon":"jester-hat","href":"/courses/testing-tools/jest"}]},{"group":"Crash Courses","icon":"bolt","pages":[{"group":"C++","icon":"brackets-curly","pages":[{"title":"C++ Crash Course","sidebarTitle":"Overview","icon":"code","href":"/courses/cpp-crash-course/overview"},{"title":"C++ Fundamentals","sidebarTitle":"1. Fundamentals","icon":"book","href":"/courses/cpp-crash-course/fundamentals"},{"title":"Pointers \u0026 Memory","sidebarTitle":"2. Memory Mastery","icon":"memory","href":"/courses/cpp-crash-course/pointers-memory"},{"title":"Object-Oriented Programming","sidebarTitle":"3. OOP","icon":"object-group","href":"/courses/cpp-crash-course/oop"},{"title":"Standard Template Library","sidebarTitle":"4. The STL","icon":"layer-group","href":"/courses/cpp-crash-course/stl"},{"title":"Modern C++ Features","sidebarTitle":"5. Modern C++","icon":"wand-magic-sparkles","href":"/courses/cpp-crash-course/modern-cpp"}]},{"group":"Java","icon":"mug-hot","pages":[{"title":"Java Crash Course","sidebarTitle":"Overview","icon":"mug-hot","href":"/courses/java-crash-course/overview"},{"title":"Java Fundamentals","sidebarTitle":"1. Fundamentals","icon":"book","href":"/courses/java-crash-course/fundamentals"},{"title":"Object-Oriented Programming","sidebarTitle":"2. OOP","icon":"object-group","href":"/courses/java-crash-course/oop"},{"title":"Collections Framework","sidebarTitle":"3. Collections","icon":"layer-group","href":"/courses/java-crash-course/collections"},{"title":"Concurrency","sidebarTitle":"4. Concurrency","icon":"bolt","href":"/courses/java-crash-course/concurrency"},{"title":"Modern Java Features","sidebarTitle":"5. Modern Java","icon":"wand-magic-sparkles","href":"/courses/java-crash-course/modern-java"}]},{"group":"Spring Boot \u0026 Microservices","icon":"leaf","pages":[{"title":"Spring Boot \u0026 Microservices","sidebarTitle":"Overview","icon":"leaf","href":"/courses/spring-boot-microservices/00-overview"},{"title":"Spring Boot Quickstart","icon":"bolt","href":"/courses/spring-boot-microservices/01-spring-boot-quickstart"},{"title":"Spring MVC \u0026 REST","icon":"server","href":"/courses/spring-boot-microservices/02-spring-mvc-rest"},{"title":"Data Persistence","icon":"database","href":"/courses/spring-boot-microservices/03-data-persistence"},{"title":"Deep Dive: Spring AOP","icon":"microscope","href":"/courses/spring-boot-microservices/04-spring-aop"},{"title":"Testing Mastery","icon":"vial","href":"/courses/spring-boot-microservices/05-spring-testing"},{"title":"Foundations","icon":"shapes","href":"/courses/spring-boot-microservices/06-microservices-foundations"},{"title":"Service Discovery","icon":"compass","href":"/courses/spring-boot-microservices/07-service-discovery"},{"title":"API Gateway","icon":"door-open","href":"/courses/spring-boot-microservices/08-api-gateway"},{"title":"Config Management","icon":"gears","href":"/courses/spring-boot-microservices/09-config-management"},{"title":"Resilience \u0026 Fault Tolerance","icon":"shield-halved","href":"/courses/spring-boot-microservices/10-resilience"},{"title":"Observability","icon":"monitor-waveform","href":"/courses/spring-boot-microservices/11-observability"},{"title":"Event Driven Architecture","icon":"satellite-dish","href":"/courses/spring-boot-microservices/12-event-driven"},{"title":"Containerization","icon":"docker","href":"/courses/spring-boot-microservices/13-containerization"},{"title":"Capstone Project","icon":"flag-checkered","href":"/courses/spring-boot-microservices/14-capstone"}]},{"group":"JavaScript","icon":"js","pages":[{"title":"JavaScript Crash Course","sidebarTitle":"Overview","icon":"js","href":"/courses/javascript-crash-course/overview"},{"title":"JavaScript Fundamentals","sidebarTitle":"1. Fundamentals","icon":"book","href":"/courses/javascript-crash-course/fundamentals"},{"title":"Functions \u0026 Scope","sidebarTitle":"2. Functions \u0026 Scope","icon":"function","href":"/courses/javascript-crash-course/functions-scope"},{"title":"Objects \u0026 Prototypes","sidebarTitle":"3. Objects \u0026 Prototypes","icon":"object-group","href":"/courses/javascript-crash-course/objects-prototypes"},{"title":"Async JavaScript","sidebarTitle":"4. Async JavaScript","icon":"clock","href":"/courses/javascript-crash-course/async"},{"title":"Modern JavaScript (ES6+)","sidebarTitle":"5. Modern JavaScript","icon":"wand-magic-sparkles","href":"/courses/javascript-crash-course/modern-js"},{"title":"DOM \u0026 Browser APIs","sidebarTitle":"6. DOM \u0026 Browser","icon":"browser","href":"/courses/javascript-crash-course/dom-browser"}]},{"group":"TypeScript","icon":"file-code","pages":[{"title":"TypeScript Crash Course","sidebarTitle":"Overview","icon":"code","href":"/courses/typescript-crash-course/overview"},{"title":"TypeScript Fundamentals","sidebarTitle":"1. Fundamentals","icon":"book","href":"/courses/typescript-crash-course/fundamentals"},{"title":"Functions \u0026 Types","sidebarTitle":"2. Functions \u0026 Types","icon":"function","href":"/courses/typescript-crash-course/functions-types"},{"title":"Objects \u0026 Interfaces","sidebarTitle":"3. Objects \u0026 Interfaces","icon":"object-group","href":"/courses/typescript-crash-course/objects-interfaces"},{"title":"Classes \u0026 OOP","sidebarTitle":"4. Classes \u0026 OOP","icon":"sitemap","href":"/courses/typescript-crash-course/classes-oop"},{"title":"Advanced Types","sidebarTitle":"5. Advanced Types","icon":"layer-group","href":"/courses/typescript-crash-course/advanced-types"},{"title":"Generics Deep Dive","sidebarTitle":"6. Generics","icon":"puzzle-piece","href":"/courses/typescript-crash-course/generics"},{"title":"Modules \u0026 Configuration","sidebarTitle":"7. Modules \u0026 Config","icon":"gear","href":"/courses/typescript-crash-course/modules-config"}]},{"group":"Python","icon":"python","pages":[{"title":"Python Crash Course","sidebarTitle":"Overview","icon":"python","href":"/courses/python-crash-course/overview"},{"title":"Python Fundamentals","sidebarTitle":"1. Fundamentals","icon":"book","href":"/courses/python-crash-course/fundamentals"},{"title":"Data Structures","sidebarTitle":"2. Data Structures","icon":"layer-group","href":"/courses/python-crash-course/data-structures"},{"title":"Object-Oriented Programming","sidebarTitle":"3. OOP","icon":"object-group","href":"/courses/python-crash-course/oop"},{"title":"Modules \u0026 Packages","sidebarTitle":"4. Modules","icon":"box","href":"/courses/python-crash-course/modules-packages"},{"title":"Advanced Python","sidebarTitle":"5. Advanced","icon":"wand-magic-sparkles","href":"/courses/python-crash-course/advanced"}]},{"group":"Node.js","icon":"node","pages":[{"title":"01. Introduction \u0026 Setup","href":"/courses/node-crash-course/01-intro-setup"},{"title":"02. Modules System","href":"/courses/node-crash-course/02-modules"},{"title":"03. File System","href":"/courses/node-crash-course/03-file-system"},{"title":"04. Events \u0026 EventEmitter","href":"/courses/node-crash-course/04-events"},{"title":"05. HTTP Module \u0026 Web Server","href":"/courses/node-crash-course/05-http-server"},{"title":"06. Streams \u0026 Buffers","href":"/courses/node-crash-course/06-streams-buffers"},{"title":"07. NPM (Node Package Manager)","href":"/courses/node-crash-course/07-npm"},{"title":"07b. Building and Publishing an NPM Package","href":"/courses/node-crash-course/07b-building-npm-package"},{"title":"08. Express.js Basics","href":"/courses/node-crash-course/08-express-basics"},{"title":"09. Building a REST API","href":"/courses/node-crash-course/09-rest-api"},{"title":"10. Deployment \u0026 Best Practices","href":"/courses/node-crash-course/10-deployment"},{"title":"11. Authentication with JWT","href":"/courses/node-crash-course/11-auth-jwt"},{"title":"12. MongoDB \u0026 Mongoose ORM","href":"/courses/node-crash-course/12-mongo-mongoose"},{"title":"13. PostgreSQL \u0026 Prisma ORM","href":"/courses/node-crash-course/13-postgres-prisma"},{"title":"14. Error Handling \u0026 Debugging","href":"/courses/node-crash-course/14-error-handling"},{"title":"15. Testing with Jest","href":"/courses/node-crash-course/15-testing"},{"title":"16. Real-Time with WebSockets","href":"/courses/node-crash-course/16-websockets"},{"title":"17. Security Best Practices","href":"/courses/node-crash-course/17-security"},{"title":"18. Performance \u0026 Caching","href":"/courses/node-crash-course/18-performance"},{"title":"19. Microservices Architecture","href":"/courses/node-crash-course/19-microservices"},{"title":"20. TypeScript with Node.js","href":"/courses/node-crash-course/20-typescript"},{"title":"21. Worker Threads \u0026 Child Processes","href":"/courses/node-crash-course/21-worker-threads"},{"title":"22. Capstone Project: Full-Stack API","href":"/courses/node-crash-course/22-capstone"}]},{"group":"React","icon":"react","pages":[{"title":"01. Introduction to React \u0026 JSX","href":"/courses/react-crash-course/01-intro-jsx"},{"title":"02. Components \u0026 Props","href":"/courses/react-crash-course/02-components-props"},{"title":"03. State \u0026 useState Hook","href":"/courses/react-crash-course/03-state-hook"},{"title":"04. Handling Events","href":"/courses/react-crash-course/04-events"},{"title":"05. Lists \u0026 Keys","href":"/courses/react-crash-course/05-lists-keys"},{"title":"06. Forms \u0026 Controlled Components","href":"/courses/react-crash-course/06-forms"},{"title":"07. useEffect \u0026 Side Effects","href":"/courses/react-crash-course/07-useeffect"},{"title":"08. Context API","href":"/courses/react-crash-course/08-context-api"},{"title":"09. React Router","href":"/courses/react-crash-course/09-react-router"},{"title":"10. Performance Optimization","href":"/courses/react-crash-course/10-optimization"},{"title":"11. Authentication \u0026 Protected Routes","href":"/courses/react-crash-course/11-authentication"},{"title":"12. Redux \u0026 State Management","href":"/courses/react-crash-course/12-redux-state"}]},{"group":"React Native","icon":"mobile","pages":[{"title":"React Native Enterprise Mastery","icon":"mobile","href":"/courses/react-native-crash-course/overview"},{"title":"01. Introduction \u0026 Architecture","href":"/courses/react-native-crash-course/01-intro-architecture"},{"title":"02. Environment Setup","href":"/courses/react-native-crash-course/02-environment-setup"},{"title":"03. Project Structure \u0026 Best Practices","href":"/courses/react-native-crash-course/03-project-structure"},{"title":"04. TypeScript in React Native","href":"/courses/react-native-crash-course/04-typescript"},{"title":"05. Core Components Deep Dive","href":"/courses/react-native-crash-course/05-core-components"},{"title":"6. Styling \u0026 Theming","href":"/courses/react-native-crash-course/06-styling-theming"},{"title":"7. Flexbox Mastery","href":"/courses/react-native-crash-course/07-flexbox-mastery"},{"title":"8. Navigation Fundamentals","href":"/courses/react-native-crash-course/08-navigation-fundamentals"},{"title":"9. Advanced Navigation","href":"/courses/react-native-crash-course/09-navigation-advanced"},{"title":"10. State Management","href":"/courses/react-native-crash-course/10-state-management"},{"title":"11. Redux \u0026 Zustand","href":"/courses/react-native-crash-course/11-redux-zustand"},{"title":"15. React Query \u0026 Data Fetching","href":"/courses/react-native-crash-course/15-react-query"},{"title":"27. Unit Testing","href":"/courses/react-native-crash-course/27-unit-testing"},{"title":"31. Security Best Practices","href":"/courses/react-native-crash-course/31-security"},{"title":"35. Profiling \u0026 Monitoring","href":"/courses/react-native-crash-course/35-profiling"},{"title":"40. CI/CD Pipelines","href":"/courses/react-native-crash-course/40-ci-cd"},{"title":"51. Capstone Project","href":"/courses/react-native-crash-course/51-capstone"}]},{"group":"MongoDB","icon":"database","pages":[{"title":"01. Introduction to NoSQL \u0026 MongoDB","href":"/courses/mongodb-crash-course/01-intro-nosql"},{"title":"02. Installation \u0026 MongoDB Compass","href":"/courses/mongodb-crash-course/02-setup-compass"},{"title":"03. Databases \u0026 Collections","href":"/courses/mongodb-crash-course/03-databases-collections"},{"title":"04. CRUD: Create","href":"/courses/mongodb-crash-course/04-crud-create"},{"title":"05. CRUD: Read (Query Operators)","href":"/courses/mongodb-crash-course/05-crud-read"},{"title":"06. CRUD: Update","href":"/courses/mongodb-crash-course/06-crud-update"},{"title":"07. CRUD: Delete","href":"/courses/mongodb-crash-course/07-crud-delete"},{"title":"08. Aggregation Framework","href":"/courses/mongodb-crash-course/08-aggregation"},{"title":"09. Indexing \u0026 Performance","href":"/courses/mongodb-crash-course/09-indexing"},{"title":"10. Mongoose (ODM) Basics","href":"/courses/mongodb-crash-course/10-mongoose"}]},{"group":"Angular Master Course","icon":"angular","pages":[{"title":"Angular Master Course","icon":"angular","href":"/courses/angular-crash-course/00-overview"},{"title":"01. Introduction \u0026 Setup","icon":"rocket","href":"/courses/angular-crash-course/01-introduction"},{"title":"02. Components \u0026 Templates","icon":"puzzle-piece","href":"/courses/angular-crash-course/02-components"},{"title":"03. Directives \u0026 Pipes","icon":"wand-magic-sparkles","href":"/courses/angular-crash-course/03-directives-pipes"},{"title":"04. Services \u0026 Dependency Injection","icon":"syringe","href":"/courses/angular-crash-course/04-services-di"},{"title":"05. Angular Signals","icon":"signal","href":"/courses/angular-crash-course/05-signals"},{"title":"06. Routing \u0026 Navigation","icon":"route","href":"/courses/angular-crash-course/06-routing"},{"title":"07. Angular Forms","icon":"input-text","href":"/courses/angular-crash-course/07-forms"},{"title":"08. HTTP Client \u0026 RxJS","icon":"server","href":"/courses/angular-crash-course/08-http-rxjs"},{"title":"09. RxJS Deep Dive","icon":"arrows-rotate","href":"/courses/angular-crash-course/09-rxjs"},{"title":"10. Change Detection \u0026 Performance","icon":"gauge-high","href":"/courses/angular-crash-course/10-change-detection"},{"title":"11. Testing in Angular","icon":"vial","href":"/courses/angular-crash-course/11-testing"},{"title":"12. Advanced Patterns","icon":"diagram-project","href":"/courses/angular-crash-course/12-advanced-patterns"},{"title":"13. Server-Side Rendering","icon":"server","href":"/courses/angular-crash-course/13-ssr"},{"title":"14. Security Best Practices","icon":"shield-halved","href":"/courses/angular-crash-course/14-security"},{"title":"15. Capstone Project","icon":"rocket","href":"/courses/angular-crash-course/15-capstone"},{"title":"16. Standalone Components Deep Dive","icon":"cube","href":"/courses/angular-crash-course/16-standalone"},{"title":"17. NgRx State Management","icon":"database","href":"/courses/angular-crash-course/17-ngrx"},{"title":"18. Angular Animations","icon":"wand-magic-sparkles","href":"/courses/angular-crash-course/18-animations"},{"title":"19. Internationalization (i18n)","icon":"globe","href":"/courses/angular-crash-course/19-i18n"},{"title":"20. Accessibility (a11y)","icon":"universal-access","href":"/courses/angular-crash-course/20-accessibility"},{"title":"21. Angular Material \u0026 CDK","icon":"palette","href":"/courses/angular-crash-course/21-material"},{"title":"22. PWA \u0026 Service Workers","icon":"mobile-screen","href":"/courses/angular-crash-course/22-pwa"},{"title":"23. Deployment \u0026 CI/CD","icon":"rocket","href":"/courses/angular-crash-course/23-deployment"},{"title":"24. Micro-frontends with Module Federation","icon":"cubes","href":"/courses/angular-crash-course/24-micro-frontends"},{"title":"25. Nx Monorepo","icon":"boxes-stacked","href":"/courses/angular-crash-course/25-nx-monorepo"},{"title":"26. Performance Optimization","icon":"gauge-high","href":"/courses/angular-crash-course/26-performance"},{"title":"27. Content Projection","icon":"layer-group","href":"/courses/angular-crash-course/27-content-projection"},{"title":"28. Dynamic Components","icon":"wand-magic-sparkles","href":"/courses/angular-crash-course/28-dynamic-components"},{"title":"29. Custom Schematics","icon":"toolbox","href":"/courses/angular-crash-course/29-custom-schematics"},{"title":"30. Error Handling","icon":"triangle-exclamation","href":"/courses/angular-crash-course/30-error-handling"},{"title":"31. Interview Questions","icon":"comments-question","href":"/courses/angular-crash-course/31-interview-questions"},{"title":"32. Best Practices","icon":"award","href":"/courses/angular-crash-course/32-best-practices"},{"title":"33. Enterprise Capstone Project","icon":"building","href":"/courses/angular-crash-course/33-enterprise-capstone"}]}]},{"group":"AI Engineering","icon":"robot","pages":[{"title":"AI Engineering","icon":"robot","href":"/ai-engineering/overview"},{"title":"Python Crash Course","icon":"python","href":"/ai-engineering/python-crash-course"},{"title":"FastAPI Crash Course","icon":"bolt","href":"/ai-engineering/fastapi-crash-course"},{"title":"Databases \u0026 ORM Crash Course","icon":"database","href":"/ai-engineering/databases-crash-course"},{"title":"LLM Fundamentals","icon":"brain","href":"/ai-engineering/llm-fundamentals"},{"title":"Prompt Engineering","icon":"wand-magic-sparkles","href":"/ai-engineering/prompt-engineering"},{"title":"OpenAI API","icon":"bolt","href":"/ai-engineering/openai-api"},{"title":"Structured Outputs","icon":"brackets-curly","href":"/ai-engineering/structured-outputs"},{"title":"Embeddings Deep Dive","icon":"vector-square","href":"/ai-engineering/embeddings"},{"title":"AI Streaming","icon":"water","href":"/ai-engineering/streaming"},{"title":"Vector Databases","icon":"database","href":"/ai-engineering/vector-databases"},{"title":"RAG Systems","icon":"magnifying-glass","href":"/ai-engineering/rag"},{"title":"Types of RAG","icon":"layer-group","href":"/ai-engineering/rag-types"},{"title":"Fine-Tuning LLMs","icon":"sliders","href":"/ai-engineering/fine-tuning"},{"title":"AI Agents","icon":"robot","href":"/ai-engineering/agents"},{"title":"Tool Calling \u0026 Function Calling","icon":"wrench","href":"/ai-engineering/tool-calling"},{"title":"LLM Memory Systems","icon":"brain","href":"/ai-engineering/llm-memory-systems"},{"title":"Multi-Agent Design Patterns","icon":"users-gear","href":"/ai-engineering/multi-agent-patterns"},{"title":"LangChain","icon":"link","href":"/ai-engineering/langchain"},{"title":"LangGraph","icon":"diagram-project","href":"/ai-engineering/langgraph"},{"title":"Model Context Protocol (MCP)","icon":"plug","href":"/ai-engineering/mcp"},{"title":"Agentic Architecture","icon":"sitemap","href":"/ai-engineering/agentic-architecture"},{"title":"Open Source \u0026 Local LLMs","icon":"server","href":"/ai-engineering/open-source-llms"},{"title":"Multimodal AI","icon":"photo-film","href":"/ai-engineering/multimodal-ai"},{"title":"DSPy Framework","icon":"code","href":"/ai-engineering/dspy"},{"title":"Prompt Management \u0026 Versioning","icon":"code-branch","href":"/ai-engineering/prompt-management"},{"title":"LLM Caching","icon":"database","href":"/ai-engineering/llm-caching"},{"title":"Error Handling \u0026 Resilience","icon":"shield-halved","href":"/ai-engineering/error-handling"},{"title":"Batch Processing \u0026 Rate Limiting","icon":"layer-group","href":"/ai-engineering/batch-processing"},{"title":"LLM Fallbacks \u0026 Model Routing","icon":"arrows-split-up-and-left","href":"/ai-engineering/llm-fallbacks"},{"title":"AI Observability \u0026 Monitoring","icon":"chart-line","href":"/ai-engineering/observability-monitoring"},{"title":"AI Security \u0026 Guardrails","icon":"shield-halved","href":"/ai-engineering/ai-security-guardrails"},{"title":"Cost Optimization \u0026 Token Management","icon":"coins","href":"/ai-engineering/cost-optimization"},{"title":"Function Calling Deep Dive","icon":"function","href":"/ai-engineering/function-calling"},{"title":"LLM Orchestration","icon":"sitemap","href":"/ai-engineering/llm-orchestration"},{"title":"Semantic Search \u0026 Retrieval","icon":"magnifying-glass","href":"/ai-engineering/semantic-search"},{"title":"Context Window Management","icon":"window-maximize","href":"/ai-engineering/context-management"},{"title":"Testing LLM Applications","icon":"flask-vial","href":"/ai-engineering/llm-testing"},{"title":"Production Logging \u0026 Debugging","icon":"file-lines","href":"/ai-engineering/production-logging"},{"title":"API Design for AI Applications","icon":"code","href":"/ai-engineering/api-design"},{"title":"Document Processing","icon":"file-lines","href":"/ai-engineering/document-processing"},{"title":"Model Comparison","icon":"scale-balanced","href":"/ai-engineering/model-comparison"},{"title":"Anthropic Claude API","icon":"message-bot","href":"/ai-engineering/anthropic-api"},{"title":"Async Patterns for LLMs","icon":"arrows-spin","href":"/ai-engineering/async-patterns"},{"title":"Advanced Prompting Techniques","icon":"brain","href":"/ai-engineering/advanced-prompting"},{"title":"Output Validation","icon":"shield-check","href":"/ai-engineering/output-validation"},{"title":"Semantic Routing","icon":"route","href":"/ai-engineering/semantic-routing"},{"title":"Advanced RAG Techniques","icon":"layer-group","href":"/ai-engineering/advanced-rag"},{"title":"Voice and Audio AI","icon":"microphone","href":"/ai-engineering/voice-audio"},{"title":"Image Generation","icon":"image","href":"/ai-engineering/image-generation"},{"title":"Summarization Systems","icon":"compress","href":"/ai-engineering/summarization"},{"title":"Chatbot Design Patterns","icon":"comments","href":"/ai-engineering/chatbot-patterns"},{"title":"Knowledge Graphs with LLMs","icon":"diagram-project","href":"/ai-engineering/knowledge-graphs"},{"title":"Synthetic Data Generation","icon":"database","href":"/ai-engineering/synthetic-data"},{"title":"Text Classification","icon":"tags","href":"/ai-engineering/classification"},{"title":"Model Optimization","icon":"gauge-high","href":"/ai-engineering/model-optimization"},{"title":"Realtime AI Applications","icon":"bolt","href":"/ai-engineering/realtime-ai"},{"title":"Evaluation \u0026 Testing","icon":"vial","href":"/ai-engineering/evaluation-testing"},{"title":"Deployment \u0026 Scaling","icon":"rocket","href":"/ai-engineering/deployment-scaling"},{"title":"Capstone Project","icon":"trophy","href":"/ai-engineering/capstone-project"}]},{"group":"Math for ML - Understanding Linear Algebra","icon":"square-root-variable","pages":[{"title":"Introduction to Linear Algebra for ML","sidebarTitle":"Introduction","icon":"rocket","href":"/courses/math-for-ml-linear-algebra/01-introduction"},{"title":"Vectors: The Language of Similarity","sidebarTitle":"Vectors","icon":"arrow-right","href":"/courses/math-for-ml-linear-algebra/02-vectors"},{"title":"Matrices \u0026 Linear Transformations","sidebarTitle":"Matrices","icon":"grid","href":"/courses/math-for-ml-linear-algebra/03-matrices"},{"title":"Project: Image Similarity Search Engine","sidebarTitle":"Project 1","icon":"code","href":"/courses/math-for-ml-linear-algebra/04-project-image-search"},{"title":"Eigenvalues \u0026 Eigenvectors","sidebarTitle":"Eigenvalues","icon":"compass","href":"/courses/math-for-ml-linear-algebra/05-eigenvalues"},{"title":"Principal Component Analysis (PCA)","sidebarTitle":"PCA","icon":"compress","href":"/courses/math-for-ml-linear-algebra/06-pca"},{"title":"Singular Value Decomposition (SVD)","sidebarTitle":"SVD","icon":"layer-group","href":"/courses/math-for-ml-linear-algebra/07-svd"},{"title":"Linear Systems \u0026 Applications","sidebarTitle":"Linear Systems","icon":"diagram-project","href":"/courses/math-for-ml-linear-algebra/08-linear-systems"},{"title":"Project: Music Recommendation Engine","sidebarTitle":"Project 2","icon":"music","href":"/courses/math-for-ml-linear-algebra/09-project-recommender"},{"title":"Orthogonality \u0026 Projections","sidebarTitle":"Orthogonality","icon":"right-left","href":"/courses/math-for-ml-linear-algebra/10-orthogonality"}]},{"group":"Probability \u0026 Statistics for ML","icon":"chart-bar","pages":[{"title":"Probability and Statistics for Machine Learning","sidebarTitle":"Introduction","icon":"chart-line","href":"/courses/statistics-for-ml/01-introduction"},{"title":"Describing Data: What's Normal?","sidebarTitle":"Describing Data","icon":"chart-bar","href":"/courses/statistics-for-ml/02-describing-data"},{"title":"Probability Foundations: How Likely Is This?","sidebarTitle":"Probability","icon":"dice","href":"/courses/statistics-for-ml/03-probability"},{"title":"Probability Distributions: Patterns in Randomness","sidebarTitle":"Distributions","description":"Discover the bell curve and other patterns that govern everything from test scores to stock prices","icon":"chart-bell","href":"/courses/statistics-for-ml/04-distributions"},{"title":"Statistical Inference: Conclusions from Samples","sidebarTitle":"Inference","icon":"magnifying-glass-chart","href":"/courses/statistics-for-ml/05-inference"},{"title":"Hypothesis Testing: Real Effect or Random Noise?","sidebarTitle":"Hypothesis Testing","description":"The scientific method for determining if differences are meaningful","icon":"scale-balanced","href":"/courses/statistics-for-ml/06-hypothesis-testing"},{"title":"Correlation and Regression: Relationships and Predictions","sidebarTitle":"Regression","icon":"chart-line-up","href":"/courses/statistics-for-ml/07-regression"},{"title":"From Statistics to Machine Learning","sidebarTitle":"Stats to ML","icon":"brain","href":"/courses/statistics-for-ml/08-statistics-to-ml"},{"title":"Bayesian Statistics","sidebarTitle":"Bayesian Statistics","icon":"brain-circuit","href":"/courses/statistics-for-ml/09-bayesian-statistics"},{"title":"Time Series Fundamentals","sidebarTitle":"Time Series","icon":"chart-line","href":"/courses/statistics-for-ml/10-time-series-basics"},{"title":"Capstone Project: Complete Statistical Analysis","sidebarTitle":"Capstone Project","icon":"graduation-cap","href":"/courses/statistics-for-ml/11-capstone-project"}]},{"group":"Math for ML - Understanding Calculus","icon":"function","pages":[{"title":"Calculus for Machine Learning","sidebarTitle":"Introduction","icon":"function","href":"/courses/math-for-ml-calculus/00-introduction"},{"title":"Derivatives \u0026 Rates of Change","sidebarTitle":"Derivatives","icon":"chart-line","href":"/courses/math-for-ml-calculus/01-derivatives"},{"title":"Gradients \u0026 Multivariable Calculus","sidebarTitle":"Gradients","icon":"mountain","href":"/courses/math-for-ml-calculus/02-gradients"},{"title":"Chain Rule \u0026 Backpropagation","sidebarTitle":"Chain Rule","icon":"link","href":"/courses/math-for-ml-calculus/03-chain-rule"},{"title":"Gradient Descent","sidebarTitle":"Gradient Descent","icon":"arrow-trend-down","href":"/courses/math-for-ml-calculus/04-gradient-descent"},{"title":"Optimization Techniques","sidebarTitle":"Optimization","icon":"rocket","href":"/courses/math-for-ml-calculus/05-optimization"},{"title":"Final Project: Build a Neural Network","sidebarTitle":"Final Project","icon":"flag-checkered","href":"/courses/math-for-ml-calculus/06-final-project"},{"title":"Automatic Differentiation","sidebarTitle":"Autodiff","icon":"wand-magic-sparkles","href":"/courses/math-for-ml-calculus/07-automatic-differentiation"},{"title":"Convex Optimization","sidebarTitle":"Convexity","icon":"bowl-rice","href":"/courses/math-for-ml-calculus/08-convexity"},{"title":"Real-World Applications","sidebarTitle":"Applications","icon":"industry","href":"/courses/math-for-ml-calculus/09-real-world-applications"}]},{"group":"ML Mastery","icon":"brain","pages":[{"title":"Machine Learning Mastery","sidebarTitle":"Introduction","icon":"brain","href":"/courses/ml-mastery/00-introduction"},{"title":"The Prediction Game","sidebarTitle":"Prediction Game","icon":"crosshairs","href":"/courses/ml-mastery/01-prediction-game"},{"title":"Learning From Mistakes","sidebarTitle":"Learning From Mistakes","icon":"graduation-cap","href":"/courses/ml-mastery/02-learning-from-mistakes"},{"title":"Linear Regression","sidebarTitle":"Linear Regression","icon":"chart-line","href":"/courses/ml-mastery/03-linear-regression"},{"title":"Classification","sidebarTitle":"Classification","icon":"tags","href":"/courses/ml-mastery/04-classification"},{"title":"K-Nearest Neighbors","sidebarTitle":"K-Nearest Neighbors","icon":"people-arrows","href":"/courses/ml-mastery/04a-knn"},{"title":"Decision Trees","sidebarTitle":"Decision Trees","icon":"sitemap","href":"/courses/ml-mastery/05-decision-trees"},{"title":"Support Vector Machines","sidebarTitle":"SVM","icon":"border-none","href":"/courses/ml-mastery/05a-svm"},{"title":"Naive Bayes","sidebarTitle":"Naive Bayes","icon":"percent","href":"/courses/ml-mastery/05b-naive-bayes"},{"title":"Ensemble Methods","sidebarTitle":"Ensemble Methods","icon":"people-group","href":"/courses/ml-mastery/06-ensemble-methods"},{"title":"Model Evaluation","sidebarTitle":"Model Evaluation","icon":"chart-column","href":"/courses/ml-mastery/07-model-evaluation"},{"title":"Feature Engineering","sidebarTitle":"Feature Engineering","icon":"wand-magic-sparkles","href":"/courses/ml-mastery/08-feature-engineering"},{"title":"Hyperparameter Tuning","sidebarTitle":"Hyperparameter Tuning","icon":"sliders","href":"/courses/ml-mastery/09-hyperparameter-tuning"},{"title":"End-to-End ML Project","sidebarTitle":"End-to-End Project","icon":"rocket","href":"/courses/ml-mastery/10-end-to-end-project"},{"title":"Clustering","sidebarTitle":"Clustering","icon":"object-group","href":"/courses/ml-mastery/11-clustering"},{"title":"Neural Networks","sidebarTitle":"Neural Networks","icon":"network-wired","href":"/courses/ml-mastery/12-neural-networks"},{"title":"Regularization","sidebarTitle":"Regularization","icon":"shield-halved","href":"/courses/ml-mastery/13-regularization"},{"title":"Model Deployment","sidebarTitle":"Deployment","icon":"rocket","href":"/courses/ml-mastery/14-model-deployment"},{"title":"Time Series Forecasting","sidebarTitle":"Time Series","icon":"clock","href":"/courses/ml-mastery/15-time-series"},{"title":"Bias-Variance Tradeoff","sidebarTitle":"Bias-Variance","icon":"scale-balanced","href":"/courses/ml-mastery/16-bias-variance"},{"title":"Data Leakage","sidebarTitle":"Data Leakage","icon":"droplet","href":"/courses/ml-mastery/17-data-leakage"},{"title":"Dimensionality Reduction","sidebarTitle":"Dimensionality Reduction","icon":"compress","href":"/courses/ml-mastery/18-dimensionality-reduction"},{"title":"Capstone Project","sidebarTitle":"Capstone Project","icon":"graduation-cap","href":"/courses/ml-mastery/19-capstone-project"},{"title":"Handling Imbalanced Data","sidebarTitle":"Imbalanced Data","icon":"scale-unbalanced","href":"/courses/ml-mastery/20-imbalanced-data"},{"title":"Model Explainability","sidebarTitle":"Explainability","icon":"lightbulb","href":"/courses/ml-mastery/21-explainability"},{"title":"ML Pipelines","sidebarTitle":"ML Pipelines","icon":"diagram-project","href":"/courses/ml-mastery/22-ml-pipelines"},{"title":"Common ML Mistakes","sidebarTitle":"Common Mistakes","icon":"triangle-exclamation","href":"/courses/ml-mastery/23-common-mistakes"},{"title":"Cross-Validation Strategies","sidebarTitle":"Cross-Validation","icon":"layer-group","href":"/courses/ml-mastery/24-cross-validation"},{"title":"Anomaly Detection","sidebarTitle":"Anomaly Detection","icon":"magnifying-glass-chart","href":"/courses/ml-mastery/25-anomaly-detection"},{"title":"ML at Scale","sidebarTitle":"ML at Scale","icon":"server","href":"/courses/ml-mastery/26-ml-at-scale"}]},{"group":"Deep Learning Mastery","icon":"network-wired","pages":[{"title":"Deep Learning Mastery","sidebarTitle":"Overview","icon":"brain-circuit","href":"/courses/deep-learning-mastery/00-overview"},{"title":"The Deep Learning Landscape","sidebarTitle":"Deep Learning Landscape","icon":"map","href":"/courses/deep-learning-mastery/01-landscape"},{"title":"Perceptrons \u0026 Multi-Layer Networks","sidebarTitle":"Perceptrons \u0026 MLPs","icon":"circle-nodes","href":"/courses/deep-learning-mastery/02-perceptrons-mlp"},{"title":"Backpropagation Deep Dive","sidebarTitle":"Backpropagation","icon":"arrows-rotate","href":"/courses/deep-learning-mastery/03-backpropagation"},{"title":"Activation Functions","sidebarTitle":"Activation Functions","icon":"bolt","href":"/courses/deep-learning-mastery/04-activation-functions"},{"title":"Loss Functions \u0026 Objectives","sidebarTitle":"Loss Functions","icon":"crosshairs","href":"/courses/deep-learning-mastery/05-loss-functions"},{"title":"Convolutional Neural Networks","sidebarTitle":"CNNs","icon":"layer-group","href":"/courses/deep-learning-mastery/06-cnns"},{"title":"Pooling, Stride \u0026 CNN Design","sidebarTitle":"CNN Design","icon":"layer-group","href":"/courses/deep-learning-mastery/07-cnn-design"},{"title":"Recurrent Neural Networks","sidebarTitle":"RNNs","icon":"rotate-right","href":"/courses/deep-learning-mastery/08-rnns"},{"title":"LSTMs \u0026 GRUs","sidebarTitle":"LSTMs \u0026 GRUs","icon":"memory","href":"/courses/deep-learning-mastery/09-lstms-grus"},{"title":"Attention Mechanism","sidebarTitle":"Attention","icon":"eye","href":"/courses/deep-learning-mastery/10-attention"},{"title":"Transformers","sidebarTitle":"Transformers","icon":"bolt","href":"/courses/deep-learning-mastery/11-transformers"},{"title":"Generative Adversarial Networks","sidebarTitle":"GANs","icon":"masks-theater","href":"/courses/deep-learning-mastery/12-gans"},{"title":"Autoencoders \u0026 VAEs","sidebarTitle":"Autoencoders","icon":"compress","href":"/courses/deep-learning-mastery/13-autoencoders"},{"title":"Diffusion Models","sidebarTitle":"Diffusion Models","icon":"cloud","href":"/courses/deep-learning-mastery/14-diffusion"},{"title":"Residual \u0026 Skip Connections","sidebarTitle":"Residual Networks","icon":"diagram-project","href":"/courses/deep-learning-mastery/15-residual-networks"},{"title":"Normalization Techniques","sidebarTitle":"Normalization","icon":"sliders","href":"/courses/deep-learning-mastery/16-normalization"},{"title":"Regularization Techniques","sidebarTitle":"Regularization","icon":"shield","href":"/courses/deep-learning-mastery/17-regularization"},{"title":"Optimization Algorithms","sidebarTitle":"Optimizers","icon":"gauge-high","href":"/courses/deep-learning-mastery/18-optimization"},{"title":"Training Strategies at Scale","sidebarTitle":"Scale Training","icon":"server","href":"/courses/deep-learning-mastery/19-training-strategies"},{"title":"Transfer Learning \u0026 Fine-tuning","sidebarTitle":"Transfer Learning","icon":"arrows-repeat","href":"/courses/deep-learning-mastery/20-transfer-learning"},{"title":"Model Deployment","sidebarTitle":"Deployment","icon":"rocket","href":"/courses/deep-learning-mastery/21-deployment"},{"title":"Debugging Deep Learning","sidebarTitle":"Debugging","icon":"bug","href":"/courses/deep-learning-mastery/22-debugging"},{"title":"Vision Transformers","sidebarTitle":"Vision Transformers","icon":"eye","href":"/courses/deep-learning-mastery/23-vision-transformers"},{"title":"Multimodal Models","sidebarTitle":"Multimodal","icon":"images","href":"/courses/deep-learning-mastery/24-multimodal"},{"title":"Foundation Models \u0026 LLMs","sidebarTitle":"Foundation Models","icon":"brain","href":"/courses/deep-learning-mastery/25-foundation-models"},{"title":"Capstone Project","sidebarTitle":"Capstone","icon":"flag-checkered","href":"/courses/deep-learning-mastery/26-capstone"},{"title":"Mathematical Foundations for Deep Learning","sidebarTitle":"Math Foundations","icon":"square-root-variable","href":"/courses/deep-learning-mastery/27-math-foundations"},{"title":"Weight Initialization Strategies","sidebarTitle":"Weight Initialization","icon":"seedling","href":"/courses/deep-learning-mastery/28-weight-initialization"},{"title":"Gradient Flow Analysis","sidebarTitle":"Gradient Flow","icon":"wave-pulse","href":"/courses/deep-learning-mastery/29-gradient-flow"},{"title":"Advanced CNN Architectures","sidebarTitle":"CNN Architectures","icon":"layer-group","href":"/courses/deep-learning-mastery/30-cnn-architectures"},{"title":"Sequence-to-Sequence Models","sidebarTitle":"Seq2Seq","icon":"arrows-left-right","href":"/courses/deep-learning-mastery/31-seq2seq"},{"title":"Self-Supervised Learning","sidebarTitle":"Self-Supervised Learning","icon":"brain","href":"/courses/deep-learning-mastery/32-self-supervised"},{"title":"Reinforcement Learning for Deep Learning","sidebarTitle":"RL for Deep Learning","icon":"gamepad","href":"/courses/deep-learning-mastery/33-rl-for-dl"},{"title":"Neural Architecture Search","sidebarTitle":"Neural Architecture Search","icon":"magnifying-glass","href":"/courses/deep-learning-mastery/34-nas"},{"title":"Interpretability \u0026 Explainability","sidebarTitle":"Interpretability","icon":"eye","href":"/courses/deep-learning-mastery/35-interpretability"},{"title":"Adversarial Robustness","sidebarTitle":"Adversarial ML","icon":"shield-halved","href":"/courses/deep-learning-mastery/36-adversarial-robustness"},{"title":"Efficient Neural Network Architectures","sidebarTitle":"Efficient Architectures","icon":"bolt","href":"/courses/deep-learning-mastery/37-efficient-architectures"},{"title":"Graph Neural Networks","sidebarTitle":"Graph Networks","icon":"diagram-project","href":"/courses/deep-learning-mastery/38-graph-neural-networks"},{"title":"3D Deep Learning","sidebarTitle":"3D Deep Learning","icon":"cube","href":"/courses/deep-learning-mastery/39-3d-deep-learning"},{"title":"Object Detection Deep Dive","sidebarTitle":"Object Detection","icon":"vector-square","href":"/courses/deep-learning-mastery/40-object-detection"},{"title":"Semantic Segmentation","sidebarTitle":"Segmentation","icon":"object-group","href":"/courses/deep-learning-mastery/41-semantic-segmentation"},{"title":"Hyperparameter Tuning","sidebarTitle":"Hyperparameter Tuning","icon":"sliders","href":"/courses/deep-learning-mastery/42-hyperparameter-tuning"},{"title":"Reproducibility","sidebarTitle":"Reproducibility","icon":"repeat","href":"/courses/deep-learning-mastery/43-reproducibility"},{"title":"Memory-Efficient Training","sidebarTitle":"Memory-Efficient Training","icon":"memory","href":"/courses/deep-learning-mastery/44-memory-efficient-training"},{"title":"Quantization Deep Dive","sidebarTitle":"Quantization Deep Dive","icon":"compress","href":"/courses/deep-learning-mastery/45-quantization-deep-dive"},{"title":"Knowledge Distillation","sidebarTitle":"Knowledge Distillation","icon":"school","href":"/courses/deep-learning-mastery/46-knowledge-distillation"},{"title":"Continual Learning","sidebarTitle":"Continual Learning","icon":"arrows-rotate","href":"/courses/deep-learning-mastery/47-continual-learning"}]},{"group":"NestJS Mastery","icon":"feather","pages":[{"title":"NestJS Mastery","sidebarTitle":"Course Overview","icon":"node","href":"/courses/nestjs/overview"},{"title":"NestJS Fundamentals","sidebarTitle":"1. Fundamentals","icon":"book","href":"/courses/nestjs/fundamentals"},{"title":"Dependency Injection","sidebarTitle":"2. DI \u0026 Modules","icon":"puzzle-piece","href":"/courses/nestjs/dependency-injection"},{"title":"Controllers \u0026 Routing","sidebarTitle":"3. Controllers","icon":"route","href":"/courses/nestjs/controllers-routes"},{"title":"Providers \u0026 Services","sidebarTitle":"4. Providers","icon":"gear","href":"/courses/nestjs/providers-services"},{"title":"Database Integration","sidebarTitle":"5. Database","icon":"database","href":"/courses/nestjs/database-integration"},{"title":"Authentication \u0026 Authorization","sidebarTitle":"6. Auth","icon":"lock","href":"/courses/nestjs/authentication-authorization"},{"title":"Testing","sidebarTitle":"7. Testing","icon":"flask","href":"/courses/nestjs/testing"},{"title":"Microservices","sidebarTitle":"8. Microservices","icon":"cubes","href":"/courses/nestjs/microservices"},{"title":"Deployment \u0026 Production","sidebarTitle":"9. Deployment","icon":"rocket","href":"/courses/nestjs/deployment-production"},{"title":"Advanced Patterns","sidebarTitle":"10. Advanced","icon":"star","href":"/courses/nestjs/advanced-patterns"}]},{"group":"Microservices Mastery","icon":"cubes","pages":[{"title":"Microservices Mastery","sidebarTitle":"Course Overview","icon":"cubes","href":"/courses/microservices-mastery/00-overview"},{"title":"1. Microservices Foundations","href":"/courses/microservices-mastery/01-foundations"},{"title":"2. Domain-Driven Design","href":"/courses/microservices-mastery/02-domain-driven-design"},{"title":"3. Synchronous Communication","href":"/courses/microservices-mastery/03-sync-communication"},{"title":"4. Asynchronous Communication","href":"/courses/microservices-mastery/04-async-communication"},{"title":"5. API Gateway Pattern","href":"/courses/microservices-mastery/05-api-gateway"},{"title":"6. Data Management Patterns","href":"/courses/microservices-mastery/06-data-management"},{"title":"7. Resilience Patterns","href":"/courses/microservices-mastery/07-resilience-patterns"},{"title":"8. Service Discovery","href":"/courses/microservices-mastery/08-service-discovery"},{"title":"9. Observability","href":"/courses/microservices-mastery/09-observability"},{"title":"10. Security","href":"/courses/microservices-mastery/10-security"},{"title":"11. Containerization with Docker","href":"/courses/microservices-mastery/11-containerization"},{"title":"12. Kubernetes Deployment","href":"/courses/microservices-mastery/12-kubernetes"},{"title":"13. Testing Strategies","href":"/courses/microservices-mastery/13-testing"},{"title":"14. Interview Preparation","href":"/courses/microservices-mastery/14-interview-prep"},{"title":"15. Capstone Project","href":"/courses/microservices-mastery/15-capstone"},{"title":"16. Service Mesh","href":"/courses/microservices-mastery/16-service-mesh"},{"title":"17. Configuration Management","href":"/courses/microservices-mastery/17-configuration-management"},{"title":"18. CI/CD for Microservices","href":"/courses/microservices-mastery/18-cicd"},{"title":"19. Database Patterns","href":"/courses/microservices-mastery/19-database-patterns"},{"title":"20. Caching Strategies","href":"/courses/microservices-mastery/20-caching-strategies"},{"title":"21. Chaos Engineering","href":"/courses/microservices-mastery/21-chaos-engineering"},{"title":"22. Case Studies","href":"/courses/microservices-mastery/22-case-studies"},{"title":"23. Load Balancing Deep Dive","href":"/courses/microservices-mastery/23-load-balancing"},{"title":"24. Migration Patterns","href":"/courses/microservices-mastery/24-migration-patterns"},{"title":"25. Event Sourcing Deep Dive","href":"/courses/microservices-mastery/25-event-sourcing-deep-dive"},{"title":"26. GraphQL Federation","href":"/courses/microservices-mastery/26-graphql-federation"}]},{"group":"Low Level Design","pages":[{"title":"Low Level Design (LLD)","icon":"cubes","href":"/lld/overview"},{"title":"LLD Interview Cheat Sheet","icon":"file-lines","href":"/lld/interview-cheatsheet"}]},{"group":"OOP Concepts","pages":[{"title":"What is OOP?","icon":"graduation-cap","href":"/lld/oop/introduction"},{"title":"Encapsulation","icon":"box","href":"/lld/oop/encapsulation"},{"title":"Inheritance","icon":"sitemap","href":"/lld/oop/inheritance"},{"title":"Polymorphism","icon":"shapes","href":"/lld/oop/polymorphism"},{"title":"Abstraction","icon":"eye-slash","href":"/lld/oop/abstraction"},{"title":"OOP Concepts","icon":"object-group","href":"/lld/oop-concepts"}]},{"group":"SOLID Principles","pages":[{"title":"SOLID Introduction","icon":"wand-magic-sparkles","href":"/lld/solid/introduction"},{"title":"Single Responsibility Principle","icon":"user-check","href":"/lld/solid/srp"},{"title":"Open/Closed Principle","icon":"plug","href":"/lld/solid/ocp"},{"title":"Liskov Substitution Principle","icon":"right-left","href":"/lld/solid/lsp"},{"title":"Interface Segregation Principle","icon":"puzzle-piece","href":"/lld/solid/isp"},{"title":"Dependency Inversion Principle","icon":"outlet","href":"/lld/solid/dip"},{"title":"SOLID Principles in Practice","icon":"compass-drafting","href":"/lld/solid-practice"}]},{"group":"Design Patterns","pages":[{"title":"Design Patterns","icon":"shapes","href":"/lld/design-patterns"},{"title":"UML Diagrams","icon":"diagram-project","href":"/lld/uml-diagrams"}]},{"group":"LLD Case Studies","pages":[{"title":"Case Study: Parking Lot System","icon":"square-parking","href":"/lld/case-parking-lot"},{"title":"Case Study: Library Management System","icon":"book","href":"/lld/case-library"},{"title":"Design Vending Machine","icon":"box","href":"/lld/case-vending-machine"},{"title":"Design LRU Cache","icon":"database","href":"/lld/case-lru-cache"},{"title":"Design Movie Ticket Booking System","icon":"ticket","href":"/lld/case-movie-ticket"},{"title":"Case Study: Elevator System","icon":"elevator","href":"/lld/case-elevator"},{"title":"Case Study: Chess Game","icon":"chess","href":"/lld/case-chess"},{"title":"Case Study: Hotel Booking System","icon":"hotel","href":"/lld/case-hotel-booking"},{"title":"Case Study: ATM System","icon":"building-columns","href":"/lld/case-atm"}]},{"group":"System Design (HLD)","pages":[{"title":"System Design Mastery","icon":"network-wired","href":"/system-design/overview"},{"title":"Interview Guide \u0026 Cheatsheet","icon":"clipboard-check","href":"/system-design/interview-guide"},{"title":"Interview Questions Bank","icon":"clipboard-question","href":"/system-design/interview-questions"},{"title":"System Design Fundamentals","icon":"book","href":"/system-design/fundamentals"},{"title":"System Design Building Blocks","icon":"cubes","href":"/system-design/building-blocks"},{"title":"Networking Fundamentals","icon":"network-wired","href":"/system-design/networking"},{"title":"Database Design","icon":"database","href":"/system-design/databases"},{"title":"API Design","icon":"plug","href":"/system-design/api-design"},{"title":"Distributed Systems","icon":"share-nodes","href":"/system-design/distributed-systems"},{"title":"Microservices Architecture","icon":"cubes","href":"/system-design/microservices"},{"title":"Back-of-Envelope Calculations","icon":"calculator","href":"/system-design/estimations"}]},{"group":"Senior Level (L5+/Staff)","pages":[{"title":"Advanced Concepts","icon":"brain","href":"/system-design/advanced-concepts"},{"title":"Scalability Patterns","icon":"arrow-up-right-dots","href":"/system-design/scalability-patterns"},{"title":"Reliability \u0026 Fault Tolerance","icon":"shield-halved","href":"/system-design/reliability-patterns"},{"title":"Observability \u0026 Monitoring","icon":"chart-line","href":"/system-design/observability"},{"title":"Data Pipelines","icon":"pipe","href":"/system-design/data-pipelines"},{"title":"Security Patterns","icon":"shield","href":"/system-design/security-patterns"}]},{"group":"HLD Case Studies","pages":[{"title":"Design: URL Shortener","icon":"link","href":"/system-design/case-url-shortener"},{"title":"Design: Rate Limiter","icon":"gauge","href":"/system-design/case-rate-limiter"},{"title":"Design a Notification System","icon":"bell","href":"/system-design/case-notification-system"},{"title":"Design: Twitter/X Timeline","icon":"twitter","href":"/system-design/case-twitter"},{"title":"Design: WhatsApp/Messenger","icon":"message","href":"/system-design/case-whatsapp"},{"title":"Design a Payment System","icon":"credit-card","href":"/system-design/case-payment-system"},{"title":"Design: Netflix/YouTube","icon":"video","href":"/system-design/case-netflix"},{"title":"Design: Uber/Lyft","icon":"car","href":"/system-design/case-uber"},{"title":"Design Google Maps","icon":"map-location-dot","href":"/system-design/case-google-maps"}]},{"group":"Engineering Fundamentals","pages":[{"title":"Engineering Topics","icon":"gears","href":"/engineering/overview"},{"title":"Computer Science Fundamentals","icon":"microchip","href":"/engineering/cs-fundamentals"},{"title":"Software Design Principles","icon":"compass-drafting","href":"/engineering/design-principles"},{"title":"Architecture Patterns","icon":"building","href":"/engineering/architecture-patterns"}]},{"group":"DevOps \u0026 Operations","pages":[{"title":"DevOps \u0026 Infrastructure","icon":"server","href":"/engineering/devops"},{"title":"Security Fundamentals","icon":"shield-halved","href":"/engineering/security"},{"title":"Performance \u0026 Optimization","icon":"gauge-high","href":"/engineering/performance"}]},{"group":"Azure Cloud Engineering","icon":"cloud","pages":[{"title":"Azure Cloud Engineering","sidebarTitle":"Overview","icon":"cloud","href":"/courses/azure-cloud-engineering/00-overview"},{"title":"Azure Fundamentals \u0026 Architecture","icon":"cloud-arrow-up","href":"/courses/azure-cloud-engineering/01-azure-fundamentals"},{"title":"Identity \u0026 Access Management","icon":"user-shield","href":"/courses/azure-cloud-engineering/02-identity-access-management"},{"title":"03a. Networking Fundamentals","icon":"network-wired","href":"/courses/azure-cloud-engineering/03a-networking-fundamentals"},{"title":"03b. Hybrid \u0026 Enterprise","icon":"globe","href":"/courses/azure-cloud-engineering/03b-hybrid-networking"},{"title":"03c. Traffic \u0026 Security","icon":"traffic-light","href":"/courses/azure-cloud-engineering/03c-traffic-management"},{"title":"Compute Services","icon":"server","href":"/courses/azure-cloud-engineering/04-compute-services"},{"title":"Storage Solutions","icon":"database","href":"/courses/azure-cloud-engineering/05-storage-solutions"},{"title":"Database Services","icon":"database","href":"/courses/azure-cloud-engineering/06-database-services"},{"title":"Azure Kubernetes Service (AKS)","icon":"dharmachakra","href":"/courses/azure-cloud-engineering/07-container-kubernetes"},{"title":"Serverless Architecture","icon":"bolt","href":"/courses/azure-cloud-engineering/08-serverless-architecture"},{"title":"Monitoring \u0026 Observability","icon":"chart-line","href":"/courses/azure-cloud-engineering/09-monitoring-observability"},{"title":"Security \u0026 Compliance","icon":"shield-halved","href":"/courses/azure-cloud-engineering/10-security-compliance"},{"title":"DevOps \u0026 CI/CD","icon":"code-branch","href":"/courses/azure-cloud-engineering/11-devops-cicd"},{"title":"Cost Optimization","icon":"dollar-sign","href":"/courses/azure-cloud-engineering/12-cost-optimization"},{"title":"High Availability \u0026 Disaster Recovery","icon":"life-ring","href":"/courses/azure-cloud-engineering/13-high-availability-dr"},{"title":"Architecture Patterns","icon":"diagram-project","href":"/courses/azure-cloud-engineering/14-architecture-patterns"},{"title":"Capstone Project","icon":"trophy","href":"/courses/azure-cloud-engineering/15-capstone-project"},{"title":"API Management \u0026 Messaging Patterns","icon":"diagram-project","href":"/courses/azure-cloud-engineering/16-api-messaging"},{"title":"SRE \u0026 Production Excellence","icon":"shield-heart","href":"/courses/azure-cloud-engineering/17-sre-production"}]},{"group":"AWS Cloud","icon":"cloud","pages":[{"title":"AWS Cloud Mastery","icon":"cloud","href":"/aws/overview"},{"title":"Core Concepts","icon":"circle-nodes","href":"/aws/core-concepts"},{"title":"Compute Services","icon":"microchip","href":"/aws/compute"},{"title":"Storage \u0026 Databases","icon":"hard-drive","href":"/aws/storage-databases"},{"title":"Networking","icon":"diagram-project","href":"/aws/networking"},{"title":"Security \u0026 IAM","icon":"shield-halved","href":"/aws/security"},{"title":"Well-Architected Framework","icon":"building","href":"/aws/well-architected"}]},{"group":"AWS Monitoring \u0026 Observability","icon":"chart-line","pages":[{"title":"Amazon CloudWatch","icon":"chart-line","href":"/aws/cloudwatch"},{"title":"AWS X-Ray","icon":"microscope","href":"/aws/xray"},{"title":"Observability \u0026 Monitoring","icon":"chart-line","href":"/aws/observability"}]},{"group":"AWS Security Services","icon":"shield-halved","pages":[{"title":"AWS GuardDuty","icon":"shield","href":"/aws/guardduty"},{"title":"AWS Security Hub","icon":"building-shield","href":"/aws/security-hub"},{"title":"AWS Inspector","href":"/aws/inspector"},{"title":"AWS WAF (Web Application Firewall)","href":"/aws/waf"},{"title":"AWS Shield","href":"/aws/shield"},{"title":"AWS CloudTrail","icon":"file-lines","href":"/aws/cloudtrail"},{"title":"AWS Config","icon":"gear","href":"/aws/config"}]},{"group":"AWS Serverless","icon":"bolt","pages":[{"title":"AWS Lambda","icon":"bolt","href":"/aws/lambda"},{"title":"AWS Step Functions","icon":"diagram-project","href":"/aws/step-functions"},{"title":"AWS SAM","icon":"box","href":"/aws/sam"},{"title":"Amazon DynamoDB","icon":"database","href":"/aws/dynamodb"}]},{"group":"AWS Operations","icon":"gears","pages":[{"title":"DevOps \u0026 CI/CD","icon":"code-branch","href":"/aws/devops-cicd"}]},{"group":"AWS Advanced","icon":"rocket","pages":[{"title":"CDN \u0026 Edge Services","icon":"globe","href":"/aws/cdn-edge"},{"title":"Messaging \u0026 Integration","icon":"arrows-split-up-and-left","href":"/aws/messaging"},{"title":"Containers \u0026 Microservices","icon":"cubes","href":"/aws/containers"}]},{"group":"AWS Case Studies","icon":"lightbulb","pages":[{"title":"Case Study: Serverless URL Shortener","icon":"bolt","href":"/aws/case-study-serverless"}]},{"group":"GCP Cloud Engineering","icon":"cloud","pages":[{"title":"GCP Cloud Engineering","sidebarTitle":"Overview","icon":"cloud","href":"/courses/gcp-cloud-engineering/00-overview"},{"title":"GCP Fundamentals","href":"/courses/gcp-cloud-engineering/01-gcp-fundamentals"},{"title":"Identity \u0026 Security","href":"/courses/gcp-cloud-engineering/02-iam-security"},{"title":"Networking \u0026 VPC","href":"/courses/gcp-cloud-engineering/03-networking-vpc"},{"title":"Load Balancing \u0026 DNS","href":"/courses/gcp-cloud-engineering/04-load-balancing-dns"},{"title":"Compute Engine","href":"/courses/gcp-cloud-engineering/05-compute-engine"},{"title":"Cloud Storage","href":"/courses/gcp-cloud-engineering/06-cloud-storage"},{"title":"Relational Databases","href":"/courses/gcp-cloud-engineering/07-relational-databases"},{"title":"NoSQL Databases","href":"/courses/gcp-cloud-engineering/08-nosql-databases"},{"title":"Containers \u0026 Artifacts","href":"/courses/gcp-cloud-engineering/09-containers-registry"},{"title":"Google Kubernetes Engine","href":"/courses/gcp-cloud-engineering/10-google-kubernetes-engine"},{"title":"Serverless Compute","href":"/courses/gcp-cloud-engineering/11-serverless-compute"},{"title":"Data Analytics \u0026 BigQuery","href":"/courses/gcp-cloud-engineering/12-data-analytics-bigquery"},{"title":"Monitoring \u0026 Observability","href":"/courses/gcp-cloud-engineering/13-monitoring-observability"},{"title":"Security \u0026 Compliance","href":"/courses/gcp-cloud-engineering/14-security-compliance"},{"title":"IaC \u0026 Deployment","href":"/courses/gcp-cloud-engineering/15-iac-deployment"},{"title":"Hybrid \u0026 Multi-Cloud","href":"/courses/gcp-cloud-engineering/16-hybrid-multi-cloud"},{"title":"Cost Management","href":"/courses/gcp-cloud-engineering/17-cost-management"},{"title":"Capstone Project","href":"/courses/gcp-cloud-engineering/18-capstone-project"}]},{"group":"DevOps Tools","icon":"toolbox","pages":[{"title":"DevOps Tools Mastery","sidebarTitle":"Overview","icon":"toolbox","href":"/courses/devops-tools/overview"},{"group":"Git Crash Course","pages":[{"title":"Git Crash Course","sidebarTitle":"Git Overview","icon":"code-branch","href":"/courses/devops-tools/git-overview"},{"title":"Git Fundamentals","sidebarTitle":"Fundamentals","icon":"book","href":"/courses/devops-tools/git-fundamentals"},{"title":"Git Branching \u0026 Merging","sidebarTitle":"Branching","icon":"code-branch","href":"/courses/devops-tools/git-branching"},{"title":"Git Collaboration","sidebarTitle":"Collaboration","icon":"users","href":"/courses/devops-tools/git-collaboration"},{"title":"Git Advanced Topics","sidebarTitle":"Advanced","icon":"wand-magic-sparkles","href":"/courses/devops-tools/git-advanced"},{"title":"Git Workflows","sidebarTitle":"Workflows","icon":"code-branch","href":"/courses/devops-tools/git-workflows"},{"title":"Git Hooks \u0026 Automation","sidebarTitle":"Hooks \u0026 Automation","icon":"robot","href":"/courses/devops-tools/git-hooks"}]},{"group":"Linux Crash Course","pages":[{"title":"Linux Crash Course","sidebarTitle":"Linux Overview","icon":"linux","href":"/courses/devops-tools/linux-overview"},{"title":"Linux Fundamentals","sidebarTitle":"Fundamentals","icon":"terminal","href":"/courses/devops-tools/linux-fundamentals"},{"title":"Linux Permissions \u0026 Users","sidebarTitle":"Permissions","icon":"lock","href":"/courses/devops-tools/linux-permissions"},{"title":"Linux Process Management","sidebarTitle":"Processes","icon":"gears","href":"/courses/devops-tools/linux-processes"},{"title":"Linux Networking","sidebarTitle":"Networking","icon":"network-wired","href":"/courses/devops-tools/linux-networking"},{"title":"Linux Shell Scripting","sidebarTitle":"Shell Scripting","icon":"file-code","href":"/courses/devops-tools/linux-scripting"},{"title":"System Monitoring","sidebarTitle":"Monitoring","icon":"chart-line","href":"/courses/devops-tools/linux-monitoring"},{"title":"Security Hardening","sidebarTitle":"Security","icon":"lock","href":"/courses/devops-tools/linux-security"}]},{"group":"Docker Crash Course","pages":[{"title":"Docker Crash Course","sidebarTitle":"Docker Overview","icon":"docker","href":"/courses/devops-tools/docker-overview"},{"title":"Docker Fundamentals","sidebarTitle":"Fundamentals","icon":"book","href":"/courses/devops-tools/docker-fundamentals"},{"title":"Building Docker Images","sidebarTitle":"Images","icon":"layer-group","href":"/courses/devops-tools/docker-images"},{"title":"Docker Networking \u0026 Volumes","sidebarTitle":"Networking","icon":"network-wired","href":"/courses/devops-tools/docker-networking"},{"title":"Docker Compose","sidebarTitle":"Compose","icon":"cubes","href":"/courses/devops-tools/docker-compose"},{"title":"Docker Best Practices","sidebarTitle":"Best Practices","icon":"shield-check","href":"/courses/devops-tools/docker-best-practices"}]},{"group":"RabbitMQ Crash Course","pages":[{"title":"RabbitMQ Crash Course","sidebarTitle":"RabbitMQ Overview","icon":"rabbit","href":"/courses/devops-tools/rabbitmq-overview"},{"title":"RabbitMQ Fundamentals","sidebarTitle":"Fundamentals","icon":"book","href":"/courses/devops-tools/rabbitmq-fundamentals"},{"title":"Patterns","sidebarTitle":"Patterns","icon":"rabbit","href":"/courses/devops-tools/rabbitmq-patterns"},{"title":"Reliability","sidebarTitle":"Reliability","icon":"rabbit","href":"/courses/devops-tools/rabbitmq-reliability"}]},{"group":"Kafka Crash Course","pages":[{"title":"Kafka Crash Course","sidebarTitle":"Kafka Overview","icon":"stream","href":"/courses/devops-tools/kafka-overview"},{"title":"Kafka Fundamentals","sidebarTitle":"Fundamentals","icon":"book","href":"/courses/devops-tools/kafka-fundamentals"},{"title":"Kafka Producers \u0026 Consumers","sidebarTitle":"Producers \u0026 Consumers","icon":"arrows-left-right","href":"/courses/devops-tools/kafka-producers-consumers"},{"title":"Kafka Streams","sidebarTitle":"Streams","icon":"water","href":"/courses/devops-tools/kafka-streams"},{"title":"Kafka Operations","sidebarTitle":"Operations","icon":"server","href":"/courses/devops-tools/kafka-operations"}]},{"group":"Kubernetes Crash Course","pages":[{"title":"Kubernetes Crash Course","sidebarTitle":"Kubernetes Overview","icon":"dharmachakra","href":"/courses/devops-tools/kubernetes-overview"},{"title":"Kubernetes Fundamentals","sidebarTitle":"Fundamentals","icon":"book","href":"/courses/devops-tools/kubernetes-fundamentals"},{"title":"Kubernetes Workloads","sidebarTitle":"Workloads","icon":"cubes","href":"/courses/devops-tools/kubernetes-workloads"},{"title":"Kubernetes Services","sidebarTitle":"Services","icon":"network-wired","href":"/courses/devops-tools/kubernetes-services"},{"title":"Kubernetes Configuration","sidebarTitle":"Configuration","icon":"gear","href":"/courses/devops-tools/kubernetes-config"},{"title":"Kubernetes Storage","sidebarTitle":"Storage","icon":"hard-drive","href":"/courses/devops-tools/kubernetes-storage"},{"title":"Kubernetes on Windows \u0026 Linux","sidebarTitle":"Windows \u0026 Linux","icon":"window-maximize","href":"/courses/devops-tools/kubernetes-windows-linux"}]}]},{"group":"Database Engineering","icon":"database","pages":[{"title":"Database Engineering Mastery","sidebarTitle":"Course Overview","icon":"database","href":"/courses/database-engineering/overview"},{"group":"Track 1: Foundations","pages":[{"title":"SQL Foundations","sidebarTitle":"1. SQL Foundations","icon":"terminal","href":"/courses/database-engineering/sql-foundations"},{"title":"Database Design \u0026 Modeling","sidebarTitle":"2. Database Design","icon":"diagram-project","href":"/courses/database-engineering/database-design"},{"title":"Transactions \u0026 ACID","sidebarTitle":"3. Transactions \u0026 ACID","icon":"shield-check","href":"/courses/database-engineering/transactions"}]},{"group":"Track 2: Performance","pages":[{"title":"Indexing Deep Dive","sidebarTitle":"4. Indexing Deep Dive","icon":"magnifying-glass-chart","href":"/courses/database-engineering/indexing"},{"title":"Query Optimization","sidebarTitle":"5. Query Optimization","icon":"bolt","href":"/courses/database-engineering/query-optimization"},{"title":"Query Execution Plans Mastery","sidebarTitle":"Execution Plans Deep Dive","icon":"route","href":"/courses/database-engineering/execution-plans-mastery"},{"title":"Performance Engineering","sidebarTitle":"Performance Engineering","icon":"gauge-high","href":"/courses/database-engineering/performance-engineering"}]},{"group":"Track 3: Internals","pages":[{"title":"PostgreSQL Internals","sidebarTitle":"6. PostgreSQL Internals","icon":"microchip","href":"/courses/database-engineering/internals"},{"title":"PostgreSQL Data Structures","sidebarTitle":"Data Structures","icon":"sitemap","href":"/courses/database-engineering/data-structures"},{"title":"Query Processing Pipeline","sidebarTitle":"8. Query Processing","icon":"gears","href":"/courses/database-engineering/query-processing"},{"title":"Query Engine Deep Dive","sidebarTitle":"Query Engine Internals","icon":"microchip","href":"/courses/database-engineering/query-engine-deep-dive"},{"title":"PostgreSQL Architecture","sidebarTitle":"9. PG Architecture","icon":"sitemap","href":"/courses/database-engineering/architecture"},{"title":"Storage Engine Deep Dive","sidebarTitle":"Storage Engine Internals","icon":"hard-drive","href":"/courses/database-engineering/storage-deep-dive"}]},{"group":"Track 4: Distributed","pages":[{"title":"Replication \u0026 High Availability","sidebarTitle":"7. Replication \u0026 HA","icon":"server","href":"/courses/database-engineering/replication"},{"title":"Scaling Strategies","sidebarTitle":"8. Scaling","icon":"chart-line","href":"/courses/database-engineering/scaling"},{"title":"Distributed Database Systems","sidebarTitle":"Distributed Systems","icon":"network-wired","href":"/courses/database-engineering/distributed-systems"}]},{"group":"OSS Contributions","pages":[{"title":"PostgreSQL Source Code","sidebarTitle":"13. Source Code","icon":"code","href":"/courses/database-engineering/source-code"},{"title":"Contributing to PostgreSQL","sidebarTitle":"14. Contributing","icon":"code-pull-request","href":"/courses/database-engineering/contributing"}]},{"group":"Capstone","pages":[{"title":"Senior Interview Mastery","sidebarTitle":"15. Interview Prep","icon":"user-tie","href":"/courses/database-engineering/interview-prep"},{"title":"System Design Case Studies","sidebarTitle":"16. Case Studies","icon":"building","href":"/courses/database-engineering/case-studies"}]}]},{"group":"HIPAA Compliance Mastery","icon":"shield-check","pages":[{"title":"HIPAA Compliance Mastery","sidebarTitle":"Course Overview","icon":"hospital","href":"/courses/hipaa-compliance/overview"},{"group":"Track 1: Regulatory Foundations","pages":[{"title":"HIPAA Fundamentals","sidebarTitle":"HIPAA Fundamentals","icon":"book-medical","href":"/courses/hipaa-compliance/hipaa-fundamentals"},{"title":"HIPAA Risk Assessment","sidebarTitle":"Risk Assessment","icon":"magnifying-glass-chart","href":"/courses/hipaa-compliance/risk-assessment"},{"title":"PDPL \u0026 Global Data Protection","sidebarTitle":"PDPL Compliance","icon":"globe","href":"/courses/hipaa-compliance/pdpl-compliance"}]},{"group":"Track 2: Security Architecture","pages":[{"title":"Access Control Systems","sidebarTitle":"Access Control","icon":"user-shield","href":"/courses/hipaa-compliance/access-control"},{"title":"Encryption: Data at Rest \u0026 In Transit","sidebarTitle":"Encryption","icon":"lock","href":"/courses/hipaa-compliance/encryption"},{"title":"HIPAA Database Security \u0026 Encryption","href":"/courses/hipaa-compliance/database-security"}]},{"group":"Track 3: Implementation","pages":[{"title":"Audit Logging for HIPAA","sidebarTitle":"Audit Logging","icon":"file-lines","href":"/courses/hipaa-compliance/audit-logging"},{"title":"E2E Encryption with AI Agents","sidebarTitle":"E2E Encryption + AI","icon":"robot","href":"/courses/hipaa-compliance/e2e-encryption-ai"},{"title":"Implementation Guide","sidebarTitle":"Implementation Guide","icon":"code","href":"/courses/hipaa-compliance/implementation-guide"}]},{"group":"Track 4: Operations \u0026 Governance","pages":[{"title":"Incident Response for Healthcare","sidebarTitle":"Incident Response","icon":"siren","href":"/courses/hipaa-compliance/incident-response"},{"title":"HIPAA Vendor \u0026 Third-Party Risk Management","href":"/courses/hipaa-compliance/vendor-management"}]},{"group":"Track 5: Advanced Topics","pages":[{"title":"HIPAA Breach Case Studies \u0026 Lessons Learned","href":"/courses/hipaa-compliance/case-studies"},{"title":"Compliance Checklist \u0026 BAA","sidebarTitle":"Compliance Checklist","icon":"clipboard-check","href":"/courses/hipaa-compliance/compliance-checklist"}]},{"group":"Track 6: Capstone","pages":[{"title":"HIPAA Compliance Capstone Project","href":"/courses/hipaa-compliance/capstone-project"}]}]},{"group":"Operating Systems","icon":"microchip","pages":[{"title":"Operating Systems Mastery","sidebarTitle":"Course Overview","icon":"microchip","href":"/operating-systems/overview"},{"title":"OS Fundamentals \u0026 System Call Internals","sidebarTitle":"Fundamentals","icon":"book","href":"/operating-systems/os-fundamentals"},{"title":"CPU Architectures \u0026 Microarchitecture","sidebarTitle":"CPU Architectures","icon":"microchip","href":"/operating-systems/cpu-architectures"},{"title":"Operating System Interfaces","sidebarTitle":"xv6 OS Interfaces","icon":"book-open-reader","href":"/operating-systems/xv6"},{"group":"System Startup","pages":[{"title":"The Boot Process: From Reset Vector to PID 1","sidebarTitle":"Boot Process","icon":"power-off","href":"/operating-systems/boot-process"}]},{"group":"Process Management","pages":[{"title":"Process Management","sidebarTitle":"Processes","icon":"microchip","href":"/operating-systems/processes"},{"title":"Threads \u0026 Concurrency: The Senior Mastery Guide","sidebarTitle":"Threads","icon":"layer-group","href":"/operating-systems/threads"},{"title":"CPU Scheduling","sidebarTitle":"Scheduling","icon":"clock","href":"/operating-systems/scheduling"}]},{"group":"Memory Management","pages":[{"title":"Memory Management","sidebarTitle":"Memory Management","icon":"memory","href":"/operating-systems/memory-management"},{"title":"Virtual Memory","sidebarTitle":"Virtual Memory","icon":"memory","href":"/operating-systems/virtual-memory"}]},{"group":"Concurrency \u0026 I/O","pages":[{"title":"Advanced Synchronization \u0026 RCU","sidebarTitle":"Synchronization","icon":"hand-middle-finger","href":"/operating-systems/synchronization"},{"title":"Deadlocks","sidebarTitle":"Deadlocks","icon":"circle-xmark","href":"/operating-systems/deadlocks"},{"title":"Inter-Process Communication: Kernel Internals \u0026 Architecture","sidebarTitle":"IPC","icon":"message","href":"/operating-systems/ipc"},{"title":"Virtual File System (VFS) \u0026 Disk Internals","sidebarTitle":"File Systems","icon":"file-lines","href":"/operating-systems/file-systems"},{"title":"I/O Systems \u0026 Modern I/O","sidebarTitle":"I/O Systems","icon":"input-pipe","href":"/operating-systems/io-systems"}]},{"group":"Networking","pages":[{"title":"Kernel Networking Stack: From NIC to Socket","sidebarTitle":"Networking","icon":"network-wired","href":"/operating-systems/networking"}]},{"group":"Virtualization","pages":[{"title":"Containers \u0026 Virtualization: From Namespaces to Hypervisors","sidebarTitle":"Containers \u0026 VMs","icon":"cubes","href":"/operating-systems/containers-virtualization"}]},{"group":"Advanced Topics","pages":[{"title":"OS Security: From Hardware to Userspace","sidebarTitle":"Security","icon":"shield-halved","href":"/operating-systems/security"},{"title":"Linux Internals","sidebarTitle":"Linux Internals","icon":"linux","href":"/operating-systems/linux-internals"},{"title":"Modern OS Features","sidebarTitle":"Modern Features","icon":"rocket","href":"/operating-systems/modern-features"},{"title":"Observability \u0026 Performance Engineering","sidebarTitle":"Performance","icon":"gauge-high","href":"/operating-systems/debugging-performance"}]},{"group":"Interview Prep","pages":[{"title":"Interview Preparation","sidebarTitle":"Interview Prep","icon":"user-tie","href":"/operating-systems/interview-prep"},{"title":"OS Case Studies","sidebarTitle":"Case Studies","icon":"building","href":"/operating-systems/case-studies"}]}]},{"group":"Linux Internals","icon":"linux","pages":[{"title":"Linux Internals \u0026 Kernel Mastery","sidebarTitle":"Course Overview","icon":"linux","href":"/courses/linux-internals/overview"},{"group":"Kernel Foundations","pages":[{"title":"Linux Kernel Architecture","sidebarTitle":"Kernel Architecture","icon":"sitemap","href":"/courses/linux-internals/kernel-architecture"},{"title":"System Call Interface","sidebarTitle":"System Calls","icon":"terminal","href":"/courses/linux-internals/syscalls"},{"title":"Kernel Data Structures","sidebarTitle":"Data Structures","icon":"database","href":"/courses/linux-internals/data-structures"},{"title":"Interrupts \u0026 Exception Handling","sidebarTitle":"Interrupts","icon":"bolt","href":"/courses/linux-internals/interrupts-exceptions"},{"title":"Kernel Synchronization","sidebarTitle":"Synchronization","icon":"lock","href":"/courses/linux-internals/synchronization"}]},{"group":"Process \u0026 Memory","pages":[{"title":"Process Subsystem Deep Dive","sidebarTitle":"Process Subsystem","icon":"microchip","href":"/courses/linux-internals/process-subsystem"},{"title":"Memory Management Internals","sidebarTitle":"Memory Management","icon":"memory","href":"/courses/linux-internals/memory-management"},{"title":"Signals \u0026 IPC","sidebarTitle":"Signals \u0026 IPC","icon":"arrows-split-up-and-left","href":"/courses/linux-internals/signals-ipc"}]},{"group":"Containers \u0026 Isolation","pages":[{"title":"Namespaces Deep Dive","sidebarTitle":"Namespaces","icon":"boxes-stacked","href":"/courses/linux-internals/namespaces"},{"title":"Control Groups (cgroups)","sidebarTitle":"cgroups","icon":"object-group","href":"/courses/linux-internals/cgroups"},{"title":"Security Modules \u0026 Capabilities","sidebarTitle":"Security","icon":"shield-halved","href":"/courses/linux-internals/security-modules"}]},{"group":"I/O \u0026 Networking","pages":[{"title":"Filesystem \u0026 VFS","sidebarTitle":"Filesystem \u0026 VFS","icon":"folder-tree","href":"/courses/linux-internals/filesystem-vfs"},{"title":"I/O Subsystem","sidebarTitle":"I/O Subsystem","icon":"hard-drive","href":"/courses/linux-internals/io-subsystem"},{"title":"Network Stack","sidebarTitle":"Network Stack","icon":"network-wired","href":"/courses/linux-internals/networking-stack"}]},{"group":"Observability","pages":[{"title":"eBPF Deep Dive","sidebarTitle":"eBPF","icon":"magnifying-glass-chart","href":"/courses/linux-internals/ebpf"},{"title":"Tracing \u0026 Profiling","sidebarTitle":"Tracing \u0026 Profiling","icon":"chart-line","href":"/courses/linux-internals/tracing-profiling"}]},{"group":"Advanced Kernel","pages":[{"title":"Power \u0026 Thermal Management","sidebarTitle":"Power Management","icon":"bolt","href":"/courses/linux-internals/power-management"}]},{"group":"Interview Prep","pages":[{"title":"Hands-on Projects","sidebarTitle":"Projects","icon":"hammer","href":"/courses/linux-internals/projects"},{"title":"Real Interview Questions","sidebarTitle":"Interview Questions","icon":"clipboard-question","href":"/courses/linux-internals/interview-questions"}]}]},{"group":"Distributed Systems","icon":"sitemap","pages":[{"title":"Distributed Systems Mastery","sidebarTitle":"Course Overview","icon":"network-wired","href":"/courses/distributed-systems/overview"},{"group":"Core Foundations","pages":[{"title":"Foundations of Distributed Systems","sidebarTitle":"Foundations","icon":"book","href":"/courses/distributed-systems/foundations"},{"title":"Distributed Networking Fundamentals","sidebarTitle":"Networking","icon":"network-wired","href":"/courses/distributed-systems/networking"},{"title":"Time \u0026 Clock Synchronization","sidebarTitle":"Clocks","icon":"clock","href":"/courses/distributed-systems/clocks"},{"title":"Consistency Models","sidebarTitle":"Consistency Models","icon":"scale-balanced","href":"/courses/distributed-systems/consistency-models"},{"title":"Distributed Snapshots","sidebarTitle":"Distributed Snapshots","icon":"camera","href":"/courses/distributed-systems/snapshots"}]},{"group":"Consensus \u0026 Replication","pages":[{"title":"Consensus Protocols","sidebarTitle":"Consensus","icon":"handshake","href":"/courses/distributed-systems/consensus"},{"title":"Raft Consensus Deep Dive","sidebarTitle":"Raft Deep Dive","icon":"star","href":"/courses/distributed-systems/raft-deep-dive"},{"title":"Paxos Consensus Deep Dive","sidebarTitle":"Paxos Deep Dive","icon":"scroll","href":"/courses/distributed-systems/paxos-deep-dive"},{"title":"Replication Strategies","sidebarTitle":"Replication","icon":"clone","href":"/courses/distributed-systems/replication"},{"title":"Distributed Coordination","sidebarTitle":"Coordination","icon":"people-group","href":"/courses/distributed-systems/coordination"},{"title":"Byzantine Fault Tolerance (BFT)","sidebarTitle":"Byzantine Fault Tolerance","icon":"shield-halved","href":"/courses/distributed-systems/bft"},{"title":"Gossip Protocols \u0026 Membership","sidebarTitle":"Gossip Protocols","icon":"comments","href":"/courses/distributed-systems/gossip"},{"title":"Formal Verification in Distributed Systems","sidebarTitle":"Formal Verification","icon":"shield-check","href":"/courses/distributed-systems/formal-verification"}]},{"group":"Data \u0026 Transactions","pages":[{"title":"Distributed Transactions","sidebarTitle":"Transactions","icon":"money-bill-transfer","href":"/courses/distributed-systems/transactions"},{"title":"Data Partitioning \u0026 Sharding","sidebarTitle":"Partitioning","icon":"table-cells","href":"/courses/distributed-systems/partitioning"},{"title":"Data Systems at Scale","sidebarTitle":"Data Systems","icon":"database","href":"/courses/distributed-systems/data-systems"}]},{"group":"Infrastructure \u0026 Messaging","pages":[{"title":"Distributed Messaging \u0026 Event Systems","sidebarTitle":"Messaging","icon":"envelope","href":"/courses/distributed-systems/messaging"},{"title":"Distributed Caching","sidebarTitle":"Caching","icon":"bolt","href":"/courses/distributed-systems/caching"},{"title":"Fault Tolerance Patterns","sidebarTitle":"Fault Tolerance","icon":"shield-heart","href":"/courses/distributed-systems/fault-tolerance"}]},{"group":"Production \u0026 Practice","pages":[{"title":"Production Excellence","sidebarTitle":"Production","icon":"shield-halved","href":"/courses/distributed-systems/production"},{"title":"Real-World Case Studies","sidebarTitle":"Case Studies","icon":"building","href":"/courses/distributed-systems/case-studies"},{"title":"Interview Practice Problems","sidebarTitle":"Interview Problems","icon":"comments","href":"/courses/distributed-systems/interview-problems"}]}]},{"group":"Networking Mastery","icon":"network-wired","pages":[{"title":"Networking Fundamentals","sidebarTitle":"1. Overview","icon":"globe","href":"/courses/networking-mastery/01-overview"},{"group":"Fundamentals","pages":[{"title":"Network Models","sidebarTitle":"2. OSI \u0026 TCP/IP","icon":"layer-group","href":"/courses/networking-mastery/02-models"},{"title":"Physical \u0026 Data Link Layers","sidebarTitle":"3. Physical \u0026 Data Link","icon":"ethernet","href":"/courses/networking-mastery/03-physical-datalink"},{"title":"Network Layer","sidebarTitle":"4. Network Layer","icon":"network-wired","href":"/courses/networking-mastery/04-network-layer"},{"title":"Transport Layer","sidebarTitle":"5. Transport Layer","icon":"truck-fast","href":"/courses/networking-mastery/05-transport-layer"},{"title":"Application Layer","sidebarTitle":"6. Application Layer","icon":"browser","href":"/courses/networking-mastery/06-application-layer"}]},{"group":"Security \u0026 Advanced Intro","pages":[{"title":"Network Security","sidebarTitle":"7. Security","icon":"shield-check","href":"/courses/networking-mastery/07-security"},{"title":"Advanced Networking Intro","sidebarTitle":"8. Advanced Topics","icon":"cloud","href":"/courses/networking-mastery/08-advanced"}]},{"group":"Deep Dives","pages":[{"title":"IP Addressing Deep Dive","sidebarTitle":"9. IP Addressing Mastery","icon":"map-location-dot","href":"/courses/networking-mastery/09-ip-addressing-deep-dive"},{"title":"NAT \u0026 PAT Deep Dive","sidebarTitle":"10. NAT Mastery","icon":"right-left","href":"/courses/networking-mastery/10-nat-deep-dive"},{"title":"Routing Deep Dive","sidebarTitle":"11. Routing Mastery","icon":"route","href":"/courses/networking-mastery/11-routing-deep-dive"},{"title":"DNS Deep Dive","sidebarTitle":"12. DNS Mastery","icon":"book","href":"/courses/networking-mastery/12-dns-deep-dive"},{"title":"Load Balancing \u0026 Proxies","sidebarTitle":"13. Load Balancing","icon":"scale-balanced","href":"/courses/networking-mastery/13-load-balancing"}]},{"group":"Operations \u0026 Security","pages":[{"title":"Network Troubleshooting","sidebarTitle":"14. Troubleshooting","icon":"wrench","href":"/courses/networking-mastery/14-troubleshooting"},{"title":"VPNs \u0026 Tunneling","sidebarTitle":"15. VPNs \u0026 Tunneling","icon":"tunnel","href":"/courses/networking-mastery/15-vpn-tunneling"},{"title":"Firewalls \u0026 Security Groups","sidebarTitle":"17. Firewalls","icon":"shield-halved","href":"/courses/networking-mastery/17-firewalls-security-groups"}]},{"group":"Modern Networking","pages":[{"title":"Container Networking","sidebarTitle":"18. Container Networking","icon":"cubes","href":"/courses/networking-mastery/18-container-networking"},{"title":"Real-World Networking Scenarios","sidebarTitle":"16. Network Scenarios","icon":"diagram-project","href":"/courses/networking-mastery/16-scenarios"}]}]},{"group":"Build Your Own X","icon":"hammer","pages":[{"title":"Build Your Own X","sidebarTitle":"Course Overview","icon":"hammer","href":"/courses/build-your-own-x/overview"},{"group":"Build Your Own Git","pages":[{"title":"Build Your Own Git","sidebarTitle":"Git Overview","icon":"code-branch","href":"/courses/build-your-own-x/git-overview"},{"title":"Chapter 1: Project Setup \u0026 Init","sidebarTitle":"1. Setup \u0026 Init","icon":"folder-open","href":"/courses/build-your-own-x/git-1-setup"},{"title":"Chapter 2: The Object Model","sidebarTitle":"2. Object Model","icon":"cube","href":"/courses/build-your-own-x/git-2-objects"},{"title":"Chapter 3: Staging \u0026 Index","sidebarTitle":"3. Staging \u0026 Index","icon":"layer-plus","href":"/courses/build-your-own-x/git-3-staging"},{"title":"Chapter 4: Commits \u0026 History","sidebarTitle":"4. Commits \u0026 History","icon":"code-commit","href":"/courses/build-your-own-x/git-4-commits"},{"title":"Chapter 5: Branches \u0026 Checkout","sidebarTitle":"5. Branches \u0026 Checkout","icon":"code-branch","href":"/courses/build-your-own-x/git-5-branches"}]},{"group":"Build Your Own Redis","pages":[{"title":"Build Your Own Redis","sidebarTitle":"Redis Overview","icon":"database","href":"/courses/build-your-own-x/redis-overview"},{"title":"Chapter 1: RESP Protocol","sidebarTitle":"1. RESP Protocol","icon":"network-wired","href":"/courses/build-your-own-x/redis-1-protocol"},{"title":"Chapter 2: TCP Server","sidebarTitle":"2. TCP Server","icon":"server","href":"/courses/build-your-own-x/redis-2-server"},{"title":"Chapter 3: Data Structures","sidebarTitle":"3. Data Structures","icon":"layer-group","href":"/courses/build-your-own-x/redis-3-data-structures"},{"title":"Chapter 4: Persistence","sidebarTitle":"4. Persistence","icon":"floppy-disk","href":"/courses/build-your-own-x/redis-4-persistence"},{"title":"Chapter 5: Pub/Sub","sidebarTitle":"5. Pub/Sub","icon":"tower-broadcast","href":"/courses/build-your-own-x/redis-5-pubsub"}]},{"group":"Build Your Own Docker","pages":[{"title":"Build Your Own Docker","sidebarTitle":"Docker Overview","icon":"docker","href":"/courses/build-your-own-x/docker-overview"},{"title":"Chapter 1: Linux Namespaces","sidebarTitle":"1. Namespaces","icon":"box","href":"/courses/build-your-own-x/docker-1-namespaces"},{"title":"Chapter 2: Control Groups (cgroups)","sidebarTitle":"2. Cgroups","icon":"gauge-high","href":"/courses/build-your-own-x/docker-2-cgroups"},{"title":"Chapter 3: Filesystem Isolation","sidebarTitle":"3. Filesystem","icon":"folder-tree","href":"/courses/build-your-own-x/docker-3-filesystem"},{"title":"Chapter 4: Container Networking","sidebarTitle":"4. Networking","icon":"network-wired","href":"/courses/build-your-own-x/docker-4-networking"},{"title":"Chapter 5: Container Images","sidebarTitle":"5. Images","icon":"box-archive","href":"/courses/build-your-own-x/docker-5-images"}]}]},{"group":"Go Lang Mastery","icon":"golang","pages":[{"group":"Fundamentals","pages":[{"title":"Introduction to Go","sidebarTitle":"1. Introduction","icon":"golang","href":"/courses/go-lang-mastery/01-introduction"},{"title":"Variables and Types","sidebarTitle":"2. Variables \u0026 Types","icon":"cube","href":"/courses/go-lang-mastery/02-variables-and-types"},{"title":"Control Structures","sidebarTitle":"3. Control Structures","icon":"code-branch","href":"/courses/go-lang-mastery/03-control-structures"},{"title":"Functions and Packages","sidebarTitle":"4. Functions \u0026 Packages","icon":"box-open","href":"/courses/go-lang-mastery/04-functions-and-packages"},{"title":"Arrays, Slices, and Maps","sidebarTitle":"5. Arrays, Slices \u0026 Maps","icon":"layer-group","href":"/courses/go-lang-mastery/05-arrays-slices-maps"},{"title":"Pointers and Structs","sidebarTitle":"6. Pointers \u0026 Structs","icon":"shapes","href":"/courses/go-lang-mastery/06-pointers-and-structs"},{"title":"Interfaces","sidebarTitle":"7. Interfaces","icon":"plug","href":"/courses/go-lang-mastery/07-interfaces"}]},{"group":"Core Concepts","pages":[{"title":"08. Concurrency","icon":"arrows-split-up-and-left","href":"/courses/go-lang-mastery/08-concurrency"},{"title":"09. Error Handling","icon":"triangle-exclamation","href":"/courses/go-lang-mastery/09-error-handling"},{"title":"10. Testing and Benchmarking","icon":"vial","href":"/courses/go-lang-mastery/10-testing-and-benchmarking"},{"title":"Generics","sidebarTitle":"11. Generics","icon":"cube","href":"/courses/go-lang-mastery/11-generics"},{"title":"Advanced Concurrency Patterns","sidebarTitle":"12. Advanced Concurrency","icon":"diagram-project","href":"/courses/go-lang-mastery/12-advanced-concurrency"},{"title":"Context Package","sidebarTitle":"13. Context","icon":"clock","href":"/courses/go-lang-mastery/13-context"}]},{"group":"Production Go","pages":[{"title":"HTTP \u0026 Web Development","sidebarTitle":"14. HTTP \u0026 Web","icon":"globe","href":"/courses/go-lang-mastery/14-http-web"},{"title":"Database Operations","sidebarTitle":"15. Databases","icon":"database","href":"/courses/go-lang-mastery/15-databases"},{"title":"Microservices \u0026 gRPC","sidebarTitle":"16. Microservices \u0026 gRPC","icon":"sitemap","href":"/courses/go-lang-mastery/16-microservices-grpc"},{"title":"Performance Optimization","sidebarTitle":"17. Performance","icon":"gauge-high","href":"/courses/go-lang-mastery/17-performance"},{"title":"Production Best Practices","sidebarTitle":"18. Production","icon":"rocket","href":"/courses/go-lang-mastery/18-production"}]},{"group":"Advanced Topics","pages":[{"title":"Design Patterns in Go","sidebarTitle":"19. Design Patterns","icon":"puzzle-piece","href":"/courses/go-lang-mastery/19-design-patterns"},{"title":"Interview Preparation","sidebarTitle":"20. Interview Prep","icon":"user-tie","href":"/courses/go-lang-mastery/20-interview-prep"}]}]},{"group":"C Programming","icon":"memory","pages":[{"title":"Advanced C Programming for Systems Development","sidebarTitle":"Course Overview","icon":"microchip","href":"/courses/c-programming/overview"},{"group":"Foundations","pages":[{"title":"C Syntax Speed Run","sidebarTitle":"Syntax Speed Run","icon":"forward-fast","href":"/courses/c-programming/syntax-speedrun"},{"title":"Build Systems \u0026 Toolchain","sidebarTitle":"Build \u0026 Toolchain","icon":"hammer","href":"/courses/c-programming/toolchain"},{"title":"Debugging Fundamentals","sidebarTitle":"Debugging","icon":"bug","href":"/courses/c-programming/debugging"}]},{"group":"Memory Mastery","pages":[{"title":"Pointers Deep Dive","sidebarTitle":"Pointers","icon":"arrow-pointer","href":"/courses/c-programming/pointers"},{"title":"Memory Layout \u0026 Segments","sidebarTitle":"Memory Layout","icon":"layer-group","href":"/courses/c-programming/memory-layout"},{"title":"Dynamic Memory Management","sidebarTitle":"Dynamic Memory","icon":"memory","href":"/courses/c-programming/dynamic-memory"},{"title":"Preprocessor Mastery","sidebarTitle":"Preprocessor","icon":"code","href":"/courses/c-programming/preprocessor"},{"title":"Data Structures in C","sidebarTitle":"Data Structures","icon":"sitemap","href":"/courses/c-programming/data-structures"},{"title":"Undefined Behavior","sidebarTitle":"Undefined Behavior","icon":"skull","href":"/courses/c-programming/undefined-behavior"}]},{"group":"Systems Programming","pages":[{"title":"System Calls \u0026 POSIX","sidebarTitle":"System Calls","icon":"terminal","href":"/courses/c-programming/system-calls"},{"title":"Concurrency \u0026 Threading","sidebarTitle":"Concurrency","icon":"arrows-split-up-and-left","href":"/courses/c-programming/concurrency"},{"title":"Network Programming","sidebarTitle":"Networking","icon":"network-wired","href":"/courses/c-programming/networking"}]},{"group":"Projects","pages":[{"title":"Project: Build a Shell","sidebarTitle":"Project: Shell","icon":"terminal","href":"/courses/c-programming/project-shell"},{"title":"Project: Key-Value Store","sidebarTitle":"Project: KV Store","icon":"database","href":"/courses/c-programming/project-database"},{"title":"Project: Memory Allocator","sidebarTitle":"Project: malloc","icon":"memory","href":"/courses/c-programming/project-allocator"},{"title":"Project: HTTP Server","sidebarTitle":"Project: HTTP Server","icon":"server","href":"/courses/c-programming/project-http-server"}]},{"group":"Advanced Topics","pages":[{"title":"Performance Optimization","sidebarTitle":"Performance","icon":"gauge-high","href":"/courses/c-programming/performance"},{"title":"Embedded Systems","sidebarTitle":"Embedded","icon":"microchip","href":"/courses/c-programming/embedded"},{"title":"Linux Kernel Modules","sidebarTitle":"Kernel Modules","icon":"linux","href":"/courses/c-programming/kernel-modules"}]}]},{"group":"Classic Research Papers","icon":"file-lines","pages":[{"group":"Google File System (GFS)","icon":"folder","pages":[{"title":"Google File System","sidebarTitle":"GFS Overview","icon":"database","href":"/courses/engineering-papers/gfs-overview"},{"title":"Introduction and Motivation","sidebarTitle":"Chapter 1: Introduction","icon":"flag","href":"/courses/engineering-papers/chapter-1-introduction"},{"title":"Architecture Overview","sidebarTitle":"Chapter 2: Architecture","icon":"diagram-project","href":"/courses/engineering-papers/chapter-2-architecture"},{"title":"Master Operations","sidebarTitle":"Chapter 3: Master Operations","icon":"crown","href":"/courses/engineering-papers/chapter-3-master-operations"},{"title":"Chunkservers and Data Flow","sidebarTitle":"Chapter 4: Chunkservers \u0026 Data Flow","icon":"server","href":"/courses/engineering-papers/chapter-4-chunkservers-dataflow"},{"title":"Consistency Model","sidebarTitle":"Chapter 5: Consistency Model","icon":"scale-balanced","href":"/courses/engineering-papers/chapter-5-consistency-model"},{"title":"Fault Tolerance","sidebarTitle":"Chapter 6: Fault Tolerance","icon":"shield-halved","href":"/courses/engineering-papers/chapter-6-fault-tolerance"},{"title":"Performance and Optimizations","sidebarTitle":"Chapter 7: Performance","icon":"gauge-high","href":"/courses/engineering-papers/chapter-7-performance"},{"title":"Impact and Evolution","sidebarTitle":"Chapter 8: Impact \u0026 Evolution","icon":"rocket","href":"/courses/engineering-papers/chapter-8-impact-evolution"}]},{"group":"Apache Hadoop","icon":"elephant","pages":[{"title":"Apache Hadoop","sidebarTitle":"Hadoop Overview","icon":"database","href":"/courses/engineering-papers/hadoop-overview"},{"title":"Introduction and Origins","sidebarTitle":"Chapter 1: Introduction","icon":"flag","href":"/courses/engineering-papers/hadoop-chapter-1-introduction"},{"title":"HDFS Architecture","sidebarTitle":"Chapter 2: HDFS","icon":"hard-drive","href":"/courses/engineering-papers/hadoop-chapter-2-hdfs-architecture"},{"title":"MapReduce Framework","sidebarTitle":"Chapter 3: MapReduce","icon":"diagram-project","href":"/courses/engineering-papers/hadoop-chapter-3-mapreduce-framework"},{"title":"YARN: Resource Management","sidebarTitle":"Chapter 4: YARN","icon":"layer-group","href":"/courses/engineering-papers/hadoop-chapter-4-yarn"},{"title":"Hadoop Ecosystem","sidebarTitle":"Chapter 5: Ecosystem","icon":"puzzle-piece","href":"/courses/engineering-papers/hadoop-chapter-5-ecosystem"},{"title":"Fault Tolerance and Reliability","sidebarTitle":"Chapter 6: Fault Tolerance","icon":"shield-check","href":"/courses/engineering-papers/hadoop-chapter-6-fault-tolerance"},{"title":"Performance Tuning and Optimization","sidebarTitle":"Chapter 7: Performance","icon":"gauge-high","href":"/courses/engineering-papers/hadoop-chapter-7-performance"},{"title":"Hadoop in Production","sidebarTitle":"Chapter 8: Production","icon":"server","href":"/courses/engineering-papers/hadoop-chapter-8-production"}]},{"group":"Amazon DynamoDB","icon":"database","pages":[{"title":"Amazon DynamoDB","sidebarTitle":"DynamoDB Overview","icon":"database","href":"/courses/engineering-papers/dynamodb-overview"},{"title":"Introduction and Origins","sidebarTitle":"Chapter 1: Introduction","icon":"flag","href":"/courses/engineering-papers/dynamodb-chapter-1-introduction"},{"title":"Architecture and Partitioning","sidebarTitle":"Chapter 2: Architecture","icon":"sitemap","href":"/courses/engineering-papers/dynamodb-chapter-2-architecture"},{"title":"Data Modeling in DynamoDB","sidebarTitle":"Chapter 3: Data Model","icon":"database","href":"/courses/engineering-papers/dynamodb-chapter-3-data-model"},{"title":"Consistency Models in DynamoDB","sidebarTitle":"Chapter 4: Consistency","icon":"scale-balanced","href":"/courses/engineering-papers/dynamodb-chapter-4-consistency"},{"title":"Performance Optimization in DynamoDB","sidebarTitle":"Chapter 5: Performance","icon":"gauge-high","href":"/courses/engineering-papers/dynamodb-chapter-5-performance"},{"title":"Advanced DynamoDB Features","sidebarTitle":"Chapter 6: Advanced Features","icon":"wand-magic-sparkles","href":"/courses/engineering-papers/dynamodb-chapter-6-advanced-features"},{"title":"Fault Tolerance and Reliability","sidebarTitle":"Chapter 7: Fault Tolerance","icon":"shield-check","href":"/courses/engineering-papers/dynamodb-chapter-7-fault-tolerance"},{"title":"DynamoDB in Production","sidebarTitle":"Chapter 8: Production","icon":"server","href":"/courses/engineering-papers/dynamodb-chapter-8-production"}]}]},{"group":"Distributed System Tools","icon":"server","pages":[{"group":"Apache Hadoop","icon":"elephant","pages":[{"title":"Apache Hadoop Mastery","sidebarTitle":"Hadoop Overview","icon":"elephant","href":"/distributed-systems-tools/hadoop-overview"},{"title":"Introduction \u0026 Foundational Papers","sidebarTitle":"1. Introduction \u0026 Papers","icon":"book-open","href":"/distributed-systems-tools/hadoop-introduction"},{"title":"HDFS Architecture \u0026 Internals","sidebarTitle":"2. HDFS Architecture","icon":"database","href":"/distributed-systems-tools/hadoop-hdfs"},{"title":"Advanced HDFS: Federation, HA \u0026 Erasure Coding","sidebarTitle":"2b. Advanced HDFS","icon":"layer-group","href":"/distributed-systems-tools/hadoop-hdfs-advanced"},{"title":"MapReduce Programming Model","sidebarTitle":"3. MapReduce Programming","icon":"code","href":"/distributed-systems-tools/hadoop-mapreduce"},{"title":"YARN Resource Management","sidebarTitle":"4. YARN Architecture","icon":"layer-group","href":"/distributed-systems-tools/hadoop-yarn"},{"title":"Hadoop Ecosystem \u0026 Integration","sidebarTitle":"5. Ecosystem Tools","icon":"puzzle-piece","href":"/distributed-systems-tools/hadoop-ecosystem"},{"title":"Data Processing Patterns \u0026 Best Practices","sidebarTitle":"6. Processing Patterns","icon":"diagram-project","href":"/distributed-systems-tools/hadoop-patterns"},{"title":"Production Deployment \u0026 Operations","sidebarTitle":"7. Production Operations","icon":"server","href":"/distributed-systems-tools/hadoop-production"},{"title":"Capstone Project: End-to-End Data Pipeline","sidebarTitle":"8. Capstone Project","icon":"trophy","href":"/distributed-systems-tools/hadoop-capstone"}]},{"group":"Apache Spark","icon":"bolt","pages":[{"title":"Apache Spark Mastery","sidebarTitle":"Spark Overview","icon":"bolt","href":"/distributed-systems-tools/spark-overview"},{"title":"Demystifying the RDD Paper: Spark's Foundation","sidebarTitle":"1. RDD Paper Deep-Dive","icon":"book-open","href":"/distributed-systems-tools/spark-introduction"},{"title":"Demystifying RDD Programming: From Theory to Production","sidebarTitle":"2. RDD Programming","icon":"bolt","href":"/distributed-systems-tools/spark-rdd"},{"title":"Spark SQL \u0026 DataFrames","sidebarTitle":"3. Spark SQL","icon":"table","href":"/distributed-systems-tools/spark-sql"},{"title":"Structured Streaming","sidebarTitle":"4. Streaming","icon":"bolt","href":"/distributed-systems-tools/spark-streaming"},{"title":"MLlib for Machine Learning","sidebarTitle":"5. MLlib","icon":"bolt","href":"/distributed-systems-tools/spark-mllib"},{"title":"Performance Tuning","sidebarTitle":"6. Performance Tuning","icon":"bolt","href":"/distributed-systems-tools/spark-tuning"},{"title":"Cluster Deployment","sidebarTitle":"7. Operations","icon":"bolt","href":"/distributed-systems-tools/spark-operations"},{"title":"Advanced Topics","sidebarTitle":"8. Advanced","icon":"bolt","href":"/distributed-systems-tools/spark-advanced"},{"title":"Capstone Project","sidebarTitle":"9. Capstone","icon":"bolt","href":"/distributed-systems-tools/spark-capstone"}]},{"group":"Apache Flink","icon":"wave-pulse","pages":[{"title":"Apache Flink Mastery","sidebarTitle":"Flink Overview","icon":"wave-pulse","href":"/distributed-systems-tools/flink-overview"},{"title":"Demystifying the Dataflow Model: True Stream Processing with Flink","sidebarTitle":"1. Introduction","icon":"wave-pulse","href":"/distributed-systems-tools/flink-introduction"},{"title":"DataStream API","sidebarTitle":"2. DataStream API","icon":"wave-pulse","href":"/distributed-systems-tools/flink-datastream"},{"title":"Event Time \u0026 Watermarks","sidebarTitle":"3. Event Time","icon":"wave-pulse","href":"/distributed-systems-tools/flink-eventtime"},{"title":"Windows \u0026 Time Operations","sidebarTitle":"4. Windows","icon":"wave-pulse","href":"/distributed-systems-tools/flink-windows"},{"title":"Demystifying Stateful Stream Processing: Flink's State Management Deep Dive","sidebarTitle":"5. State \u0026 Timers","icon":"database","href":"/distributed-systems-tools/flink-state"},{"title":"Declarative Stream Processing: Flink SQL \u0026 Table API Deep Dive","sidebarTitle":"6. SQL \u0026 Table API","icon":"table","href":"/distributed-systems-tools/flink-sql"},{"title":"Complex Event Processing: Pattern Detection at Scale with Flink CEP","sidebarTitle":"7. Complex Event Processing","icon":"sitemap","href":"/distributed-systems-tools/flink-cep"},{"title":"Production Flink: Deployment, Operations \u0026 Monitoring at Scale","sidebarTitle":"8. Production Operations","icon":"server","href":"/distributed-systems-tools/flink-operations"},{"title":"Capstone: Production-Grade Real-Time Fraud Detection System","sidebarTitle":"9. Capstone Project","icon":"diagram-project","href":"/distributed-systems-tools/flink-capstone"}]},{"group":"Apache Beam","icon":"diagram-project","pages":[{"title":"Apache Beam Mastery","sidebarTitle":"Beam Overview","icon":"diagram-project","href":"/distributed-systems-tools/beam-overview"},{"title":"Demystifying the Dataflow Model: Write Once, Run Anywhere with Apache Beam","sidebarTitle":"1. Introduction","icon":"diagram-project","href":"/distributed-systems-tools/beam-introduction"},{"title":"Core Programming Model","sidebarTitle":"2. Core Model","icon":"diagram-project","href":"/distributed-systems-tools/beam-core"},{"title":"Windowing \u0026 Time","sidebarTitle":"3. Windowing","icon":"diagram-project","href":"/distributed-systems-tools/beam-windowing"},{"title":"Triggers \u0026 Watermarks","sidebarTitle":"4. Triggers","icon":"diagram-project","href":"/distributed-systems-tools/beam-triggers"},{"title":"State \u0026 Timers","sidebarTitle":"5. State","icon":"diagram-project","href":"/distributed-systems-tools/beam-state"},{"title":"Beam I/O Connectors","sidebarTitle":"6. I/O","icon":"diagram-project","href":"/distributed-systems-tools/beam-io"},{"title":"Beam SQL","sidebarTitle":"7. SQL","icon":"diagram-project","href":"/distributed-systems-tools/beam-sql"},{"title":"Multi-Runner Execution","sidebarTitle":"8. Runners","icon":"diagram-project","href":"/distributed-systems-tools/beam-runners"},{"title":"Capstone Project","sidebarTitle":"9. Capstone","icon":"diagram-project","href":"/distributed-systems-tools/beam-capstone"}]},{"group":"Apache Airflow","icon":"wind","pages":[{"title":"What is Apache Airflow?","sidebarTitle":"Overview","icon":"wind","href":"/distributed-systems-tools/airflow-overview"},{"title":"Airflow Core Concepts","sidebarTitle":"Core Concepts","icon":"diagram-project","href":"/distributed-systems-tools/airflow-core-concepts"},{"title":"Airflow Operators","sidebarTitle":"Operators","icon":"puzzle-piece","href":"/distributed-systems-tools/airflow-operators"},{"title":"Airflow Scheduling","sidebarTitle":"Scheduling","icon":"clock","href":"/distributed-systems-tools/airflow-scheduling"}]},{"group":"Apache Cassandra","icon":"database","pages":[{"title":"Apache Cassandra Mastery","sidebarTitle":"Overview","icon":"database","href":"/distributed-systems-tools/cassandra-overview"},{"title":"The Cassandra Paper \u0026 Core Architecture","sidebarTitle":"1. Introduction \u0026 Paper","icon":"book-open","href":"/distributed-systems-tools/cassandra-paper"},{"title":"Cassandra Architecture \u0026 Storage Internals","sidebarTitle":"2. Architecture \u0026 Internals","icon":"diagram-project","href":"/distributed-systems-tools/cassandra-architecture-internals"},{"title":"Query-Driven Data Modeling in Cassandra","sidebarTitle":"3. Data Modeling","icon":"table","href":"/distributed-systems-tools/cassandra-data-modeling"},{"title":"Cassandra Read \u0026 Write Path Internals","sidebarTitle":"4. Read/Write Internals","icon":"route","href":"/distributed-systems-tools/cassandra-read-write-internals"},{"title":"Cluster Operations \u0026 Multi-DC Replication","sidebarTitle":"5. Cluster Operations","icon":"server","href":"/distributed-systems-tools/cassandra-cluster-operations"},{"title":"Performance Tuning \u0026 Production Operations","sidebarTitle":"6. Performance \u0026 Production","icon":"gauge-high","href":"/distributed-systems-tools/cassandra-performance-production"},{"title":"Capstone: Building a Real-Time Analytics Platform","sidebarTitle":"7. Capstone Project","icon":"rocket","href":"/distributed-systems-tools/cassandra-capstone"}]},{"group":"Neo4j Graph Database","icon":"diagram-project","pages":[{"title":"Neo4j Graph Database Mastery","sidebarTitle":"Overview","icon":"diagram-project","href":"/distributed-systems-tools/neo4j-overview"},{"title":"The Graph Database Story: From Theory to Neo4j","sidebarTitle":"2. Foundational Papers","icon":"scroll","href":"/distributed-systems-tools/neo4j-paper"},{"title":"Neo4j Architecture \u0026 Native Graph Storage","sidebarTitle":"3. Architecture \u0026 Storage","icon":"database","href":"/distributed-systems-tools/neo4j-architecture-storage"},{"title":"Cypher Query Language Mastery","sidebarTitle":"4. Cypher Mastery","icon":"code","href":"/distributed-systems-tools/neo4j-cypher-mastery"},{"title":"Graph Data Modeling Best Practices","sidebarTitle":"5. Data Modeling","icon":"diagram-project","href":"/distributed-systems-tools/neo4j-data-modeling"},{"title":"Graph Algorithms at Scale","sidebarTitle":"6. Graph Algorithms","icon":"diagram-project","href":"/distributed-systems-tools/neo4j-graph-algorithms"},{"title":"Production Deployment \u0026 Operations","sidebarTitle":"7. Production \u0026 Ops","icon":"server","href":"/distributed-systems-tools/neo4j-production-deployment"},{"title":"Capstone: Building a Knowledge Graph Platform","sidebarTitle":"8. Capstone Project","icon":"rocket","href":"/distributed-systems-tools/neo4j-capstone"}]}]}]}]},"basePath":"","title":"Statistical Inference: Conclusions from Samples - Dev Weekends","deploymentId":"dpl_HhUetB7eHHDAmK9T1Teip38TgFx9","buildId":"dpl_HhUetB7eHHDAmK9T1Teip38TgFx9","dynamics":["07c022d89b","a74be98ba7"],"chunks":["Frame-DevImLcx.js","DynamicMarkdown-BGHukeRM.js","zoom-image-lightbox-DQG3o8Eu.js","lightbox-handle-r17bVUz3.js"]}