AI summary by TwinMind
Logs (logarithms), Clearly Explained!!!
StatQuest with Josh Starmer
15m 37s
Introduction to Logarithms and Number Lines
- StatQuest educational video from UNC Chapel Hill Genetics Department
- Converting ordinary number line (0-8) to log base 2 scale
- Numbers 8, 4, 2, 1 easily rewritten as powers of 2
- Other numbers (7, 6, 5, π) can also be written as powers of 2, just less neat
Log Base 2 Calculation Process
- Core principle: Log function isolates the exponent
- Step-by-step examples:
- log₂(8) = log₂(2³) = 3
- log₂(4) = log₂(2²) = 2
- log₂(2) = log₂(2¹) = 1
- log₂(1) = log₂(2⁰) = 0
- Negative values:
- log₂(1/2) = log₂(2⁻¹) = -1
- log₂(1/4) = log₂(2⁻²) = -2
- log₂(1/8) = log₂(2⁻³) = -3
Log Scale Advantages for Fold Changes
- Symmetry problem on linear scale: 8x increase vs 8x decrease from baseline not equidistant
- Log scale solution: Equal magnitude changes equidistant from zero
- 8-fold up same distance from 0 as 8-fold down
- Key takeaway: Always use log axes for plotting fold changes
Log of Zero Issue
- No value exists for log₂(0)
- No exponent X where 2ˣ = 0
- Examples: 2⁻¹⁰⁰⁰ = 1/2¹⁰⁰⁰ (tiny but > 0)
- R programming language defines log₂(0) = -∞
- Intuitive: 1/2^∞ approaches smallest imaginable number (0)
qPCR Application Example
- Process: Each PCR cycle doubles products
- Baseline setup: First run = 1 transcript, log₂ equivalent = 0
- Results:
- Run 1: 1 transcript (baseline)
- Run 2: 2x transcripts (1 cycle difference)
- Run 3: 8x transcripts (3 cycle difference)
- Averaging comparison:
- Normal average: 3.7 transcripts
- Log average (geometric mean): 1.3 cycles → 2^1.3 = 2.5 transcripts
- Geometric mean advantages:
- Less affected by outliers
- More robust for exponential/doubling data
Arithmetic with Logs - Multiplication
- Normal multiplication: 2 × 4 = 8
- With powers of 2: 2¹ × 2² = 2³ (add exponents)
- Log property: log(x × y) = log(x) + log(y)
- Examples:
- log₂(2 × 4) = log₂(2) + log₂(4) = 1 + 2 = 3
- Works for non-power-of-2 numbers too
- Key principle: Multiplication becomes addition with logs
Arithmetic with Logs - Division
- Normal division: 2 ÷ 4 = 1/2
- With powers: 2¹ ÷ 2² = 2¹ × 2⁻² = 2⁻¹
- Log property: log(x ÷ y) = log(x) - log(y)
- Example: log₂(2 ÷ 4) = log₂(2) - log₂(4) = 1 - 2 = -1
- Key principle: Division becomes subtraction with logs
Universal Log Properties
- All log bases work the same way:
- Log base 10: useful for powers of 10 (decibels, earthquakes)
- Log base e (natural log): e ≈ 2.7, often programming default
- Log base 3: for data tripling each step
- Log base 7.5: for data increasing 7.5x each step
- Programming note: R uses log base e as default
- Flexibility: Choose base that makes sense for your data pattern
Key Takeaways Summary
- Logs isolate exponents (log₂(2³) = 3)
- Log scales ideal for fold change plotting (symmetric)
- Geometric mean (mean of logs) robust to outliers, good for exponential data
- Log multiplication = addition of exponents
- Log division = subtraction of exponents
- All log bases follow same principles
