Andrew Gurung
  • Introduction
  • Data Science
    • Natural Language Processing
      • Sentiment analysis using Twitter
    • Linear Algebra
      • Linear algebra explained in four pages
      • Vectors
        • Vector Basics
        • Vector Projection
        • Cosine Similarity
        • Vector Norms and Orthogonality
        • Linear combination and span
        • Linear independence and Basis vectors
      • Matrices
        • Matrix Arithmetic
        • Matrix Operations
        • Functions and Linear Transformations
        • Matrix types
      • Eigendecomposition, Eigenvectors and Eigenvalues
      • Principle Component Analysis (PCA)
      • Singular-Value Decomposition(SVD)
      • Linear Algebra: Deep Learning Book
    • Calculus
      • Functions, Limits, Continuity and Differentiability
      • Scalar Derivative and Partial Derivatives
      • Gradient
      • Matrix Calculus
      • Maxima and Minima using Derivatives
      • Gradient Descent and its types
    • Statistics and Probability
      • Probability Rules and Axioms
      • Types of Events
      • Frequentist vs Bayesian View
      • Random Variables
      • MLE, MAP, and Naive Bayes
      • Probability Distributions
      • P-Value and hypothesis test
    • 7 Step DS Process
      • 1: Business Requirement
      • 2: Data Acquisition
      • 3: Data Processing
        • SQL Techniques
        • Cleaning Text Data
      • 4: Data Exploration
      • 5: Modeling
      • 6: Model deployment
      • 7: Communication
    • Miscellaneous
      • LaTeX commands
  • Computer Science
    • Primer
      • Big O Notation
  • Life
    • Health
      • Minimalist Workout Routine
      • Reddit FAQ on Nootropics
      • Hiking/Biking Resources
    • Philosophy
      • Aristotle's Defense of Private Property
    • Self-improvement
      • 100 Mental Models
      • Don't break the chain
      • Cal Newport's 5 Productivity tips
      • Andrew Ng's advice on deliberate practice
      • Atomic Habits
      • Turn sound effects off in Outlook
    • Food and Travel
      • 2019 Guide to Pesticides in Produce
      • Recipe
        • Spicy Sesame Noodles
      • Travel
        • Hiking
    • Art
      • Scott Adams: 80% of the rules of good writing
      • Learn Blues Guitar
    • Tools
      • Software
        • Docker
        • Visual Studio Code
        • Terminal
        • Comparing Git Workflow
      • Life Hacks
        • DIY Deck Cleaner
  • Knowledge Vault
    • Book
      • The Almanack of Naval Ravikant
    • Media
    • Course/Training
Powered by GitBook
On this page
  • Discrete and Continuous Random Variables
  • Discrete variable
  • Continuous variable
  • Expectation and Variance
  • Expectation
  • Variance
  • Joint, Marginal, and Conditional Probabilities
  • Marginal probability
  • Condititional probability
  • Joint probability

Was this helpful?

  1. Data Science
  2. Statistics and Probability

Random Variables

Discrete and Continuous Random Variables

A variable is a quantity whose value changes. If the value is a numerical outcome of a random phenomenon, the variable is called random variable denoted by a capital letter.

Discrete variable

  • Variable whose value is obtained by counting

  • Has a countable number of possible values

  • Representation: Histogram

  • Example: number of students present, number of heads when flipping three coins

Continuous variable

  • Variable whose value is obtained by measuring

  • Takes all values in a given interval of numbers

  • Representation: Density Curve

  • The probability that X is between an interval of numbers is the area under the density curve between the interval endpoints

  • Examples: height of students in class, time it takes to get to school

Expectation and Variance

Expectation

What is the expected value when we roll a fair die?

  • There are six possible outcomes: 1, 2, 3, 4, 5, 6.

  • Each of these has a probability of 1/6 of occurring. Let X represent the outcome of the experiment.

  • Therefore P(1) = 1/6 (the probability that you throw a 1 is 1/6) P(2) = 1/6 P(3) = 1/6 P(4) = 1/6 P(5) = 1/6 P(6) = 1/6

    E(X) = 1×P(1) + 2×P(2) + 3×P(3) + 4×P(4) + 5×P(5) + 6×P(6) => 1/6 + 2/6 + 3/6 + 4/6 + 5/6 + 6/6 => 7/2 => 3.5

  • Expectation is 3.5

Variance

  • Describes the spread (amount of variability) around the expectation, written as Var(X)

Joint, Marginal, and Conditional Probabilities

Marginal probability

  • The probability of an event occurring

  • Example: the probability that a card drawn is red (p(red) = 0.5)

Condititional probability

  • The probability of event A occurring, given that event B occurs or is true

  • Example: Given that you drew a red card (26 cards), what’s the probability that it’s a four (2 cards). (P(four|red))=2/26=1/13

Joint probability

  • The probability of event A and event B occurring

  • Formula:

  • Example: the probability that a card is a four and red =p(four and red) = 2/52=1/26

PreviousFrequentist vs Bayesian ViewNextMLE, MAP, and Naive Bayes

Last updated 6 years ago

Was this helpful?

Describes the average value(mean) of X, written as E(X) or μ\muμ

E(X)=ΣxP(x)E(X) = \Sigma xP(x) E(X)=ΣxP(x) for discrete random variables

Var(X)=E[(X–μ)2]=E(X2)−μ2Var(X) = E[ (X – \mu )^2 ] = E(X^2) -\mu ^2 Var(X)=E[(X–μ)2]=E(X2)−μ2

μ:Expectation/mean\mu : Expectation/meanμ:Expectation/mean

E(X2):Σx2P(x)E(X^2): \Sigma x^2P(x) E(X2):Σx2P(x)

Note: Standard deviation σ\sigmaσ is the square root of variance

Formula: P(A)P(A)P(A)

Formula: P(A∣B)=P(A∩B)P(B)P(A|B)=\frac{P(A\cap B)}{P(B)}P(A∣B)=P(B)P(A∩B)​

Note: P(A∩B)P(A\cap B)P(A∩B) can be written as P(AB)P(AB)P(AB)

P(A∩B)=P(A∣B)P(B)P(A\cap B) = P(A|B) P(B)P(A∩B)=P(A∣B)P(B)

P(A∩B)=P(B∣A)P(A)P(A\cap B) = P(B|A) P(A)P(A∩B)=P(B∣A)P(A)

Links: - - - -

http://www.henry.k12.ga.us/ugh/apstat/chapternotes/7supplement.html
https://revisionmaths.com/advanced-level-maths-revision/statistics/expectation-and-variance
http://www.statisticalengineering.com/joint_marginal_conditional.htm
https://sites.nicholas.duke.edu/statsreview/jmc/