<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Sami</title>
    <description>The latest articles on DEV Community by Sami (@sami21234).</description>
    <link>https://dev.to/sami21234</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3483986%2Fbc3a0cbe-52d2-468e-8364-ee7313e42972.jpeg</url>
      <title>DEV Community: Sami</title>
      <link>https://dev.to/sami21234</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/sami21234"/>
    <language>en</language>
    <item>
      <title>Part 6 - STATISTICS</title>
      <dc:creator>Sami</dc:creator>
      <pubDate>Sat, 08 Aug 2026 07:47:55 +0000</pubDate>
      <link>https://dev.to/sami21234/part-6-statistics-1ah</link>
      <guid>https://dev.to/sami21234/part-6-statistics-1ah</guid>
      <description>&lt;h2&gt;
  
  
  Bernoulli, Binomial Distribution &amp;amp; Central Limit Theorem Explained from First Principles
&lt;/h2&gt;

&lt;p&gt;When I first started learning probability, I came across terms like:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Bernoulli Distribution&lt;/li&gt;
&lt;li&gt;Binomial Distribution&lt;/li&gt;
&lt;li&gt;Sampling Distribution&lt;/li&gt;
&lt;li&gt;Central Limit Theorem&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;At first, they felt like completely different topics.&lt;/p&gt;

&lt;p&gt;But after understanding the &lt;strong&gt;reason behind each concept&lt;/strong&gt;, I realized that they are actually connected.&lt;/p&gt;

&lt;p&gt;The entire story starts with a very simple idea:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;What happens when I repeat a random experiment multiple times?&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Let's understand it step by step.&lt;/p&gt;




&lt;h2&gt;
  
  
  Start With One Simple Experiment
&lt;/h2&gt;

&lt;p&gt;Imagine I ask one person:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;"Will you like this blog post?"&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;There are only two possible answers:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Yes
No
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We can represent them as:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Yes → 1
No  → 0
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is the simplest possible random experiment.&lt;/p&gt;

&lt;p&gt;And this is where the &lt;strong&gt;Bernoulli Distribution&lt;/strong&gt; begins.&lt;/p&gt;




&lt;h2&gt;
  
  
  What is Bernoulli Distribution?
&lt;/h2&gt;

&lt;p&gt;A Bernoulli Distribution models an experiment with exactly &lt;strong&gt;two possible outcomes&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;We usually call them:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Success → 1
Failure → 0
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;For example:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Customer buys → 1&lt;/li&gt;
&lt;li&gt;Customer doesn't buy → 0&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Or:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Email is spam → 1&lt;/li&gt;
&lt;li&gt;Email is not spam → 0&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Or:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;User clicks an advertisement → 1&lt;/li&gt;
&lt;li&gt;User doesn't click → 0&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The Bernoulli Distribution has only &lt;strong&gt;one parameter&lt;/strong&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;p = probability of success
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The probability of failure is:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;1 - p
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;So if the probability that a customer purchases something is 0.3:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;P(success) = 0.3

P(failure) = 0.7
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That's Bernoulli.&lt;/p&gt;




&lt;h2&gt;
  
  
  But What If We Repeat the Experiment?
&lt;/h2&gt;

&lt;p&gt;Now let's make the problem slightly more interesting.&lt;/p&gt;

&lt;p&gt;Suppose the probability that someone likes my blog is:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;p = 0.5
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I ask &lt;strong&gt;3 people&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Each person can either:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Like → Success
Don't Like → Failure
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now I don't care about one person's answer.&lt;/p&gt;

&lt;p&gt;Instead, I ask:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;How many people out of 3 will like it?&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Possible answers are:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;0 people
1 person
2 people
3 people
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now we've moved from &lt;strong&gt;Bernoulli&lt;/strong&gt; to &lt;strong&gt;Binomial Distribution&lt;/strong&gt;.&lt;/p&gt;




&lt;h2&gt;
  
  
  What is Binomial Distribution?
&lt;/h2&gt;

&lt;p&gt;The Binomial Distribution tells us:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;How many successes will I get in a fixed number of independent trials?&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Think of it as:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Bernoulli + repetition = Binomial&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;That's the easiest way I remember it.&lt;/p&gt;




&lt;h2&gt;
  
  
  Bernoulli vs Binomial
&lt;/h2&gt;

&lt;p&gt;Let's make the difference very clear.&lt;/p&gt;

&lt;h3&gt;
  
  
  Bernoulli
&lt;/h3&gt;

&lt;p&gt;One experiment:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Will this customer buy?

Yes / No
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Binomial
&lt;/h3&gt;

&lt;p&gt;Multiple experiments:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Out of 100 customers,

How many will buy?
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;So:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Bernoulli deals with one trial.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Binomial deals with multiple trials.&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  Conditions for Binomial Distribution
&lt;/h2&gt;

&lt;p&gt;For something to follow a Binomial Distribution, we need four important conditions.&lt;/p&gt;

&lt;h3&gt;
  
  
  1. Fixed Number of Trials
&lt;/h3&gt;

&lt;p&gt;We decide the number of experiments beforehand.&lt;/p&gt;

&lt;p&gt;For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;n = 100 customers
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h3&gt;
  
  
  2. Only Two Outcomes
&lt;/h3&gt;

&lt;p&gt;Each trial has two possible outcomes:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Success
Failure
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h3&gt;
  
  
  3. Same Probability
&lt;/h3&gt;

&lt;p&gt;The probability of success remains constant.&lt;/p&gt;

&lt;p&gt;For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;p = 0.5
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;for every trial.&lt;/p&gt;




&lt;h3&gt;
  
  
  4. Independent Trials
&lt;/h3&gt;

&lt;p&gt;One trial should not affect another.&lt;/p&gt;

&lt;p&gt;For example:&lt;/p&gt;

&lt;p&gt;If one customer buys a product,&lt;/p&gt;

&lt;p&gt;that shouldn't automatically change whether another randomly selected customer buys it.&lt;/p&gt;




&lt;h2&gt;
  
  
  A Simple Binomial Example
&lt;/h2&gt;

&lt;p&gt;Suppose:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Probability of success = 0.5

Number of people = 3
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We want to know:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;What is the probability that exactly 2 out of 3 people like the blog?&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Possible combinations include:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Like, Like, Don't Like

Like, Don't Like, Like

Don't Like, Like, Like
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;There are 3 ways to get exactly 2 successes.&lt;/p&gt;

&lt;p&gt;The Binomial Distribution allows us to calculate the probability of this event.&lt;/p&gt;

&lt;p&gt;The important thing isn't memorizing the formula.&lt;/p&gt;

&lt;p&gt;The important idea is:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;We are counting the number of successes across repeated Bernoulli trials.&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  Where is Binomial Distribution Used?
&lt;/h2&gt;

&lt;p&gt;Binomial Distribution is extremely useful in Data Science.&lt;/p&gt;

&lt;p&gt;For example:&lt;/p&gt;

&lt;h3&gt;
  
  
  Binary Classification
&lt;/h3&gt;

&lt;p&gt;Suppose we build a spam detection model.&lt;/p&gt;

&lt;p&gt;Every email is:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Spam
Not Spam
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That's a binary outcome.&lt;/p&gt;




&lt;h3&gt;
  
  
  A/B Testing
&lt;/h3&gt;

&lt;p&gt;Suppose we test two versions of a website.&lt;/p&gt;

&lt;p&gt;Version A:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;1000 visitors
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Version B:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;1000 visitors
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;For every visitor:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Clicked → Success
Didn't click → Failure
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We can model the number of clicks using a Binomial Distribution.&lt;/p&gt;




&lt;h3&gt;
  
  
  Hypothesis Testing
&lt;/h3&gt;

&lt;p&gt;We can use Binomial Distribution to calculate how likely a certain number of successes would be under a particular assumption.&lt;/p&gt;

&lt;p&gt;This helps us decide whether the observed result provides evidence against our assumption.&lt;/p&gt;




&lt;h2&gt;
  
  
  Now Let's Make the Problem Much Bigger
&lt;/h2&gt;

&lt;p&gt;So far, we've talked about individual observations.&lt;/p&gt;

&lt;p&gt;But Data Science usually deals with &lt;strong&gt;populations and samples&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Suppose I want to know:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;What is the average income of people in India?&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;I obviously cannot ask every single person.&lt;/p&gt;

&lt;p&gt;There are far too many people.&lt;/p&gt;

&lt;p&gt;So what do I do?&lt;/p&gt;

&lt;p&gt;I take a &lt;strong&gt;sample&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Population

↓

Take a random sample of 100 people

↓

Calculate their average income
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Maybe I get:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;₹45,000
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;But what if I take another 100 people?&lt;/p&gt;

&lt;p&gt;Maybe I get:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;₹48,000
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Another sample:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;₹43,500
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Another:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;₹46,200
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Something interesting has happened.&lt;/p&gt;

&lt;p&gt;The &lt;strong&gt;sample means themselves are changing&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;And this brings us to the next concept.&lt;/p&gt;




&lt;h2&gt;
  
  
  What is Sampling Distribution?
&lt;/h2&gt;

&lt;p&gt;A Sampling Distribution is:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;The probability distribution of a statistic calculated from many samples of the same size taken from a population.&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;That sounds complicated.&lt;/p&gt;

&lt;p&gt;Let's break it down.&lt;/p&gt;

&lt;p&gt;Imagine I have a population.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Population
100000 people
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Instead of taking one sample, I take many samples.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Sample 1 → Mean = ₹45,000

Sample 2 → Mean = ₹47,000

Sample 3 → Mean = ₹44,500

Sample 4 → Mean = ₹46,200

Sample 5 → Mean = ₹45,800

...
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now I have a new dataset:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;45,000
47,000
44,500
46,200
45,800
...
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;These aren't individual people's salaries.&lt;/p&gt;

&lt;p&gt;They are &lt;strong&gt;sample means&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;The distribution of these sample means is called the:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Sampling Distribution of the Mean&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  Why Is Sampling Distribution Important?
&lt;/h2&gt;

&lt;p&gt;Because we usually don't have access to the entire population.&lt;/p&gt;

&lt;p&gt;We only have a sample.&lt;/p&gt;

&lt;p&gt;So we need to answer:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;"How reliable is the statistic I calculated from my sample?"&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Sampling distributions help us understand the &lt;strong&gt;variability of sample statistics&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;This is the foundation for:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Confidence intervals&lt;/li&gt;
&lt;li&gt;Hypothesis testing&lt;/li&gt;
&lt;li&gt;Statistical inference&lt;/li&gt;
&lt;li&gt;Population estimation&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  And Now We Reach the Central Limit Theorem
&lt;/h2&gt;

&lt;p&gt;This is where everything starts coming together.&lt;/p&gt;

&lt;p&gt;The Central Limit Theorem, or &lt;strong&gt;CLT&lt;/strong&gt;, is one of the most important ideas in statistics.&lt;/p&gt;

&lt;p&gt;And the basic idea is surprisingly simple.&lt;/p&gt;

&lt;p&gt;Suppose the original population looks completely strange.&lt;/p&gt;

&lt;p&gt;Maybe it is:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Skewed&lt;/li&gt;
&lt;li&gt;Uniform&lt;/li&gt;
&lt;li&gt;Log-normal&lt;/li&gt;
&lt;li&gt;Non-Gaussian&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Now repeatedly take sufficiently large random samples and calculate their means.&lt;/p&gt;

&lt;p&gt;Something amazing happens.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;The distribution of those sample means starts looking approximately Normal.&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;This is the Central Limit Theorem.&lt;/p&gt;




&lt;h2&gt;
  
  
  Let's Visualize the Idea
&lt;/h2&gt;

&lt;p&gt;Imagine our original population looks like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;       *
      **
    ****
***************
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;It is heavily skewed.&lt;/p&gt;

&lt;p&gt;We take many samples.&lt;/p&gt;

&lt;p&gt;For every sample, we calculate the mean.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Sample 1 → Mean
Sample 2 → Mean
Sample 3 → Mean
Sample 4 → Mean
...
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now plot all those means.&lt;/p&gt;

&lt;p&gt;The resulting distribution starts looking more like:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;           *
         *   *
       *       *
     *           *
___*_______________*___
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A bell curve.&lt;/p&gt;

&lt;p&gt;That's the magic of the &lt;strong&gt;Central Limit Theorem&lt;/strong&gt;.&lt;/p&gt;




&lt;h2&gt;
  
  
  The Most Important Insight
&lt;/h2&gt;

&lt;p&gt;The CLT does &lt;strong&gt;not&lt;/strong&gt; say:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;"Every dataset is normally distributed."&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;That's wrong.&lt;/p&gt;

&lt;p&gt;It says:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;The distribution of sample means approaches a Normal Distribution as the sample size becomes sufficiently large, under the required assumptions.&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;This distinction is extremely important.&lt;/p&gt;

&lt;p&gt;Your original data can be non-normal.&lt;/p&gt;

&lt;p&gt;The &lt;strong&gt;sampling distribution of the mean&lt;/strong&gt; can still become approximately normal.&lt;/p&gt;




&lt;h2&gt;
  
  
  Conditions for the Central Limit Theorem
&lt;/h2&gt;

&lt;p&gt;The source material gives the following important conditions.&lt;/p&gt;

&lt;h3&gt;
  
  
  1. Large Enough Sample
&lt;/h3&gt;

&lt;p&gt;A commonly used rule of thumb is:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;n ≥ 30
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;But this isn't a universal magic number.&lt;/p&gt;

&lt;p&gt;The required sample size can depend on the underlying distribution and how strongly it deviates from normality.&lt;/p&gt;




&lt;h3&gt;
  
  
  2. Finite Variance
&lt;/h3&gt;

&lt;p&gt;The population should have finite variance.&lt;/p&gt;




&lt;h3&gt;
  
  
  3. Independent and Identically Distributed Variables
&lt;/h3&gt;

&lt;p&gt;The observations should be independent and come from the same underlying distribution.&lt;/p&gt;




&lt;h2&gt;
  
  
  Why Does CLT Matter So Much?
&lt;/h2&gt;

&lt;p&gt;Because it allows us to make conclusions about a large population using samples.&lt;/p&gt;

&lt;p&gt;Suppose I want to estimate the average income of Indians.&lt;/p&gt;

&lt;p&gt;I don't need to collect everyone's income.&lt;/p&gt;

&lt;p&gt;Instead:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Population

↓

Random Samples

↓

Sample Means

↓

Sampling Distribution

↓

Statistical Inference
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The CLT gives us the theoretical foundation for many of the statistical methods we use.&lt;/p&gt;




&lt;h2&gt;
  
  
  Real-World Case Study: Average Income
&lt;/h2&gt;

&lt;p&gt;Let's say we want to estimate the average income of a population.&lt;/p&gt;

&lt;p&gt;We collect multiple random samples.&lt;/p&gt;

&lt;p&gt;Each sample has more than 30 observations.&lt;/p&gt;

&lt;p&gt;For every sample, we calculate:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Sample Mean
Sample Standard Deviation
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now we calculate the average of all the sample means.&lt;/p&gt;

&lt;p&gt;This gives us an estimate of the population mean.&lt;/p&gt;

&lt;p&gt;Then we calculate the &lt;strong&gt;standard error&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;The standard error tells us how much the sample mean tends to vary from sample to sample.&lt;/p&gt;

&lt;p&gt;A common formula for the standard error of the mean is:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;SE = σ / √n
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;where:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;σ = population standard deviation
n = sample size
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;When the population standard deviation is unknown, we commonly estimate it using the sample standard deviation.&lt;/p&gt;




&lt;h2&gt;
  
  
  Confidence Interval
&lt;/h2&gt;

&lt;p&gt;Now suppose our estimated mean is:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;₹50,000
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Instead of saying:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;"The true population average is exactly ₹50,000."&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;we can provide a range.&lt;/p&gt;

&lt;p&gt;For a 95% confidence interval under the normal approximation:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Lower Limit = Mean - 1.96 × Standard Error

Upper Limit = Mean + 1.96 × Standard Error
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;So instead of giving one number,&lt;/p&gt;

&lt;p&gt;we provide a range that represents uncertainty around our estimate.&lt;/p&gt;

&lt;p&gt;This is much more useful in real-world statistics.&lt;/p&gt;




&lt;h2&gt;
  
  
  Why Does Sample Size Matter?
&lt;/h2&gt;

&lt;p&gt;Imagine asking only 3 people about the average salary.&lt;/p&gt;

&lt;p&gt;You might get a very unreliable estimate.&lt;/p&gt;

&lt;p&gt;Now imagine asking 1,000 people.&lt;/p&gt;

&lt;p&gt;The estimate is likely to be more stable.&lt;/p&gt;

&lt;p&gt;This is one reason the CLT is so useful.&lt;/p&gt;

&lt;p&gt;As sample size increases:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Sample means become less variable
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;and the sampling distribution becomes more concentrated around the population mean.&lt;/p&gt;




&lt;h2&gt;
  
  
  Connecting Everything Together
&lt;/h2&gt;

&lt;p&gt;Let's put the entire story together.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 1 — Bernoulli
&lt;/h3&gt;

&lt;p&gt;One experiment with two outcomes.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Success / Failure
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Step 2 — Binomial
&lt;/h3&gt;

&lt;p&gt;Repeat Bernoulli experiments.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;How many successes?
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Step 3 — Sampling
&lt;/h3&gt;

&lt;p&gt;Take a subset from a population.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Population → Sample
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Step 4 — Sampling Distribution
&lt;/h3&gt;

&lt;p&gt;Take many samples and calculate a statistic.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Sample → Statistic

Many samples → Distribution of statistics
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Step 5 — Central Limit Theorem
&lt;/h3&gt;

&lt;p&gt;For sufficiently large samples, the distribution of sample means approaches a Normal Distribution.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Many Sample Means
        ↓
Approximately Normal Distribution
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is the connection that made these topics much easier for me to understand.&lt;/p&gt;




&lt;h2&gt;
  
  
  Where Does This Appear in Data Science?
&lt;/h2&gt;

&lt;p&gt;These concepts aren't just theoretical.&lt;/p&gt;

&lt;p&gt;They appear in many practical situations.&lt;/p&gt;

&lt;h3&gt;
  
  
  A/B Testing
&lt;/h3&gt;

&lt;p&gt;Compare conversion rates between two groups.&lt;/p&gt;

&lt;h3&gt;
  
  
  Machine Learning
&lt;/h3&gt;

&lt;p&gt;Understand the statistical behavior of samples and model estimates.&lt;/p&gt;

&lt;h3&gt;
  
  
  Hypothesis Testing
&lt;/h3&gt;

&lt;p&gt;Determine whether observed results are consistent with a particular assumption.&lt;/p&gt;

&lt;h3&gt;
  
  
  Confidence Intervals
&lt;/h3&gt;

&lt;p&gt;Estimate population parameters using sample data.&lt;/p&gt;

&lt;h3&gt;
  
  
  Business Analytics
&lt;/h3&gt;

&lt;p&gt;Estimate things like:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Average customer spending&lt;/li&gt;
&lt;li&gt;Conversion rates&lt;/li&gt;
&lt;li&gt;Average order value&lt;/li&gt;
&lt;li&gt;Customer satisfaction&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Final Thoughts
&lt;/h2&gt;

&lt;p&gt;When I first encountered Bernoulli, Binomial, Sampling Distribution, and CLT, they looked like separate chapters.&lt;/p&gt;

&lt;p&gt;But after thinking from first principles, I realized they form a chain.&lt;/p&gt;

&lt;p&gt;It starts with:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;One random experiment.&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Then:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Repeat the experiment.&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Then:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Take samples from a population.&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Then:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Look at the distribution of statistics from those samples.&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;And finally:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;The Central Limit Theorem tells us that the distribution of sample means tends toward a Normal Distribution when the conditions are satisfied and the sample size is sufficiently large.&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;That's the bigger picture.&lt;/p&gt;

&lt;p&gt;And once you see the connection, these concepts become much easier to remember.&lt;/p&gt;




&lt;h2&gt;
  
  
  Key Takeaways
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Bernoulli Distribution&lt;/strong&gt; models one binary experiment.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Binomial Distribution&lt;/strong&gt; counts successes across a fixed number of Bernoulli trials.&lt;/li&gt;
&lt;li&gt;Binomial trials require fixed &lt;code&gt;n&lt;/code&gt;, two outcomes, constant probability, and independence.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Sampling Distribution&lt;/strong&gt; describes how a statistic behaves across repeated samples.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Central Limit Theorem&lt;/strong&gt; explains why sample means tend toward a Normal Distribution for sufficiently large samples under its assumptions.&lt;/li&gt;
&lt;li&gt;CLT does &lt;strong&gt;not&lt;/strong&gt; say the original population becomes normal.&lt;/li&gt;
&lt;li&gt;Sampling distributions are fundamental for confidence intervals and hypothesis testing.&lt;/li&gt;
&lt;li&gt;Larger samples generally make estimates of the population mean more stable.&lt;/li&gt;
&lt;li&gt;These concepts connect probability theory with practical statistical inference.&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;If you're learning Data Science, don't memorize these as four separate definitions.&lt;/p&gt;

&lt;p&gt;Think of them as one story:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Experiment → Repetition → Sampling → Sampling Distribution → Statistical Inference&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Once that story makes sense, the formulas become much easier to understand.&lt;/p&gt;

&lt;p&gt;If you didn't read the previous part, read it here: &lt;a href="https://dev.to/sami21234/part-5-statistics-102e"&gt;PART 5&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Happy Learning! 🚀&lt;/p&gt;

</description>
      <category>mathematics</category>
      <category>statistics</category>
    </item>
    <item>
      <title>Part 5 - STATISTICS</title>
      <dc:creator>Sami</dc:creator>
      <pubDate>Sat, 01 Aug 2026 09:20:14 +0000</pubDate>
      <link>https://dev.to/sami21234/part-5-statistics-102e</link>
      <guid>https://dev.to/sami21234/part-5-statistics-102e</guid>
      <description>&lt;h2&gt;
  
  
  Non-Gaussian Distributions Explained from First Principles (Beginner Friendly)
&lt;/h2&gt;

&lt;p&gt;As we all know, the real-world dataset is not &lt;strong&gt;normalized&lt;/strong&gt;, but most of us thought &lt;strong&gt;every dataset followed the famous bell curve&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;After all, everyone talks about the &lt;strong&gt;Normal Distribution&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;But then I looked at real-world datasets like:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Income of people&lt;/li&gt;
&lt;li&gt;Stock market returns&lt;/li&gt;
&lt;li&gt;Website traffic&lt;/li&gt;
&lt;li&gt;YouTube views&lt;/li&gt;
&lt;li&gt;Population of cities&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;None of them looked like a bell curve.&lt;/p&gt;

&lt;p&gt;That's when I realized something important.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Not every dataset in the real world is normally distributed.&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;In this article, we'll understand &lt;strong&gt;Non-Gaussian (Non-Normal) Distributions&lt;/strong&gt; from first principles using simple language, intuition, and real-world examples.&lt;/p&gt;




&lt;h2&gt;
  
  
  First, What Does "Non-Gaussian" Mean?
&lt;/h2&gt;

&lt;p&gt;The Normal Distribution (also called the Gaussian Distribution) has a very specific shape.&lt;/p&gt;

&lt;p&gt;It is:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Bell-shaped&lt;/li&gt;
&lt;li&gt;Symmetrical&lt;/li&gt;
&lt;li&gt;Mean = Median = Mode&lt;/li&gt;
&lt;li&gt;Most observations lie near the average&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;But what if our data doesn't look like that?&lt;/p&gt;

&lt;p&gt;Then it is called a &lt;strong&gt;Non-Gaussian Distribution&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;In simple words,&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Any probability distribution that does not follow the Normal Distribution is called a Non-Gaussian Distribution.&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  Why Should We Care?
&lt;/h2&gt;

&lt;p&gt;Imagine you are analyzing the salaries of employees.&lt;/p&gt;

&lt;p&gt;Most employees earn between ₹25,000 and ₹1,00,000.&lt;/p&gt;

&lt;p&gt;But a few CEOs earn ₹50 lakh or even ₹2 crore.&lt;/p&gt;

&lt;p&gt;Will this data form a perfect bell curve?&lt;/p&gt;

&lt;p&gt;No.&lt;/p&gt;

&lt;p&gt;The extremely high salaries pull the distribution toward one side.&lt;/p&gt;

&lt;p&gt;If we wrongly assume the data is normal, our analysis can become misleading.&lt;/p&gt;

&lt;p&gt;That's why understanding Non-Gaussian Distributions is extremely important in Data Science.&lt;/p&gt;




&lt;h2&gt;
  
  
  Before Learning Other Distributions...
&lt;/h2&gt;

&lt;p&gt;Let's understand two important ideas.&lt;/p&gt;

&lt;p&gt;These help us decide whether our data is normally distributed or not.&lt;/p&gt;




&lt;h2&gt;
  
  
  Kurtosis — How Heavy Are the Tails?
&lt;/h2&gt;

&lt;p&gt;When beginners hear the word &lt;strong&gt;Kurtosis&lt;/strong&gt;, they usually think it measures how tall the peak of a graph is.&lt;/p&gt;

&lt;p&gt;That's actually a common misconception.&lt;/p&gt;

&lt;p&gt;A better way to think about Kurtosis is this:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;How likely is the distribution to produce extreme values (outliers)?&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Imagine two classes.&lt;/p&gt;

&lt;p&gt;Class A&lt;/p&gt;

&lt;p&gt;Most students score between 60 and 80.&lt;/p&gt;

&lt;p&gt;Very few score below 20 or above 95.&lt;/p&gt;

&lt;p&gt;Class B&lt;/p&gt;

&lt;p&gt;Most students still score between 60 and 80.&lt;/p&gt;

&lt;p&gt;But every year, a few students score either 0 or 100.&lt;/p&gt;

&lt;p&gt;Which class has more extreme values?&lt;/p&gt;

&lt;p&gt;Obviously Class B.&lt;/p&gt;

&lt;p&gt;That means Class B has &lt;strong&gt;higher kurtosis&lt;/strong&gt;.&lt;/p&gt;




&lt;h2&gt;
  
  
  Three Types of Kurtosis
&lt;/h2&gt;

&lt;h2&gt;
  
  
  1. Leptokurtic
&lt;/h2&gt;

&lt;p&gt;Think of this as a distribution with &lt;strong&gt;fatter tails&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;This means:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;More outliers&lt;/li&gt;
&lt;li&gt;More extreme values&lt;/li&gt;
&lt;li&gt;Higher risk&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Example:&lt;/p&gt;

&lt;p&gt;Stock market returns.&lt;/p&gt;

&lt;p&gt;Most days the market changes very little.&lt;/p&gt;

&lt;p&gt;But occasionally it crashes or shoots upward dramatically.&lt;/p&gt;

&lt;p&gt;Those rare events create fat tails.&lt;/p&gt;




&lt;h2&gt;
  
  
  2. Platykurtic
&lt;/h2&gt;

&lt;p&gt;Now imagine a distribution with very few extreme values.&lt;/p&gt;

&lt;p&gt;Almost everything stays close to the average.&lt;/p&gt;

&lt;p&gt;This is called a &lt;strong&gt;Platykurtic Distribution&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;It has:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Thin tails&lt;/li&gt;
&lt;li&gt;Fewer outliers&lt;/li&gt;
&lt;li&gt;Lower risk&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  3. Mesokurtic
&lt;/h2&gt;

&lt;p&gt;This behaves just like the Normal Distribution.&lt;/p&gt;

&lt;p&gt;Neither too many nor too few outliers.&lt;/p&gt;

&lt;p&gt;The Normal Distribution is the best example of a Mesokurtic distribution.&lt;/p&gt;




&lt;h2&gt;
  
  
  How Do We Check Whether Data is Normal?
&lt;/h2&gt;

&lt;p&gt;Suppose someone gives you 50,000 observations.&lt;/p&gt;

&lt;p&gt;How do you know whether they follow a Normal Distribution?&lt;/p&gt;

&lt;p&gt;There are three common approaches.&lt;/p&gt;




&lt;h2&gt;
  
  
  1. Visual Inspection
&lt;/h2&gt;

&lt;p&gt;The simplest method.&lt;/p&gt;

&lt;p&gt;Create a histogram or density plot.&lt;/p&gt;

&lt;p&gt;Ask yourself:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Does it roughly look like a bell curve?&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;If yes,&lt;/p&gt;

&lt;p&gt;the data may be approximately normal.&lt;/p&gt;

&lt;p&gt;If not,&lt;/p&gt;

&lt;p&gt;it probably isn't.&lt;/p&gt;




&lt;h2&gt;
  
  
  2. QQ Plot
&lt;/h2&gt;

&lt;p&gt;Now suppose the histogram isn't very clear.&lt;/p&gt;

&lt;p&gt;We need a better method.&lt;/p&gt;

&lt;p&gt;This is where the &lt;strong&gt;QQ Plot (Quantile-Quantile Plot)&lt;/strong&gt; helps.&lt;/p&gt;

&lt;p&gt;A QQ Plot compares your dataset with a perfect Normal Distribution.&lt;/p&gt;

&lt;p&gt;If the points lie close to a straight line,&lt;/p&gt;

&lt;p&gt;your data is approximately normal.&lt;/p&gt;

&lt;p&gt;If the points bend away from the line,&lt;/p&gt;

&lt;p&gt;the data is likely Non-Gaussian.&lt;/p&gt;

&lt;p&gt;Think of it like comparing two handwriting samples.&lt;/p&gt;

&lt;p&gt;If both match,&lt;/p&gt;

&lt;p&gt;they probably came from the same person.&lt;/p&gt;

&lt;p&gt;If they don't,&lt;/p&gt;

&lt;p&gt;they are different.&lt;/p&gt;




&lt;h2&gt;
  
  
  3. Statistical Tests
&lt;/h2&gt;

&lt;p&gt;Sometimes visual inspection isn't enough.&lt;/p&gt;

&lt;p&gt;Statistical tests help us make a mathematical decision.&lt;/p&gt;

&lt;p&gt;Some commonly used tests are:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Shapiro-Wilk Test&lt;/li&gt;
&lt;li&gt;Anderson-Darling Test&lt;/li&gt;
&lt;li&gt;Kolmogorov-Smirnov Test&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If these tests produce a very small p-value (usually less than 0.05),&lt;/p&gt;

&lt;p&gt;the data is considered &lt;strong&gt;not normally distributed&lt;/strong&gt;.&lt;/p&gt;




&lt;h2&gt;
  
  
  Uniform Distribution
&lt;/h2&gt;

&lt;p&gt;Let's imagine a different experiment.&lt;/p&gt;

&lt;p&gt;Suppose a random number generator produces numbers between&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;1 and 10
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Every number has exactly the same chance of appearing.&lt;/p&gt;

&lt;p&gt;No number is more likely than another.&lt;/p&gt;

&lt;p&gt;This is called a &lt;strong&gt;Uniform Distribution&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Unlike the Normal Distribution,&lt;/p&gt;

&lt;p&gt;there is no peak.&lt;/p&gt;

&lt;p&gt;Everything is equally likely.&lt;/p&gt;




&lt;h2&gt;
  
  
  Real-Life Examples of Uniform Distribution
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Random number generators&lt;/li&gt;
&lt;li&gt;Rolling a fair die&lt;/li&gt;
&lt;li&gt;Selecting a random second in one minute&lt;/li&gt;
&lt;li&gt;Random initialization in Machine Learning&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Why Do Data Scientists Use Uniform Distribution?
&lt;/h2&gt;

&lt;p&gt;Uniform Distribution appears surprisingly often in Machine Learning.&lt;/p&gt;

&lt;p&gt;Some common applications include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Random initialization of neural network weights&lt;/li&gt;
&lt;li&gt;Random sampling&lt;/li&gt;
&lt;li&gt;Data augmentation&lt;/li&gt;
&lt;li&gt;Hyperparameter tuning&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Whenever every value should have an equal chance,&lt;/p&gt;

&lt;p&gt;Uniform Distribution becomes useful.&lt;/p&gt;




&lt;h2&gt;
  
  
  Log-Normal Distribution
&lt;/h2&gt;

&lt;p&gt;Now let's look at another interesting distribution.&lt;/p&gt;

&lt;p&gt;Imagine the income of people.&lt;/p&gt;

&lt;p&gt;Most people earn moderate salaries.&lt;/p&gt;

&lt;p&gt;A smaller number earn very high salaries.&lt;/p&gt;

&lt;p&gt;Almost nobody earns negative income.&lt;/p&gt;

&lt;p&gt;The distribution becomes heavily skewed toward the right.&lt;/p&gt;

&lt;p&gt;This is called a &lt;strong&gt;Log-Normal Distribution&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;A random variable follows a Log-Normal Distribution when its logarithm follows a Normal Distribution.&lt;/p&gt;

&lt;p&gt;Don't worry about memorizing that definition.&lt;/p&gt;

&lt;p&gt;Just remember the intuition:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Values cannot go below zero, but they can become extremely large.&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  Real-Life Examples
&lt;/h2&gt;

&lt;p&gt;Many real-world datasets follow a Log-Normal Distribution.&lt;/p&gt;

&lt;p&gt;For example:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Income of people&lt;/li&gt;
&lt;li&gt;Internet article reading time&lt;/li&gt;
&lt;li&gt;Length of online comments&lt;/li&gt;
&lt;li&gt;Duration of chess games&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Most values are small,&lt;/p&gt;

&lt;p&gt;but a few become extremely large.&lt;/p&gt;




&lt;h2&gt;
  
  
  Pareto Distribution — The Famous 80/20 Rule
&lt;/h2&gt;

&lt;p&gt;Have you ever heard this statement?&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;20% of customers generate 80% of revenue.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Or&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;20% of employees do 80% of the work.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;This idea comes from the &lt;strong&gt;Pareto Distribution&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;The Pareto Distribution models situations where&lt;/p&gt;

&lt;p&gt;a small number of observations account for most of the outcome.&lt;/p&gt;




&lt;h2&gt;
  
  
  Real-Life Examples
&lt;/h2&gt;

&lt;p&gt;The Pareto Distribution appears everywhere.&lt;/p&gt;

&lt;p&gt;Examples include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Wealth distribution&lt;/li&gt;
&lt;li&gt;Company revenue&lt;/li&gt;
&lt;li&gt;Population of cities&lt;/li&gt;
&lt;li&gt;File sizes on the internet&lt;/li&gt;
&lt;li&gt;Social media followers&lt;/li&gt;
&lt;li&gt;Sales of products&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Usually,&lt;/p&gt;

&lt;p&gt;many observations are small,&lt;/p&gt;

&lt;p&gt;while only a few are extremely large.&lt;/p&gt;




&lt;h2&gt;
  
  
  Why Does Pareto Matter?
&lt;/h2&gt;

&lt;p&gt;Suppose you own an online store.&lt;/p&gt;

&lt;p&gt;You discover that&lt;/p&gt;

&lt;p&gt;20% of your customers generate 80% of your sales.&lt;/p&gt;

&lt;p&gt;Instead of spending money on everyone,&lt;/p&gt;

&lt;p&gt;you focus on those important customers.&lt;/p&gt;

&lt;p&gt;That's exactly why businesses love Pareto analysis.&lt;/p&gt;




&lt;h2&gt;
  
  
  Transforming Non-Gaussian Data
&lt;/h2&gt;

&lt;p&gt;Sometimes machine learning algorithms work better when data is approximately normal.&lt;/p&gt;

&lt;p&gt;But what if your data isn't normal?&lt;/p&gt;

&lt;p&gt;Instead of changing the algorithm,&lt;/p&gt;

&lt;p&gt;we transform the data.&lt;/p&gt;

&lt;p&gt;Common transformations include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Log Transformation&lt;/li&gt;
&lt;li&gt;Square Root Transformation&lt;/li&gt;
&lt;li&gt;Box-Cox Transformation&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;These transformations reduce skewness and make the data easier to analyze.&lt;/p&gt;




&lt;h2&gt;
  
  
  Why Is This Important in Data Science?
&lt;/h2&gt;

&lt;p&gt;Real-world data is rarely perfect.&lt;/p&gt;

&lt;p&gt;Some datasets are:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Highly skewed&lt;/li&gt;
&lt;li&gt;Full of outliers&lt;/li&gt;
&lt;li&gt;Heavy-tailed&lt;/li&gt;
&lt;li&gt;Unevenly distributed&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Understanding Non-Gaussian Distributions helps us:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Choose the right statistical methods&lt;/li&gt;
&lt;li&gt;Build better machine learning models&lt;/li&gt;
&lt;li&gt;Detect anomalies&lt;/li&gt;
&lt;li&gt;Understand business data correctly&lt;/li&gt;
&lt;li&gt;Avoid making incorrect assumptions&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Final Thoughts
&lt;/h2&gt;

&lt;p&gt;When I first learned statistics,&lt;/p&gt;

&lt;p&gt;I thought every dataset should look like a bell curve.&lt;/p&gt;

&lt;p&gt;But real-world data taught me otherwise.&lt;/p&gt;

&lt;p&gt;Nature is messy.&lt;/p&gt;

&lt;p&gt;Businesses are messy.&lt;/p&gt;

&lt;p&gt;Human behavior is messy.&lt;/p&gt;

&lt;p&gt;That's exactly why Non-Gaussian Distributions exist.&lt;/p&gt;

&lt;p&gt;Instead of forcing every dataset to fit the Normal Distribution,&lt;/p&gt;

&lt;p&gt;we learn to recognize different patterns and choose the right model for each situation.&lt;/p&gt;

&lt;p&gt;That's what real data science is all about.&lt;/p&gt;




&lt;h2&gt;
  
  
  Key Takeaways
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Not every dataset follows a Normal Distribution.&lt;/li&gt;
&lt;li&gt;Kurtosis measures the likelihood of extreme values.&lt;/li&gt;
&lt;li&gt;Leptokurtic distributions have fat tails and more outliers.&lt;/li&gt;
&lt;li&gt;Platykurtic distributions have thin tails and fewer outliers.&lt;/li&gt;
&lt;li&gt;Mesokurtic distributions behave like the Normal Distribution.&lt;/li&gt;
&lt;li&gt;Histograms, QQ Plots, and statistical tests help detect normality.&lt;/li&gt;
&lt;li&gt;Uniform Distribution gives every value an equal probability.&lt;/li&gt;
&lt;li&gt;Log-Normal Distribution models data that grows positively and is right-skewed.&lt;/li&gt;
&lt;li&gt;Pareto Distribution explains the famous 80/20 rule.&lt;/li&gt;
&lt;li&gt;Data transformations help convert skewed data into forms that are easier to analyze.&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;If you're learning Statistics, Machine Learning, or Data Science, remember one important lesson:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Don't assume every dataset follows a Normal Distribution.&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The real skill is recognizing &lt;strong&gt;which distribution your data follows&lt;/strong&gt; and choosing the right tools accordingly.&lt;/p&gt;

&lt;p&gt;Once you understand that, you're thinking like a real Data Scientist.&lt;/p&gt;

&lt;p&gt;If you didn't read the previous part, read it here: &lt;a href="https://dev.to/sami21234/statistics-2o26"&gt;PART 4&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Happy Learning! 🚀&lt;/p&gt;

</description>
      <category>statistics</category>
      <category>beginners</category>
    </item>
    <item>
      <title>Part 4 - STATISTICS</title>
      <dc:creator>Sami</dc:creator>
      <pubDate>Fri, 24 Jul 2026 13:26:09 +0000</pubDate>
      <link>https://dev.to/sami21234/statistics-2o26</link>
      <guid>https://dev.to/sami21234/statistics-2o26</guid>
      <description>&lt;h2&gt;
  
  
  Normal Distribution Explained from First Principles (Beginner Friendly)
&lt;/h2&gt;

&lt;p&gt;When I first learned &lt;strong&gt;Normal Distribution&lt;/strong&gt;, everyone kept saying:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;"It's the most important distribution in statistics."&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;But no one explained &lt;strong&gt;why&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Why is everyone obsessed with this bell-shaped curve?&lt;/p&gt;

&lt;p&gt;Why does it appear everywhere in Data Science, Machine Learning, and even nature?&lt;/p&gt;

&lt;p&gt;In this article, we'll understand &lt;strong&gt;Normal Distribution from first principles&lt;/strong&gt;. No memorization. No complicated mathematics. Just intuition and simple examples.&lt;/p&gt;




&lt;h2&gt;
  
  
  Let's Start with a Simple Question
&lt;/h2&gt;

&lt;p&gt;Imagine you're a teacher.&lt;/p&gt;

&lt;p&gt;You have marks of 1,000 students.&lt;/p&gt;

&lt;p&gt;Will every student score exactly 70?&lt;/p&gt;

&lt;p&gt;No.&lt;/p&gt;

&lt;p&gt;Will everyone score either 0 or 100?&lt;/p&gt;

&lt;p&gt;Again, no.&lt;/p&gt;

&lt;p&gt;Instead, something interesting happens.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Most students score around the average.&lt;/li&gt;
&lt;li&gt;Fewer students score very high.&lt;/li&gt;
&lt;li&gt;Fewer students score very low.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If we draw this on a graph, we get something like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;               *
             *   *
           *       *
         *           *
       *               *
_____*___________________*_____
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This beautiful bell-shaped curve is called the &lt;strong&gt;Normal Distribution&lt;/strong&gt;.&lt;/p&gt;




&lt;h2&gt;
  
  
  Why Does This Shape Appear Everywhere?
&lt;/h2&gt;

&lt;p&gt;Think about these examples.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Heights of people&lt;/li&gt;
&lt;li&gt;IQ scores&lt;/li&gt;
&lt;li&gt;Exam marks&lt;/li&gt;
&lt;li&gt;Blood pressure&lt;/li&gt;
&lt;li&gt;Manufacturing errors&lt;/li&gt;
&lt;li&gt;Measurement errors&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In all these cases,&lt;/p&gt;

&lt;p&gt;Most observations are &lt;strong&gt;close to the average&lt;/strong&gt;, while only a few are extremely small or extremely large.&lt;/p&gt;

&lt;p&gt;Nature loves balance.&lt;/p&gt;

&lt;p&gt;That's why the Normal Distribution appears almost everywhere.&lt;/p&gt;




&lt;h2&gt;
  
  
  What is Normal Distribution?
&lt;/h2&gt;

&lt;p&gt;A &lt;strong&gt;Normal Distribution&lt;/strong&gt; is a continuous probability distribution that is:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Bell-shaped&lt;/li&gt;
&lt;li&gt;Symmetrical&lt;/li&gt;
&lt;li&gt;Centered around the mean&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;It describes situations where most values cluster around the average and fewer observations appear as we move away from it.&lt;/p&gt;




&lt;h2&gt;
  
  
  Understanding the Bell Curve
&lt;/h2&gt;

&lt;p&gt;Imagine measuring the heights of 10,000 people.&lt;/p&gt;

&lt;p&gt;You won't find&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;90% of people are 4 feet tall.&lt;/li&gt;
&lt;li&gt;90% of people are 7 feet tall.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Instead,&lt;/p&gt;

&lt;p&gt;Most people are somewhere in between.&lt;/p&gt;

&lt;p&gt;That's why the center of the curve is the tallest.&lt;/p&gt;

&lt;p&gt;As we move away from the center, fewer people exist.&lt;/p&gt;

&lt;p&gt;This creates the famous bell shape.&lt;/p&gt;




&lt;h2&gt;
  
  
  Two Numbers Define the Entire Distribution
&lt;/h2&gt;

&lt;p&gt;The amazing thing about a Normal Distribution is that it is completely described using only &lt;strong&gt;two numbers&lt;/strong&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. Mean (μ)
&lt;/h2&gt;

&lt;p&gt;The &lt;strong&gt;mean&lt;/strong&gt; tells us the center of the distribution.&lt;/p&gt;

&lt;p&gt;Think of it as the average value.&lt;/p&gt;

&lt;p&gt;Example:&lt;/p&gt;

&lt;p&gt;If the average exam score is&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;70
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;then the center of the curve is at 70.&lt;/p&gt;




&lt;h2&gt;
  
  
  2. Standard Deviation (σ)
&lt;/h2&gt;

&lt;p&gt;Knowing the center isn't enough.&lt;/p&gt;

&lt;p&gt;We also want to know&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;How spread out is the data?&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;This is measured by the &lt;strong&gt;Standard Deviation&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Small standard deviation&lt;/p&gt;

&lt;p&gt;→ Data is tightly packed around the mean.&lt;/p&gt;

&lt;p&gt;Large standard deviation&lt;/p&gt;

&lt;p&gt;→ Data is widely spread out.&lt;/p&gt;

&lt;p&gt;Imagine two classes with the same average marks of 70.&lt;/p&gt;

&lt;p&gt;Class A&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;68
69
70
71
72
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Class B&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;30
45
70
90
115
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Both have similar averages.&lt;/p&gt;

&lt;p&gt;But Class B has much more variation.&lt;/p&gt;

&lt;p&gt;That's why its standard deviation is larger.&lt;/p&gt;




&lt;h2&gt;
  
  
  Why Is the Curve Symmetrical?
&lt;/h2&gt;

&lt;p&gt;The Normal Distribution is perfectly balanced.&lt;/p&gt;

&lt;p&gt;If 20% of students score above a certain distance from the mean,&lt;/p&gt;

&lt;p&gt;then another 20% score below the same distance.&lt;/p&gt;

&lt;p&gt;The left side mirrors the right side.&lt;/p&gt;

&lt;p&gt;This symmetry makes calculations much easier.&lt;/p&gt;




&lt;h2&gt;
  
  
  Mean = Median = Mode
&lt;/h2&gt;

&lt;p&gt;In many datasets,&lt;/p&gt;

&lt;p&gt;these three values are different.&lt;/p&gt;

&lt;p&gt;But in a perfect Normal Distribution,&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Mean = Median = Mode
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Why?&lt;/p&gt;

&lt;p&gt;Because the curve is perfectly symmetrical.&lt;/p&gt;

&lt;p&gt;Everything is balanced around the center.&lt;/p&gt;




&lt;h2&gt;
  
  
  What Happens at the Ends of the Curve?
&lt;/h2&gt;

&lt;p&gt;Look carefully at the bell curve.&lt;/p&gt;

&lt;p&gt;The ends become thinner and thinner.&lt;/p&gt;

&lt;p&gt;But they never actually touch the x-axis.&lt;/p&gt;

&lt;p&gt;This property is called &lt;strong&gt;Asymptotic&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;It means&lt;/p&gt;

&lt;p&gt;there is always a tiny chance of observing extremely large or extremely small values,&lt;/p&gt;

&lt;p&gt;but that chance becomes incredibly small.&lt;/p&gt;




&lt;h2&gt;
  
  
  Standard Normal Distribution
&lt;/h2&gt;

&lt;p&gt;Now imagine two datasets.&lt;/p&gt;

&lt;p&gt;Dataset A&lt;/p&gt;

&lt;p&gt;Average height = 170 cm&lt;/p&gt;

&lt;p&gt;Dataset B&lt;/p&gt;

&lt;p&gt;Average salary = ₹60,000&lt;/p&gt;

&lt;p&gt;Can we compare them directly?&lt;/p&gt;

&lt;p&gt;No.&lt;/p&gt;

&lt;p&gt;They use completely different scales.&lt;/p&gt;

&lt;p&gt;So statisticians created a standardized version called the &lt;strong&gt;Standard Normal Distribution&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;It has:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Mean = 0

Standard Deviation = 1
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Instead of comparing raw values,&lt;/p&gt;

&lt;p&gt;we compare &lt;strong&gt;how many standard deviations away from the mean&lt;/strong&gt; they are.&lt;/p&gt;

&lt;p&gt;This standardized value is called the &lt;strong&gt;Z-score&lt;/strong&gt;.&lt;/p&gt;




&lt;h2&gt;
  
  
  What is a Z-Score?
&lt;/h2&gt;

&lt;p&gt;A Z-score answers one simple question:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;How far is this value from the average?&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Not in centimeters.&lt;/p&gt;

&lt;p&gt;Not in rupees.&lt;/p&gt;

&lt;p&gt;But in terms of &lt;strong&gt;standard deviations&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Example:&lt;/p&gt;

&lt;p&gt;Suppose&lt;/p&gt;

&lt;p&gt;Average height = 170 cm&lt;/p&gt;

&lt;p&gt;Standard deviation = 5 cm&lt;/p&gt;

&lt;p&gt;A person is 180 cm tall.&lt;/p&gt;

&lt;p&gt;That person is&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;(180 - 170) / 5 = 2
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;standard deviations above the mean.&lt;/p&gt;

&lt;p&gt;So,&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Z = 2
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now this value can be compared with any other normal distribution.&lt;/p&gt;




&lt;h2&gt;
  
  
  Why Standardize Data?
&lt;/h2&gt;

&lt;p&gt;Standardization makes different datasets comparable.&lt;/p&gt;

&lt;p&gt;Example:&lt;/p&gt;

&lt;p&gt;Student A scores&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;85/100
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Student B earns&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;₹70,000
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;These numbers have different units.&lt;/p&gt;

&lt;p&gt;After converting them into Z-scores,&lt;/p&gt;

&lt;p&gt;we can compare their relative positions in their own distributions.&lt;/p&gt;




&lt;h2&gt;
  
  
  The Famous 68–95–99.7 Rule
&lt;/h2&gt;

&lt;p&gt;One of the coolest things about the Normal Distribution is that we already know how data is spread.&lt;/p&gt;

&lt;p&gt;Approximately:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;68%&lt;/strong&gt; of observations lie within &lt;strong&gt;1 standard deviation&lt;/strong&gt; of the mean.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;95%&lt;/strong&gt; lie within &lt;strong&gt;2 standard deviations&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;99.7%&lt;/strong&gt; lie within &lt;strong&gt;3 standard deviations&lt;/strong&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This is known as the &lt;strong&gt;Empirical Rule&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;It helps us estimate probabilities without analyzing every observation.&lt;/p&gt;




&lt;h2&gt;
  
  
  Area Under the Curve
&lt;/h2&gt;

&lt;p&gt;One important fact beginners often miss is:&lt;/p&gt;

&lt;p&gt;The total area under the Normal Distribution curve is always&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;1
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;or&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;100%
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Why?&lt;/p&gt;

&lt;p&gt;Because every possible outcome must be included.&lt;/p&gt;

&lt;p&gt;When we calculate probability,&lt;/p&gt;

&lt;p&gt;we're actually finding the &lt;strong&gt;area under a part of the curve&lt;/strong&gt;.&lt;/p&gt;




&lt;h2&gt;
  
  
  What is Skewness?
&lt;/h2&gt;

&lt;p&gt;Not every dataset follows a perfect bell curve.&lt;/p&gt;

&lt;p&gt;Sometimes the data leans more toward one side.&lt;/p&gt;

&lt;p&gt;This is called &lt;strong&gt;Skewness&lt;/strong&gt;.&lt;/p&gt;




&lt;h2&gt;
  
  
  Positive Skew
&lt;/h2&gt;

&lt;p&gt;The tail is longer on the right.&lt;/p&gt;

&lt;p&gt;Example:&lt;/p&gt;

&lt;p&gt;Income data.&lt;/p&gt;

&lt;p&gt;Most people earn average salaries,&lt;/p&gt;

&lt;p&gt;while a few earn extremely high salaries.&lt;/p&gt;




&lt;h2&gt;
  
  
  Negative Skew
&lt;/h2&gt;

&lt;p&gt;The tail is longer on the left.&lt;/p&gt;

&lt;p&gt;Example:&lt;/p&gt;

&lt;p&gt;An easy exam where most students score high,&lt;/p&gt;

&lt;p&gt;but a few score very low.&lt;/p&gt;




&lt;h2&gt;
  
  
  Zero Skew
&lt;/h2&gt;

&lt;p&gt;A perfectly symmetrical distribution.&lt;/p&gt;

&lt;p&gt;This is the Normal Distribution.&lt;/p&gt;




&lt;h2&gt;
  
  
  Where is Normal Distribution Used in Data Science?
&lt;/h2&gt;

&lt;p&gt;You'll find it everywhere.&lt;/p&gt;

&lt;p&gt;Some common applications are:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Detecting outliers&lt;/li&gt;
&lt;li&gt;Hypothesis testing&lt;/li&gt;
&lt;li&gt;Building confidence intervals&lt;/li&gt;
&lt;li&gt;Linear Regression assumptions&lt;/li&gt;
&lt;li&gt;Gaussian Mixture Models (GMM)&lt;/li&gt;
&lt;li&gt;Central Limit Theorem&lt;/li&gt;
&lt;li&gt;Quality control in manufacturing&lt;/li&gt;
&lt;li&gt;Financial risk analysis&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Even if you don't calculate probabilities manually,&lt;/p&gt;

&lt;p&gt;many machine learning algorithms assume that the underlying data is approximately normally distributed.&lt;/p&gt;




&lt;h2&gt;
  
  
  Why Should Every Data Scientist Learn This?
&lt;/h2&gt;

&lt;p&gt;Normal Distribution is one of the foundations of statistics.&lt;/p&gt;

&lt;p&gt;Once you understand it,&lt;/p&gt;

&lt;p&gt;concepts like&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Z-score&lt;/li&gt;
&lt;li&gt;Confidence Intervals&lt;/li&gt;
&lt;li&gt;Hypothesis Testing&lt;/li&gt;
&lt;li&gt;Central Limit Theorem&lt;/li&gt;
&lt;li&gt;Regression&lt;/li&gt;
&lt;li&gt;Machine Learning&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;become much easier.&lt;/p&gt;

&lt;p&gt;Instead of memorizing formulas,&lt;/p&gt;

&lt;p&gt;focus on understanding the intuition.&lt;/p&gt;

&lt;p&gt;Everything else builds on top of it.&lt;/p&gt;




&lt;h2&gt;
  
  
  Final Thoughts
&lt;/h2&gt;

&lt;p&gt;When I first saw the bell curve, it looked like just another graph.&lt;/p&gt;

&lt;p&gt;Now I see it differently.&lt;/p&gt;

&lt;p&gt;It's nature's way of organizing uncertainty.&lt;/p&gt;

&lt;p&gt;Most things happen around the average.&lt;/p&gt;

&lt;p&gt;Extreme events are rare.&lt;/p&gt;

&lt;p&gt;That's exactly what the Normal Distribution captures.&lt;/p&gt;

&lt;p&gt;Once you understand this simple idea, statistics starts feeling much more intuitive.&lt;/p&gt;




&lt;h2&gt;
  
  
  Key Takeaways
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Normal Distribution is a bell-shaped, symmetrical probability distribution.&lt;/li&gt;
&lt;li&gt;Most observations occur near the mean.&lt;/li&gt;
&lt;li&gt;Mean and Standard Deviation completely define the distribution.&lt;/li&gt;
&lt;li&gt;Mean = Median = Mode in a perfect normal distribution.&lt;/li&gt;
&lt;li&gt;The curve is asymptotic—it never touches the x-axis.&lt;/li&gt;
&lt;li&gt;Z-score tells us how far a value is from the mean.&lt;/li&gt;
&lt;li&gt;The 68–95–99.7 rule explains how data is distributed.&lt;/li&gt;
&lt;li&gt;The total area under the curve is always 1.&lt;/li&gt;
&lt;li&gt;Skewness measures how much a dataset deviates from symmetry.&lt;/li&gt;
&lt;li&gt;Normal Distribution is widely used in Statistics, Data Science, and Machine Learning.&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;If you're learning Data Science, don't treat the Normal Distribution as just another chapter in statistics.&lt;/p&gt;

&lt;p&gt;Think of it as the language that explains how most real-world data behaves.&lt;/p&gt;

&lt;p&gt;Once this concept clicks, many advanced statistical and machine learning topics become much easier to understand.&lt;br&gt;
If you didn't read the previous part, read it here: &lt;a href="https://dev.to/sami21234/part-3-statistics-d53"&gt;PART 3&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Happy Learning! 🚀&lt;/p&gt;

</description>
      <category>beginners</category>
      <category>datascience</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>PART 3 - STATISTICS</title>
      <dc:creator>Sami</dc:creator>
      <pubDate>Wed, 15 Jul 2026 09:53:44 +0000</pubDate>
      <link>https://dev.to/sami21234/part-3-statistics-d53</link>
      <guid>https://dev.to/sami21234/part-3-statistics-d53</guid>
      <description>&lt;h2&gt;
  
  
  Probability Distributions Explained from First Principles (Beginner Friendly)
&lt;/h2&gt;

&lt;p&gt;When I first heard the term &lt;strong&gt;Probability Distribution&lt;/strong&gt;, I imagined something extremely mathematical.&lt;/p&gt;

&lt;p&gt;Words like &lt;strong&gt;PMF&lt;/strong&gt;, &lt;strong&gt;PDF&lt;/strong&gt;, &lt;strong&gt;CDF&lt;/strong&gt;, &lt;strong&gt;Random Variables&lt;/strong&gt;, and &lt;strong&gt;Density Estimation&lt;/strong&gt; sounded intimidating.&lt;/p&gt;

&lt;p&gt;But after spending time understanding &lt;em&gt;why&lt;/em&gt; these concepts exist, I realized something interesting:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Probability distributions are simply a smarter way of answering one question:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;"What outcomes can happen, and how likely is each one?"&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Let's understand everything from first principles.&lt;/p&gt;




&lt;h2&gt;
  
  
  Why Do We Need Probability?
&lt;/h2&gt;

&lt;p&gt;Imagine you toss a coin.&lt;/p&gt;

&lt;p&gt;Before tossing, can you tell me exactly what the result will be?&lt;/p&gt;

&lt;p&gt;No.&lt;/p&gt;

&lt;p&gt;You only know the &lt;strong&gt;possible outcomes&lt;/strong&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Heads
Tails
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This uncertainty is what probability tries to measure.&lt;/p&gt;

&lt;p&gt;Instead of saying&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;"I know what will happen."&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Probability says&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;"I know how likely each outcome is."&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  Random Variables — The First Building Block
&lt;/h2&gt;

&lt;p&gt;Before learning probability distributions, we need to understand one important idea.&lt;/p&gt;

&lt;h2&gt;
  
  
  Variables in Algebra
&lt;/h2&gt;

&lt;p&gt;In school, we learned&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;x + 5 = 10
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Here,&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;x = 5
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The variable has one unknown value.&lt;/p&gt;

&lt;p&gt;Simple.&lt;/p&gt;




&lt;h2&gt;
  
  
  Random Variables in Statistics
&lt;/h2&gt;

&lt;p&gt;Statistics looks at variables differently.&lt;/p&gt;

&lt;p&gt;Instead of asking&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;"What is x?"&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;It asks&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;"What values can x possibly take?"&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Suppose we roll a dice.&lt;/p&gt;

&lt;p&gt;Possible outcomes are&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;1
2
3
4
5
6
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The random variable isn't one unknown number.&lt;/p&gt;

&lt;p&gt;It is the &lt;strong&gt;set of all possible outcomes of a random experiment.&lt;/strong&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  Another Example
&lt;/h2&gt;

&lt;p&gt;Suppose tomorrow I count the number of customers entering my shop.&lt;/p&gt;

&lt;p&gt;Possible values could be&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;80
95
101
120
140
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I don't know today's value yet.&lt;/p&gt;

&lt;p&gt;But I know all the possible values it might take.&lt;/p&gt;

&lt;p&gt;That's a random variable.&lt;/p&gt;




&lt;h2&gt;
  
  
  Now Comes the Real Question
&lt;/h2&gt;

&lt;p&gt;Knowing the possible outcomes isn't enough.&lt;/p&gt;

&lt;p&gt;I also want to know&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Which outcomes are more likely?&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;For a coin,&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Heads → 50%

Tails → 50%
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;For a dice,&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;1 → 1/6
2 → 1/6
...
6 → 1/6
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This complete picture is called a &lt;strong&gt;Probability Distribution&lt;/strong&gt;.&lt;/p&gt;




&lt;h2&gt;
  
  
  What is a Probability Distribution?
&lt;/h2&gt;

&lt;p&gt;A probability distribution simply tells us&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Every possible outcome&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;and&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;The probability of that outcome.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Think of it like a menu.&lt;/p&gt;

&lt;p&gt;Instead of listing food prices,&lt;/p&gt;

&lt;p&gt;it lists outcomes and their probabilities.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Outcome&lt;/th&gt;
&lt;th&gt;Probability&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;td&gt;1/6&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;2&lt;/td&gt;
&lt;td&gt;1/6&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;3&lt;/td&gt;
&lt;td&gt;1/6&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;4&lt;/td&gt;
&lt;td&gt;1/6&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;5&lt;/td&gt;
&lt;td&gt;1/6&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;6&lt;/td&gt;
&lt;td&gt;1/6&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;That's it.&lt;/p&gt;

&lt;p&gt;Nothing magical.&lt;/p&gt;




&lt;h2&gt;
  
  
  But There Is a Problem...
&lt;/h2&gt;

&lt;p&gt;Imagine recording people's heights.&lt;/p&gt;

&lt;p&gt;Possible values could be&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;170.1 cm

170.11 cm

170.112 cm

170.1125 cm

170.11253 cm
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The list never ends.&lt;/p&gt;

&lt;p&gt;How can we make a table with infinitely many values?&lt;/p&gt;

&lt;p&gt;We can't.&lt;/p&gt;

&lt;p&gt;So statisticians asked a brilliant question.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;What if we use a mathematical function instead of a giant table?&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;That's exactly why &lt;strong&gt;Probability Distribution Functions&lt;/strong&gt; were created.&lt;/p&gt;




&lt;h2&gt;
  
  
  Famous Probability Distributions
&lt;/h2&gt;

&lt;p&gt;Some types of data appear again and again.&lt;/p&gt;

&lt;p&gt;Instead of creating new distributions every time,&lt;/p&gt;

&lt;p&gt;mathematicians created standard ones.&lt;/p&gt;

&lt;p&gt;Examples include&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Normal Distribution&lt;/li&gt;
&lt;li&gt;Bernoulli Distribution&lt;/li&gt;
&lt;li&gt;Binomial Distribution&lt;/li&gt;
&lt;li&gt;Poisson Distribution&lt;/li&gt;
&lt;li&gt;Exponential Distribution&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Whenever real-world data behaves similarly,&lt;/p&gt;

&lt;p&gt;we can use these existing distributions.&lt;/p&gt;




&lt;h2&gt;
  
  
  Why Are Probability Distributions Important?
&lt;/h2&gt;

&lt;p&gt;Once we know which distribution our data follows,&lt;/p&gt;

&lt;p&gt;we immediately know many things about it.&lt;/p&gt;

&lt;p&gt;For example,&lt;/p&gt;

&lt;p&gt;if exam marks approximately follow a Normal Distribution,&lt;/p&gt;

&lt;p&gt;we can estimate&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;average score&lt;/li&gt;
&lt;li&gt;spread&lt;/li&gt;
&lt;li&gt;unusual scores&lt;/li&gt;
&lt;li&gt;probabilities&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;without checking every student individually.&lt;/p&gt;

&lt;p&gt;This is why probability distributions are one of the foundations of statistics and machine learning.&lt;/p&gt;




&lt;h2&gt;
  
  
  Parameters — The Settings of a Distribution
&lt;/h2&gt;

&lt;p&gt;Think about making tea.&lt;/p&gt;

&lt;p&gt;The recipe changes depending on&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;sugar&lt;/li&gt;
&lt;li&gt;milk&lt;/li&gt;
&lt;li&gt;tea powder&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;These are settings.&lt;/p&gt;

&lt;p&gt;Probability distributions also have settings.&lt;/p&gt;

&lt;p&gt;These settings are called &lt;strong&gt;parameters&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Changing parameters changes the shape of the distribution.&lt;/p&gt;

&lt;p&gt;Just like changing sugar changes the taste of tea.&lt;/p&gt;




&lt;h2&gt;
  
  
  PMF — Probability Mass Function
&lt;/h2&gt;

&lt;p&gt;Now we enter our first probability function.&lt;/p&gt;

&lt;p&gt;PMF works only for &lt;strong&gt;Discrete Random Variables&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Discrete means&lt;/p&gt;

&lt;p&gt;you can count every possible value.&lt;/p&gt;

&lt;p&gt;Examples&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Dice&lt;/li&gt;
&lt;li&gt;Coin Toss&lt;/li&gt;
&lt;li&gt;Number of Students&lt;/li&gt;
&lt;li&gt;Number of Cars&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;PMF directly gives the probability of each value.&lt;/p&gt;

&lt;p&gt;Example&lt;/p&gt;

&lt;p&gt;Rolling a dice&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;P(1)=1/6

P(2)=1/6

...

P(6)=1/6
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Two important rules&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Every probability must be greater than or equal to 0.&lt;/li&gt;
&lt;li&gt;All probabilities together must add up to 1.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  CDF — Cumulative Distribution Function
&lt;/h2&gt;

&lt;p&gt;Sometimes we don't want&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;P(X = 3)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Instead we ask&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;What is the probability that X is less than or equal to 3?&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;That's exactly what CDF does.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;F(x)=P(X≤x)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Example&lt;/p&gt;

&lt;p&gt;For a dice,&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;P(X ≤ 3)

=

P(1)+P(2)+P(3)

=

3/6

=

0.5
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Notice something?&lt;/p&gt;

&lt;p&gt;CDF keeps adding probabilities as we move forward.&lt;/p&gt;

&lt;p&gt;That's why it's called &lt;strong&gt;Cumulative&lt;/strong&gt;.&lt;/p&gt;




&lt;h2&gt;
  
  
  Continuous Data Changes Everything
&lt;/h2&gt;

&lt;p&gt;Now imagine measuring&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Height&lt;/li&gt;
&lt;li&gt;Weight&lt;/li&gt;
&lt;li&gt;Temperature&lt;/li&gt;
&lt;li&gt;Salary&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;These values can have infinitely many decimals.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;170.1

170.11

170.111

170.1112
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Can we assign probability to one exact value?&lt;/p&gt;

&lt;p&gt;Not really.&lt;/p&gt;

&lt;p&gt;The probability of observing exactly&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;170.111111111...
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;is practically zero.&lt;/p&gt;

&lt;p&gt;So PMF no longer works.&lt;/p&gt;

&lt;p&gt;We need something new.&lt;/p&gt;




&lt;h2&gt;
  
  
  PDF — Probability Density Function
&lt;/h2&gt;

&lt;p&gt;Instead of probability,&lt;/p&gt;

&lt;p&gt;continuous variables use &lt;strong&gt;Density&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;At first this sounds strange.&lt;/p&gt;

&lt;p&gt;Why density?&lt;/p&gt;

&lt;p&gt;Imagine rain.&lt;/p&gt;

&lt;p&gt;One single drop doesn't tell us much.&lt;/p&gt;

&lt;p&gt;But if many drops fall in one area,&lt;/p&gt;

&lt;p&gt;we say&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Rainfall is dense here.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Similarly,&lt;/p&gt;

&lt;p&gt;PDF tells us&lt;/p&gt;

&lt;p&gt;where values are concentrated.&lt;/p&gt;

&lt;p&gt;Higher curve&lt;/p&gt;

&lt;p&gt;→ More observations likely to appear there.&lt;/p&gt;

&lt;p&gt;Lower curve&lt;/p&gt;

&lt;p&gt;→ Fewer observations.&lt;/p&gt;




&lt;h2&gt;
  
  
  Important Idea
&lt;/h2&gt;

&lt;p&gt;For continuous distributions,&lt;/p&gt;

&lt;p&gt;the height of the PDF curve is &lt;strong&gt;NOT&lt;/strong&gt; the probability.&lt;/p&gt;

&lt;p&gt;Instead,&lt;/p&gt;

&lt;p&gt;the &lt;strong&gt;area under the curve&lt;/strong&gt; represents probability.&lt;/p&gt;

&lt;p&gt;This is one of the biggest beginner mistakes.&lt;/p&gt;

&lt;p&gt;Always remember:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Area = Probability&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Not&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Height = Probability&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  Density Estimation — Finding the Shape of Data
&lt;/h2&gt;

&lt;p&gt;Suppose someone gives you 50,000 customer ages.&lt;/p&gt;

&lt;p&gt;You don't know which distribution they follow.&lt;/p&gt;

&lt;p&gt;Normal?&lt;/p&gt;

&lt;p&gt;Poisson?&lt;/p&gt;

&lt;p&gt;Something else?&lt;/p&gt;

&lt;p&gt;Instead of guessing,&lt;/p&gt;

&lt;p&gt;we estimate the underlying distribution.&lt;/p&gt;

&lt;p&gt;This process is called&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Density Estimation.&lt;/strong&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  Two Ways to Estimate Density
&lt;/h2&gt;

&lt;h2&gt;
  
  
  1. Parametric Density Estimation
&lt;/h2&gt;

&lt;p&gt;Here we assume&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;"I think my data follows a known distribution."&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;For example&lt;/p&gt;

&lt;p&gt;Normal Distribution.&lt;/p&gt;

&lt;p&gt;Then we estimate its parameters.&lt;/p&gt;

&lt;p&gt;This method is fast,&lt;/p&gt;

&lt;p&gt;but only works if our assumption is correct.&lt;/p&gt;




&lt;h2&gt;
  
  
  2. Non-Parametric Density Estimation
&lt;/h2&gt;

&lt;p&gt;Sometimes we don't know the distribution.&lt;/p&gt;

&lt;p&gt;Instead of forcing one,&lt;/p&gt;

&lt;p&gt;we let the data speak for itself.&lt;/p&gt;

&lt;p&gt;This is called&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Non-Parametric Density Estimation.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The most popular method is&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Kernel Density Estimation (KDE).&lt;/strong&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  Kernel Density Estimation (KDE)
&lt;/h2&gt;

&lt;p&gt;Imagine placing a tiny smooth hill on every data point.&lt;/p&gt;

&lt;p&gt;Now add all those hills together.&lt;/p&gt;

&lt;p&gt;The final smooth curve becomes an estimate of your probability density.&lt;/p&gt;

&lt;p&gt;Unlike histograms,&lt;/p&gt;

&lt;p&gt;KDE produces a smooth continuous curve,&lt;/p&gt;

&lt;p&gt;making it much easier to understand the distribution.&lt;/p&gt;




&lt;h2&gt;
  
  
  Where Do Data Analysts Use These Concepts?
&lt;/h2&gt;

&lt;p&gt;These ideas appear everywhere.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Understanding customer ages&lt;/li&gt;
&lt;li&gt;Salary analysis&lt;/li&gt;
&lt;li&gt;Fraud detection&lt;/li&gt;
&lt;li&gt;Anomaly detection&lt;/li&gt;
&lt;li&gt;Machine Learning&lt;/li&gt;
&lt;li&gt;Data Visualization&lt;/li&gt;
&lt;li&gt;Risk Analysis&lt;/li&gt;
&lt;li&gt;Forecasting&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Even if you don't calculate these formulas manually,&lt;/p&gt;

&lt;p&gt;libraries like NumPy, SciPy, Pandas, and Seaborn use these concepts behind the scenes.&lt;/p&gt;




&lt;h2&gt;
  
  
  Final Thoughts
&lt;/h2&gt;

&lt;p&gt;When I first learned probability distributions, I thought they were just another chapter in statistics.&lt;/p&gt;

&lt;p&gt;Now I see them differently.&lt;/p&gt;

&lt;p&gt;They're simply a language for describing uncertainty.&lt;/p&gt;

&lt;p&gt;Everything starts with one simple question:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;What can happen?&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Then another:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;How likely is each outcome?&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Every concept—Random Variables, PMF, PDF, CDF, and KDE—is just another tool to answer those two questions more effectively.&lt;/p&gt;

&lt;p&gt;Once you understand the &lt;em&gt;why&lt;/em&gt;, the formulas stop feeling difficult.&lt;/p&gt;




&lt;h2&gt;
  
  
  Key Takeaways
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Random Variables represent possible outcomes of an experiment.&lt;/li&gt;
&lt;li&gt;Probability Distributions assign probabilities to those outcomes.&lt;/li&gt;
&lt;li&gt;PMF is used for discrete data.&lt;/li&gt;
&lt;li&gt;PDF is used for continuous data.&lt;/li&gt;
&lt;li&gt;CDF gives cumulative probability.&lt;/li&gt;
&lt;li&gt;The area under a PDF curve represents probability.&lt;/li&gt;
&lt;li&gt;Density Estimation helps estimate the underlying distribution of data.&lt;/li&gt;
&lt;li&gt;KDE is a popular non-parametric density estimation technique.&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;If you're beginning your journey in Data Science or Machine Learning, mastering these concepts will make everything that comes later—hypothesis testing, regression, classification, and even deep learning—much easier to understand.&lt;br&gt;
If you didn't read the previous part, read it here: &lt;a href="https://dev.to/sami21234/part-2-statistics-2nib"&gt;PART 2&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Happy Learning! 🚀&lt;/p&gt;

</description>
      <category>datascience</category>
      <category>maths</category>
    </item>
    <item>
      <title>PART 2 - STATISTICS</title>
      <dc:creator>Sami</dc:creator>
      <pubDate>Mon, 06 Jul 2026 10:44:13 +0000</pubDate>
      <link>https://dev.to/sami21234/part-2-statistics-2nib</link>
      <guid>https://dev.to/sami21234/part-2-statistics-2nib</guid>
      <description>&lt;h2&gt;
  
  
  Why Do We Need Descriptive Statistics?
&lt;/h2&gt;

&lt;p&gt;Let’s say we have marks of 10 students:&lt;/p&gt;

&lt;p&gt;78, 82, 84, 88, 91, 93, 94, 96, 98, 99&lt;/p&gt;

&lt;p&gt;Now think:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Are students performing well?&lt;/li&gt;
&lt;li&gt;Is performance evenly spread?&lt;/li&gt;
&lt;li&gt;Are there extreme cases?&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Just staring at numbers doesn’t help much.&lt;/p&gt;

&lt;p&gt;👉 &lt;strong&gt;Descriptive statistics exists to summarize data and make it understandable.&lt;/strong&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  Thinking from First Principles: How Is Data Spread?
&lt;/h2&gt;

&lt;p&gt;Instead of complex formulas, let’s ask a simple question:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;How can I divide data into meaningful parts?&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;This brings us to &lt;strong&gt;Quantiles&lt;/strong&gt;.&lt;/p&gt;




&lt;h2&gt;
  
  
  Quantiles — Dividing Data Logically
&lt;/h2&gt;

&lt;p&gt;A &lt;strong&gt;quantile&lt;/strong&gt; divides data into &lt;strong&gt;equal-sized groups&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Think of slicing a cake 🍰 so everyone gets an equal piece.&lt;/p&gt;

&lt;h3&gt;
  
  
  Types of Quantiles
&lt;/h3&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Name&lt;/th&gt;
&lt;th&gt;What it does&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Quartiles&lt;/td&gt;
&lt;td&gt;Divide data into 4 equal parts&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Quintiles&lt;/td&gt;
&lt;td&gt;Divide data into 5 equal parts&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Deciles&lt;/td&gt;
&lt;td&gt;Divide data into 10 equal parts&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Percentiles&lt;/td&gt;
&lt;td&gt;Divide data into 100 equal parts&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;👉 Key idea:&lt;br&gt;&lt;br&gt;
All of these are just &lt;strong&gt;different ways of slicing the same data&lt;/strong&gt;.&lt;/p&gt;




&lt;h2&gt;
  
  
  Percentiles — The Most Important Quantile
&lt;/h2&gt;

&lt;p&gt;A &lt;strong&gt;percentile&lt;/strong&gt; tells us:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;What percentage of values fall &lt;strong&gt;below&lt;/strong&gt; a given value?&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Example:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;75th percentile → 75% of data lies below this value&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Step-by-Step Percentile Example
&lt;/h2&gt;

&lt;p&gt;Data (already sorted):&lt;/p&gt;

&lt;p&gt;78, 82, 84, 88, 91, 93, 94, 96, 98, 99&lt;/p&gt;

&lt;p&gt;Find the &lt;strong&gt;75th percentile&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 1: Find the position&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;PL = (p / 100) × N&lt;br&gt;&lt;br&gt;
PL = (75 / 100) × 10 = 7.5&lt;/p&gt;

&lt;p&gt;This means the value lies &lt;strong&gt;between the 7th and 8th observation&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;So we interpolate between:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;94 and 96&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Five Number Summary — One Look Overview
&lt;/h2&gt;

&lt;p&gt;Instead of remembering everything, what if we summarize data using just &lt;strong&gt;five numbers&lt;/strong&gt;?&lt;/p&gt;

&lt;h3&gt;
  
  
  The Five Numbers:
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;Minimum&lt;/li&gt;
&lt;li&gt;First Quartile (Q1)&lt;/li&gt;
&lt;li&gt;Median (Q2)&lt;/li&gt;
&lt;li&gt;Third Quartile (Q3)&lt;/li&gt;
&lt;li&gt;Maximum&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;This gives us:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Center&lt;/li&gt;
&lt;li&gt;Spread&lt;/li&gt;
&lt;li&gt;Range&lt;/li&gt;
&lt;li&gt;Shape (rough idea)&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Interquartile Range (IQR) — Ignoring Extremes
&lt;/h2&gt;

&lt;p&gt;Sometimes extreme values distort reality.&lt;/p&gt;

&lt;p&gt;So we focus on the &lt;strong&gt;middle 50%&lt;/strong&gt; of data.&lt;/p&gt;

&lt;p&gt;IQR = Q3 − Q1&lt;/p&gt;

&lt;p&gt;Used for:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Detecting outliers&lt;/li&gt;
&lt;li&gt;Understanding true variability&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Boxplot — Visualizing Distribution
&lt;/h2&gt;

&lt;p&gt;A &lt;strong&gt;boxplot&lt;/strong&gt; visually represents:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Minimum&lt;/li&gt;
&lt;li&gt;Q1&lt;/li&gt;
&lt;li&gt;Median&lt;/li&gt;
&lt;li&gt;Q3&lt;/li&gt;
&lt;li&gt;Maximum&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Why boxplots are powerful:
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Easy to compare datasets&lt;/li&gt;
&lt;li&gt;Shows skewness&lt;/li&gt;
&lt;li&gt;Identifies outliers quickly&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Scatterplots — Understanding Relationships
&lt;/h2&gt;

&lt;p&gt;So far, we looked at &lt;strong&gt;one variable&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Now let’s ask:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;How do two variables behave together?&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Examples:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Experience vs Salary&lt;/li&gt;
&lt;li&gt;Backlogs vs Package&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;A &lt;strong&gt;scatterplot&lt;/strong&gt; helps us see:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Positive trend&lt;/li&gt;
&lt;li&gt;Negative trend&lt;/li&gt;
&lt;li&gt;No pattern&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Covariance — Do Variables Move Together?
&lt;/h2&gt;

&lt;p&gt;Covariance answers one question:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;When X changes, does Y also change?&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  Interpretation:
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Positive covariance → Move in same direction&lt;/li&gt;
&lt;li&gt;Negative covariance → Move in opposite direction&lt;/li&gt;
&lt;li&gt;Zero → No linear relationship&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;⚠️ Problem:&lt;br&gt;&lt;br&gt;
Covariance shows &lt;strong&gt;direction&lt;/strong&gt;, not &lt;strong&gt;strength&lt;/strong&gt;.&lt;/p&gt;




&lt;h2&gt;
  
  
  Correlation — Strength + Direction
&lt;/h2&gt;

&lt;p&gt;Correlation improves covariance by standardizing values.&lt;/p&gt;

&lt;h3&gt;
  
  
  Correlation Range:
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;-1 → Perfect negative&lt;/li&gt;
&lt;li&gt;0 → No relationship&lt;/li&gt;
&lt;li&gt;+1 → Perfect positive&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This tells us:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Direction&lt;/li&gt;
&lt;li&gt;Strength&lt;/li&gt;
&lt;li&gt;Comparability&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Correlation ≠ Causation (Very Important)
&lt;/h2&gt;

&lt;p&gt;Just because two variables are related doesn’t mean one causes the other.&lt;/p&gt;

&lt;p&gt;Example:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;More firefighters → More damage
&lt;/li&gt;
&lt;li&gt;Real cause → Severity of fire &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Always ask:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Is there a hidden variable?&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  Final Thoughts
&lt;/h2&gt;

&lt;p&gt;Descriptive statistics is &lt;strong&gt;not about formulas&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;It’s about:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Summarizing data&lt;/li&gt;
&lt;li&gt;Understanding patterns&lt;/li&gt;
&lt;li&gt;Communicating insights clearly&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you understand &lt;strong&gt;why&lt;/strong&gt; a concept exists, the math becomes easy.&lt;/p&gt;




&lt;h2&gt;
  
  
  Key Takeaways
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Quantiles divide data logically&lt;/li&gt;
&lt;li&gt;Percentiles help comparison&lt;/li&gt;
&lt;li&gt;Five number summary gives a snapshot&lt;/li&gt;
&lt;li&gt;Boxplots visualize spread&lt;/li&gt;
&lt;li&gt;Scatterplots reveal relationships&lt;/li&gt;
&lt;li&gt;Covariance shows direction&lt;/li&gt;
&lt;li&gt;Correlation shows strength&lt;/li&gt;
&lt;li&gt;Correlation never implies causation&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;If you didn't read the previous part, read it here: &lt;a href="https://dev.to/sami21234/statistics-2c0e"&gt;PART 1&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If you found this helpful, feel free to share or connect.&lt;br&gt;&lt;br&gt;
Happy learning &lt;/p&gt;

</description>
      <category>statistics</category>
      <category>mathematics</category>
    </item>
    <item>
      <title>PART 1 - STATISTICS</title>
      <dc:creator>Sami</dc:creator>
      <pubDate>Tue, 30 Jun 2026 10:43:20 +0000</pubDate>
      <link>https://dev.to/sami21234/statistics-2c0e</link>
      <guid>https://dev.to/sami21234/statistics-2c0e</guid>
      <description>&lt;h2&gt;
  
  
  Descriptive Statistics Explained
&lt;/h2&gt;

&lt;p&gt;&lt;em&gt;My notes while learning Statistics for Data Science&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;When I first started learning Data Science, I thought statistics was just another boring mathematics subject with formulas to memorize.&lt;/p&gt;

&lt;p&gt;I was completely wrong.&lt;/p&gt;

&lt;p&gt;The more I learned, the more I realized that statistics is actually the language of data. Before building Machine Learning models, creating dashboards, or making predictions, we first need to understand what our data is trying to tell us.&lt;/p&gt;

&lt;p&gt;This blog is my attempt to explain the concepts in a simple way—the way I understood them while learning.&lt;/p&gt;




&lt;h2&gt;
  
  
  What is Statistics?
&lt;/h2&gt;

&lt;p&gt;Imagine a company has data of 10 million customers.&lt;/p&gt;

&lt;p&gt;Can a human sit and read every row?&lt;/p&gt;

&lt;p&gt;Obviously not.&lt;/p&gt;

&lt;p&gt;Statistics helps us summarize huge amounts of data into meaningful information so we can make decisions.&lt;/p&gt;

&lt;p&gt;Instead of reading every single record, statistics answers questions like:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;What is the average customer age?&lt;/li&gt;
&lt;li&gt;Which product sells the most?&lt;/li&gt;
&lt;li&gt;How much variation exists in customer spending?&lt;/li&gt;
&lt;li&gt;Are sales increasing or decreasing?&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In simple words,&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Statistics is the science of collecting, organizing, analyzing, and understanding data.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;This is exactly why statistics is used almost everywhere.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Netflix recommends movies using statistical patterns.&lt;/li&gt;
&lt;li&gt;Hospitals test whether a new medicine actually works.&lt;/li&gt;
&lt;li&gt;Companies forecast future sales.&lt;/li&gt;
&lt;li&gt;Governments conduct surveys before making policies.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Types of Statistics
&lt;/h2&gt;

&lt;p&gt;Statistics is mainly divided into two parts.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. Descriptive Statistics
&lt;/h2&gt;

&lt;p&gt;This is where every Data Analyst starts.&lt;/p&gt;

&lt;p&gt;Descriptive Statistics focuses on understanding the data we already have.&lt;/p&gt;

&lt;p&gt;It answers questions like:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;What is the average salary?&lt;/li&gt;
&lt;li&gt;Which category appears most?&lt;/li&gt;
&lt;li&gt;How spread out are the values?&lt;/li&gt;
&lt;li&gt;What does the data look like?&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;It does &lt;strong&gt;not&lt;/strong&gt; predict the future.&lt;/p&gt;

&lt;p&gt;It simply describes the present.&lt;/p&gt;

&lt;p&gt;Example:&lt;/p&gt;

&lt;p&gt;Suppose we have students' marks.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;78
82
91
67
75
88
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Using descriptive statistics, we can calculate:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Average marks&lt;/li&gt;
&lt;li&gt;Highest marks&lt;/li&gt;
&lt;li&gt;Lowest marks&lt;/li&gt;
&lt;li&gt;Most common marks&lt;/li&gt;
&lt;li&gt;Overall distribution&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  2. Inferential Statistics
&lt;/h2&gt;

&lt;p&gt;This goes one step ahead.&lt;/p&gt;

&lt;p&gt;Instead of describing existing data, it tries to make conclusions about a larger population using only a sample.&lt;/p&gt;

&lt;p&gt;For example,&lt;/p&gt;

&lt;p&gt;Imagine India has more than a billion people.&lt;/p&gt;

&lt;p&gt;Surveying every person isn't possible.&lt;/p&gt;

&lt;p&gt;Instead, researchers survey a small group and use statistics to estimate what the entire population might think.&lt;/p&gt;

&lt;p&gt;Machine Learning heavily depends on Inferential Statistics because models learn patterns from sample data and apply them to unseen data.&lt;/p&gt;




&lt;h2&gt;
  
  
  Population vs Sample
&lt;/h2&gt;

&lt;p&gt;This was one of the easiest concepts once I stopped overthinking it.&lt;/p&gt;

&lt;p&gt;Suppose a college has 12,000 students.&lt;/p&gt;

&lt;p&gt;The &lt;strong&gt;Population&lt;/strong&gt; is all 12,000 students.&lt;/p&gt;

&lt;p&gt;Now imagine we randomly choose 500 students for a survey.&lt;/p&gt;

&lt;p&gt;Those 500 students are called the &lt;strong&gt;Sample&lt;/strong&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Population
↓

12000 Students

↓

Take 500 Random Students

↓

Sample
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Since collecting data from everyone is expensive and time-consuming, most companies work with samples.&lt;/p&gt;

&lt;p&gt;The important part is choosing the sample correctly.&lt;/p&gt;

&lt;p&gt;A good sample should be:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Large enough&lt;/li&gt;
&lt;li&gt;Random&lt;/li&gt;
&lt;li&gt;Representative of the entire population&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Otherwise, the conclusions may be misleading.&lt;/p&gt;




&lt;h2&gt;
  
  
  Parameter vs Statistic
&lt;/h2&gt;

&lt;p&gt;This confused me initially because the words sound almost the same.&lt;/p&gt;

&lt;p&gt;Here's how I remember it.&lt;/p&gt;

&lt;p&gt;A &lt;strong&gt;Parameter&lt;/strong&gt; describes the entire population.&lt;/p&gt;

&lt;p&gt;A &lt;strong&gt;Statistic&lt;/strong&gt; describes only the sample.&lt;/p&gt;

&lt;p&gt;For example,&lt;/p&gt;

&lt;p&gt;Average salary of every employee in a company&lt;/p&gt;

&lt;p&gt;→ Parameter&lt;/p&gt;

&lt;p&gt;Average salary of 300 surveyed employees&lt;/p&gt;

&lt;p&gt;→ Statistic&lt;/p&gt;

&lt;p&gt;Simple.&lt;/p&gt;




&lt;h2&gt;
  
  
  Types of Data
&lt;/h2&gt;

&lt;p&gt;Before doing any analysis, we should understand what kind of data we're working with.&lt;/p&gt;

&lt;p&gt;Some data represents categories.&lt;/p&gt;

&lt;p&gt;Examples:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Gender&lt;/li&gt;
&lt;li&gt;Department&lt;/li&gt;
&lt;li&gt;City&lt;/li&gt;
&lt;li&gt;Blood Group&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Some data represents numbers.&lt;/p&gt;

&lt;p&gt;Examples:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Salary&lt;/li&gt;
&lt;li&gt;Height&lt;/li&gt;
&lt;li&gt;Weight&lt;/li&gt;
&lt;li&gt;Age&lt;/li&gt;
&lt;li&gt;Marks&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Knowing the data type helps us choose the right visualization and statistical method.&lt;/p&gt;




&lt;h2&gt;
  
  
  Measure of Central Tendency
&lt;/h2&gt;

&lt;p&gt;Suppose your friend asks,&lt;/p&gt;

&lt;p&gt;"Can you summarize this dataset in one number?"&lt;/p&gt;

&lt;p&gt;That's exactly what central tendency does.&lt;/p&gt;

&lt;p&gt;It finds the center of the data.&lt;/p&gt;

&lt;p&gt;There are different ways to define this center.&lt;/p&gt;




&lt;h2&gt;
  
  
  Mean (Average)
&lt;/h2&gt;

&lt;p&gt;The most commonly used measure.&lt;/p&gt;

&lt;p&gt;Formula:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Mean = Sum of all values / Number of values
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Example&lt;/p&gt;

&lt;p&gt;Marks:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;80 90 70 60 100
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Mean&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;(80+90+70+60+100)/5

=80
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Easy.&lt;/p&gt;

&lt;p&gt;But there's a problem.&lt;/p&gt;

&lt;p&gt;Mean is affected by extreme values.&lt;/p&gt;

&lt;p&gt;Suppose one billionaire enters a room of middle-class people.&lt;/p&gt;

&lt;p&gt;Suddenly the average wealth becomes enormous.&lt;/p&gt;

&lt;p&gt;That doesn't represent reality.&lt;/p&gt;




&lt;h2&gt;
  
  
  Median
&lt;/h2&gt;

&lt;p&gt;Median is the middle value after arranging the data.&lt;/p&gt;

&lt;p&gt;Example&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;10 20 25 30 90
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Median = 25&lt;/p&gt;

&lt;p&gt;Unlike the mean, median ignores extremely high or low values.&lt;/p&gt;

&lt;p&gt;That's why salaries, house prices, and income distributions often use the median instead of the average.&lt;/p&gt;




&lt;h2&gt;
  
  
  Mode
&lt;/h2&gt;

&lt;p&gt;Mode is simply the value that appears most frequently.&lt;/p&gt;

&lt;p&gt;Example&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;2 3 5 3 6 7 3
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Mode = 3&lt;/p&gt;

&lt;p&gt;This is useful when analyzing customer preferences.&lt;/p&gt;

&lt;p&gt;Example:&lt;/p&gt;

&lt;p&gt;Most purchased mobile brand.&lt;/p&gt;

&lt;p&gt;Most common payment method.&lt;/p&gt;

&lt;p&gt;Most selected course.&lt;/p&gt;




&lt;h2&gt;
  
  
  Weighted Mean
&lt;/h2&gt;

&lt;p&gt;Sometimes every value shouldn't have equal importance.&lt;/p&gt;

&lt;p&gt;Example:&lt;/p&gt;

&lt;p&gt;Your semester marks.&lt;/p&gt;

&lt;p&gt;Maybe:&lt;/p&gt;

&lt;p&gt;Assignments = 20%&lt;/p&gt;

&lt;p&gt;Mid Exam = 30%&lt;/p&gt;

&lt;p&gt;Final Exam = 50%&lt;/p&gt;

&lt;p&gt;Here we cannot simply calculate the average.&lt;/p&gt;

&lt;p&gt;Each score has a different weight.&lt;/p&gt;

&lt;p&gt;That's where Weighted Mean becomes useful.&lt;/p&gt;




&lt;h2&gt;
  
  
  Trimmed Mean
&lt;/h2&gt;

&lt;p&gt;Imagine a company accidentally records these salaries.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;25000
27000
26000
28000
30000
5000000
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That last value is an extreme outlier.&lt;/p&gt;

&lt;p&gt;Instead of letting one unusual value distort the average, we remove a small percentage of the highest and lowest values before calculating the mean.&lt;/p&gt;

&lt;p&gt;This gives a more reliable average.&lt;/p&gt;




&lt;h2&gt;
  
  
  Measure of Dispersion
&lt;/h2&gt;

&lt;p&gt;Knowing only the average isn't enough.&lt;/p&gt;

&lt;p&gt;Consider these two classes.&lt;/p&gt;

&lt;p&gt;Class A&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;50
50
50
50
50
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Class B&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;20
40
50
60
80
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Both have the same average.&lt;/p&gt;

&lt;p&gt;But clearly, Class B is much more spread out.&lt;/p&gt;

&lt;p&gt;Dispersion tells us how scattered the data is.&lt;/p&gt;




&lt;h2&gt;
  
  
  Range
&lt;/h2&gt;

&lt;p&gt;The simplest measure.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Range = Maximum - Minimum
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Example&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;10 20 30 50
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Range = 50 − 10 = 40&lt;/p&gt;

&lt;p&gt;Easy to calculate.&lt;/p&gt;

&lt;p&gt;But it depends only on two values, so it's very sensitive to outliers.&lt;/p&gt;




&lt;h2&gt;
  
  
  Variance
&lt;/h2&gt;

&lt;p&gt;Variance measures how far the values are from the average.&lt;/p&gt;

&lt;p&gt;Instead of looking only at the highest and lowest values, it considers every observation.&lt;/p&gt;

&lt;p&gt;Higher variance means the data is more spread out.&lt;/p&gt;

&lt;p&gt;Lower variance means the values stay close to the average.&lt;/p&gt;




&lt;h2&gt;
  
  
  Standard Deviation
&lt;/h2&gt;

&lt;p&gt;Standard deviation is simply the square root of variance.&lt;/p&gt;

&lt;p&gt;It is probably the most important measure of spread in statistics.&lt;/p&gt;

&lt;p&gt;A low standard deviation means the data points are tightly packed.&lt;/p&gt;

&lt;p&gt;A high standard deviation means the data is widely scattered.&lt;/p&gt;

&lt;p&gt;In Data Science, you'll see Standard Deviation almost everywhere—from feature engineering to anomaly detection and probability distributions.&lt;/p&gt;




&lt;h2&gt;
  
  
  Coefficient of Variation (CV)
&lt;/h2&gt;

&lt;p&gt;Imagine two datasets.&lt;/p&gt;

&lt;p&gt;Dataset A&lt;/p&gt;

&lt;p&gt;Average = 20&lt;/p&gt;

&lt;p&gt;Standard Deviation = 5&lt;/p&gt;

&lt;p&gt;Dataset B&lt;/p&gt;

&lt;p&gt;Average = 500&lt;/p&gt;

&lt;p&gt;Standard Deviation = 20&lt;/p&gt;

&lt;p&gt;Looking only at standard deviation isn't fair because the averages are completely different.&lt;/p&gt;

&lt;p&gt;Coefficient of Variation solves this by comparing variability relative to the mean.&lt;/p&gt;

&lt;p&gt;This makes it easier to compare datasets with different scales.&lt;/p&gt;




&lt;h2&gt;
  
  
  Visualizing Data
&lt;/h2&gt;

&lt;p&gt;Numbers alone don't always tell the whole story.&lt;/p&gt;

&lt;p&gt;Visualizations help us understand patterns much faster.&lt;/p&gt;

&lt;p&gt;Some commonly used graphs include:&lt;/p&gt;

&lt;h3&gt;
  
  
  Frequency Distribution Table
&lt;/h3&gt;

&lt;p&gt;Shows how many times each value appears.&lt;/p&gt;

&lt;p&gt;Useful for categorical data.&lt;/p&gt;




&lt;h3&gt;
  
  
  Histogram
&lt;/h3&gt;

&lt;p&gt;Used for numerical data.&lt;/p&gt;

&lt;p&gt;It helps us understand:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Distribution&lt;/li&gt;
&lt;li&gt;Skewness&lt;/li&gt;
&lt;li&gt;Peaks&lt;/li&gt;
&lt;li&gt;Outliers&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Whenever I open a new dataset, one of the first charts I create is a histogram.&lt;/p&gt;




&lt;h3&gt;
  
  
  Scatter Plot
&lt;/h3&gt;

&lt;p&gt;Scatter plots are useful when working with two numerical variables.&lt;/p&gt;

&lt;p&gt;For example,&lt;/p&gt;

&lt;p&gt;Hours Studied vs Marks&lt;/p&gt;

&lt;p&gt;Experience vs Salary&lt;/p&gt;

&lt;p&gt;Temperature vs Ice Cream Sales&lt;/p&gt;

&lt;p&gt;They help identify relationships and trends.&lt;/p&gt;




&lt;h3&gt;
  
  
  Contingency Table
&lt;/h3&gt;

&lt;p&gt;Used when comparing two categorical variables.&lt;/p&gt;

&lt;p&gt;Example:&lt;/p&gt;

&lt;p&gt;Gender vs Purchased Product&lt;/p&gt;

&lt;p&gt;Department vs Promotion Status&lt;/p&gt;

&lt;p&gt;It helps identify relationships between categories.&lt;/p&gt;




&lt;h2&gt;
  
  
  My Biggest Takeaway
&lt;/h2&gt;

&lt;p&gt;Earlier, I thought statistics was all about formulas.&lt;/p&gt;

&lt;p&gt;Now I see it differently.&lt;/p&gt;

&lt;p&gt;Statistics is simply a way of asking better questions about data.&lt;/p&gt;

&lt;p&gt;Instead of looking at thousands of rows, we summarize, visualize, compare, and understand what's happening.&lt;/p&gt;

&lt;p&gt;Every Machine Learning model, every dashboard, and every business decision starts with this understanding.&lt;/p&gt;

&lt;p&gt;Learning descriptive statistics has made me realize that before predicting the future with AI, we first need to understand the present through data.&lt;/p&gt;

&lt;p&gt;And that's exactly what statistics teaches us.&lt;/p&gt;




&lt;h2&gt;
  
  
  What's Next?
&lt;/h2&gt;

&lt;p&gt;In the next blog, I'll explore more about the Statistics, especially Inferential Statistics and explain it the same way—with simple examples, real-world intuition, and practical understanding instead of memorizing formulas.&lt;/p&gt;

&lt;p&gt;If you're also starting Data Science, I hope these notes make your learning a little easier.&lt;/p&gt;

</description>
      <category>beginners</category>
      <category>data</category>
      <category>datascience</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>Database Fundamentals</title>
      <dc:creator>Sami</dc:creator>
      <pubDate>Sat, 31 Jan 2026 11:16:19 +0000</pubDate>
      <link>https://dev.to/sami21234/database-fundamentals-36ka</link>
      <guid>https://dev.to/sami21234/database-fundamentals-36ka</guid>
      <description>&lt;h2&gt;
  
  
  📚 Database Fundamentals - Learning Notes
&lt;/h2&gt;

&lt;p&gt;Learn database basics in simple language that anyone can understand!&lt;/p&gt;




&lt;h2&gt;
  
  
  📖 What You'll Learn
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Why Data is Important&lt;/li&gt;
&lt;li&gt;What are Databases?&lt;/li&gt;
&lt;li&gt;What Makes a Good Database?&lt;/li&gt;
&lt;li&gt;Different Types of Databases&lt;/li&gt;
&lt;li&gt;Relational Databases Explained&lt;/li&gt;
&lt;li&gt;What is DBMS?&lt;/li&gt;
&lt;li&gt;What Does DBMS Do?&lt;/li&gt;
&lt;li&gt;Understanding Database Keys&lt;/li&gt;
&lt;li&gt;Relationships Between Data&lt;/li&gt;
&lt;li&gt;Problems with Databases&lt;/li&gt;
&lt;/ol&gt;




&lt;h2&gt;
  
  
  🎯 Why Data is Important
&lt;/h2&gt;

&lt;p&gt;Think of a database as a &lt;strong&gt;smart filing cabinet&lt;/strong&gt; that stores information in an organized way. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Simple Definition:&lt;/strong&gt; A database is a place where we keep related information together so everyone in a company can use it easily.&lt;/p&gt;

&lt;h3&gt;
  
  
  What Can You Do With Databases?
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Store Lots of Information&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
Instead of keeping information in many Excel files or paper documents, you can put everything in one place. You can then easily search and find what you need.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Analyze Your Data&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
You can ask questions like "How many customers bought products last month?" and get answers quickly. You can also create reports to understand your business better.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Keep Track of Records&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
Need to remember who paid you money? What items are in your store? Customer phone numbers? A database keeps all this safe and organized.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Run Websites and Apps&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
Every time you use Facebook, Amazon, or any app, there's a database working behind the scenes to show you the right information.&lt;/p&gt;




&lt;h2&gt;
  
  
  💾 What are Databases?
&lt;/h2&gt;

&lt;p&gt;Imagine you have a notebook where you write:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Names of your friends&lt;/li&gt;
&lt;li&gt;Their phone numbers&lt;/li&gt;
&lt;li&gt;Their birthdays&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;A &lt;strong&gt;database&lt;/strong&gt; is like that notebook, but on a computer. It's organized, you can search it super fast, and many people can use it at the same time.&lt;/p&gt;




&lt;h2&gt;
  
  
  ✨ What Makes a Good Database?
&lt;/h2&gt;

&lt;p&gt;A good database should have these 5 things:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. Integrity (Correctness)&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
The information should be accurate. If someone's age is 25, it shouldn't suddenly become 250!&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. Availability (Always Ready)&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
Whenever you need the data, it should be there. Like 24/7 customer support for your information.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. Security (Protected)&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
Only the right people should see the information. Your bank details shouldn't be visible to everyone!&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;4. Independent of Application (Flexible)&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
The database should work with any program. Like how a USB drive works with any computer.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;5. Concurrency (Multi-user)&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
Many people should be able to use it at the same time without problems. Like how many people can watch Netflix at once.&lt;/p&gt;




&lt;h2&gt;
  
  
  🗂️ Different Types of Databases
&lt;/h2&gt;

&lt;p&gt;Just like there are different types of vehicles (car, bike, truck) for different needs, there are different types of databases:&lt;/p&gt;

&lt;h3&gt;
  
  
  1. &lt;strong&gt;Relational Databases (SQL)&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;This is like an Excel spreadsheet with tables, rows, and columns. Most popular and widely used!&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt; MySQL, PostgreSQL, Oracle&lt;/p&gt;

&lt;h3&gt;
  
  
  2. &lt;strong&gt;NoSQL Databases&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Good for storing messy data like photos, videos, social media posts, documents.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt; MongoDB (used by companies like Uber, eBay)&lt;/p&gt;

&lt;h3&gt;
  
  
  3. &lt;strong&gt;Column Databases&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Instead of storing data row by row, it stores column by column. Great for analyzing huge amounts of data.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt; Google BigQuery, Amazon Redshift&lt;/p&gt;

&lt;h3&gt;
  
  
  4. &lt;strong&gt;Graph Databases&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Perfect for showing connections between things - like your friends on Facebook or recommendations on Netflix.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt; Neo4j, Amazon Neptune&lt;/p&gt;

&lt;h3&gt;
  
  
  5. &lt;strong&gt;Key-Value Databases&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Super simple - like a dictionary. You have a word (key) and its meaning (value).&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt; Redis, DynamoDB&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Which one to pick?&lt;/strong&gt; It depends on what you're building. For most beginner projects, start with Relational Databases!&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  🔄 Relational Databases Explained
&lt;/h2&gt;

&lt;p&gt;Think of a &lt;strong&gt;relational database&lt;/strong&gt; as multiple Excel sheets that are connected to each other.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt;  &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Sheet 1: Student names and their ID numbers&lt;/li&gt;
&lt;li&gt;Sheet 2: Class names and which students are in them&lt;/li&gt;
&lt;li&gt;These sheets are "related" because they both use student IDs&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;How it looks:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Tables&lt;/strong&gt; = Excel sheets&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Rows&lt;/strong&gt; = Each line of information (like one student)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Columns&lt;/strong&gt; = Types of information (like name, age, email)&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  🖥️ What is DBMS?
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;DBMS = Database Management System&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Think of it as the &lt;strong&gt;manager of your database&lt;/strong&gt;. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Simple Analogy:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Database = Library (where books are stored)&lt;/li&gt;
&lt;li&gt;DBMS = Librarian (who helps you find books, add new books, remove old books)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Popular DBMS software: MySQL, PostgreSQL, Oracle, Microsoft SQL Server&lt;/p&gt;




&lt;h2&gt;
  
  
  ⚙️ What Does DBMS Do?
&lt;/h2&gt;

&lt;p&gt;The DBMS is like a super assistant that does these jobs:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Data Management&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
Helps you save information, find it later, and change it when needed.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Keeps Data Accurate (Integrity)&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
Makes sure the information stays correct. Like preventing you from entering "ABC" as someone's age.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Multi-user Access (Concurrency)&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
Lets many people use the database at the same time without conflicts.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Transactions&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
Ensures that when you do something (like transferring money), it either completes fully or doesn't happen at all. No half-done work!&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Security&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
Only authorized people can see or change the data. Like having passwords for your email.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Useful Tools (Utilities)&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
Helps with backup (saving copies), importing/exporting data, and managing users.&lt;/p&gt;




&lt;h2&gt;
  
  
  🔑 Understanding Database Keys
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;What is a Key?&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
A key is like a &lt;strong&gt;unique ID&lt;/strong&gt; that helps identify each piece of information in your database.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Real-life example:&lt;/strong&gt; Your Aadhaar card number is unique to you. No one else has the same number.&lt;/p&gt;

&lt;h3&gt;
  
  
  Types of Keys (Simplified):
&lt;/h3&gt;

&lt;h4&gt;
  
  
  1. &lt;strong&gt;Super Key&lt;/strong&gt;
&lt;/h4&gt;

&lt;p&gt;Any combination of information that can uniquely identify a row.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt; In a student table, "Roll Number + Name" can identify a student.&lt;/p&gt;

&lt;h4&gt;
  
  
  2. &lt;strong&gt;Candidate Key&lt;/strong&gt;
&lt;/h4&gt;

&lt;p&gt;The smallest piece of information that can uniquely identify someone. No extra stuff needed.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt; Just "Roll Number" is enough. You don't need the name too.&lt;/p&gt;

&lt;h4&gt;
  
  
  3. &lt;strong&gt;Primary Key&lt;/strong&gt; ⭐ (Most Important!)
&lt;/h4&gt;

&lt;p&gt;The ONE key you choose to identify each row. It's the main ID.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt; Roll Number is the primary key for students.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Rules:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Must be unique (no duplicates)&lt;/li&gt;
&lt;li&gt;Cannot be empty (no null values)&lt;/li&gt;
&lt;li&gt;Only one primary key per table&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  4. &lt;strong&gt;Alternate Key&lt;/strong&gt;
&lt;/h4&gt;

&lt;p&gt;Other candidate keys that you didn't choose as the primary key.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt; Email could also be unique, but you chose Roll Number as primary.&lt;/p&gt;

&lt;h4&gt;
  
  
  5. &lt;strong&gt;Composite Key&lt;/strong&gt;
&lt;/h4&gt;

&lt;p&gt;When you need TWO or more columns together to uniquely identify a row.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt; "Class + Seat Number" together identify a student (because seat numbers repeat in different classes).&lt;/p&gt;

&lt;h4&gt;
  
  
  6. &lt;strong&gt;Surrogate Key&lt;/strong&gt;
&lt;/h4&gt;

&lt;p&gt;An artificial ID you create when there's no natural unique identifier.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt; Auto-generated customer ID: CUST001, CUST002, CUST003...&lt;/p&gt;

&lt;h4&gt;
  
  
  7. &lt;strong&gt;Foreign Key&lt;/strong&gt;
&lt;/h4&gt;

&lt;p&gt;A key from another table used to connect two tables together.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt; Student table has a "Branch_ID" that connects to the Branch table.&lt;/p&gt;

&lt;h3&gt;
  
  
  Example Table:
&lt;/h3&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Roll No ⭐&lt;/th&gt;
&lt;th&gt;Name&lt;/th&gt;
&lt;th&gt;Branch&lt;/th&gt;
&lt;th&gt;Email&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;td&gt;Ash&lt;/td&gt;
&lt;td&gt;CSE&lt;/td&gt;
&lt;td&gt;&lt;a href="mailto:ash@gmail.com"&gt;ash@gmail.com&lt;/a&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;2&lt;/td&gt;
&lt;td&gt;Brock&lt;/td&gt;
&lt;td&gt;EEE&lt;/td&gt;
&lt;td&gt;&lt;a href="mailto:brock@gmail.com"&gt;brock@gmail.com&lt;/a&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;3&lt;/td&gt;
&lt;td&gt;Tracy&lt;/td&gt;
&lt;td&gt;ME&lt;/td&gt;
&lt;td&gt;&lt;a href="mailto:tracy@gmail.com"&gt;tracy@gmail.com&lt;/a&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Here, &lt;strong&gt;Roll No&lt;/strong&gt; is the Primary Key!&lt;/p&gt;




&lt;h2&gt;
  
  
  🔗 Relationships Between Data
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Cardinality&lt;/strong&gt; sounds complex, but it just means: &lt;strong&gt;"How many?"&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;It tells us how many items in one table can connect to items in another table.&lt;/p&gt;

&lt;h3&gt;
  
  
  Easy Examples:
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;1. One Person → One Driving License&lt;/strong&gt; (One-to-One)&lt;br&gt;&lt;br&gt;
Each person has only one driving license, and each license belongs to only one person.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. Many Students → One Branch&lt;/strong&gt; (Many-to-One)&lt;br&gt;&lt;br&gt;
Many students can be in the CSE branch, but each student belongs to only one branch.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. One Restaurant → Many Orders&lt;/strong&gt; (One-to-Many)&lt;br&gt;&lt;br&gt;
One restaurant can have many orders, but each order comes from one restaurant.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;4. One Restaurant → One Menu&lt;/strong&gt; (One-to-One)&lt;br&gt;&lt;br&gt;
Each restaurant has one menu (in this simple case).&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;5. Many Students → Many Courses&lt;/strong&gt; (Many-to-Many)&lt;br&gt;&lt;br&gt;
Students can take multiple courses, and each course has multiple students.&lt;/p&gt;

&lt;h3&gt;
  
  
  Quick Summary:
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;One-to-One (1:1)&lt;/strong&gt; = Each person has exactly one passport&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;One-to-Many (1:N)&lt;/strong&gt; = One teacher teaches many students&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Many-to-One (N:1)&lt;/strong&gt; = Many employees work in one department&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Many-to-Many (M:N)&lt;/strong&gt; = Many students attend many classes&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  ⚠️ Problems with Databases
&lt;/h2&gt;

&lt;p&gt;Nothing is perfect! Here are some challenges with databases:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Complexity&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
Setting up a database is not easy. It takes time to learn and do it properly, especially for big systems.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Cost&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
You need to buy software, powerful computers, and hire people who know how to manage it. This can be expensive.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Scalability Issues&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
When your data grows too big, the database can become slow. Imagine a closet that's too full - hard to find things!&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Data Accuracy Problems&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
When many people update data at the same time, mistakes can happen. Like two people editing the same document simultaneously.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Security Risks&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
Hackers are always trying to steal data. You need to constantly protect your database from attacks.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Migration Headaches&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
Moving data from one database to another is like moving houses - difficult and time-consuming!&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Rigid Structure&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
Once you design your database, changing it later is hard. Like trying to add a room to a house after it's built.&lt;/p&gt;




&lt;h2&gt;
  
  
  💡 Quick Tips for Beginners
&lt;/h2&gt;

&lt;p&gt;✅ Start with relational databases (SQL) - they're the most common&lt;br&gt;&lt;br&gt;
✅ Practice with small projects - like a contact list or to-do app&lt;br&gt;&lt;br&gt;
✅ Learn SQL commands - they're like English sentences&lt;br&gt;&lt;br&gt;
✅ Don't worry about memorizing everything - understanding concepts is more important&lt;br&gt;&lt;br&gt;
✅ Use free databases like MySQL or PostgreSQL to practice  &lt;/p&gt;




&lt;h2&gt;
  
  
  🤝 Want to Contribute?
&lt;/h2&gt;

&lt;p&gt;Found a typo? Want to add more simple examples? Feel free to improve these notes!&lt;/p&gt;




&lt;h2&gt;
  
  
  📜 License
&lt;/h2&gt;

&lt;p&gt;These notes are free to use for learning. Share with friends!&lt;/p&gt;




&lt;h2&gt;
  
  
  🌟 Thank You
&lt;/h2&gt;

&lt;p&gt;These notes are from my learning journey. I hope they help you understand databases easily!&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Remember:&lt;/strong&gt; Everyone starts as a beginner. Take it one step at a time! 🚀&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;Questions? Confused about something? That's normal! Keep reading and practicing - it'll click! 💪&lt;/strong&gt;&lt;/p&gt;

</description>
      <category>database</category>
      <category>sql</category>
    </item>
    <item>
      <title>🌱 How I Started My Coding Journey in C (2022)</title>
      <dc:creator>Sami</dc:creator>
      <pubDate>Mon, 08 Sep 2025 16:01:09 +0000</pubDate>
      <link>https://dev.to/sami21234/how-i-started-my-coding-journey-in-c-2022-57e1</link>
      <guid>https://dev.to/sami21234/how-i-started-my-coding-journey-in-c-2022-57e1</guid>
      <description>&lt;p&gt;When I started my Engineering in Computer Science and Engineering (AIML) in 2022, I honestly had no idea about coding. Programming felt like a completely new world, and I wasn’t sure where to begin.&lt;/p&gt;

&lt;p&gt;Then came my very first programming language: C.&lt;/p&gt;




&lt;h2&gt;
  
  
  My First Experience with C
&lt;/h2&gt;

&lt;p&gt;The very first program I wrote was a simple one - printing numbers from 1 to 1000.&lt;/p&gt;

&lt;p&gt;It might sound small now, but at that moment it felt mind-blowing. The idea that I could give instructions to a machine and see it execute them instantly was something magical.&lt;/p&gt;

&lt;p&gt;That was the moment I realized:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;gt; “Computers can do in seconds what would take me hours - if only I learn how to talk to them.”
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  What C Taught Me
&lt;/h2&gt;

&lt;p&gt;Even though C was just the beginning, it gave me some valuable lessons:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Logic matters more than syntax.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Small programs can spark big curiosity.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Learning by doing is the best way to grow.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  The Curiosity Spark
&lt;/h2&gt;

&lt;p&gt;That one simple program changed my mindset. I went from:&lt;br&gt;
❌ “Coding looks too hard”&lt;br&gt;
✅ “What else can I make computers do?”&lt;/p&gt;

&lt;p&gt;This curiosity became the fuel for my entire journey ahead - from exploring websites, to JavaScript, React, and even AI/ML.&lt;/p&gt;




&lt;h2&gt;
  
  
  Closing Thoughts
&lt;/h2&gt;

&lt;p&gt;If you’re just starting out, don’t underestimate the power of small beginnings. Writing a basic program in C might feel simple, but it can ignite a journey that takes you much further than you imagine.&lt;/p&gt;

&lt;p&gt;For me, it all started in 2022, with a few lines of C code that printed numbers - and it completely changed how I look at technology.&lt;/p&gt;

</description>
      <category>beginners</category>
      <category>codenewbie</category>
      <category>coding</category>
      <category>learning</category>
    </item>
  </channel>
</rss>
