Module 5 · Dispersion, Shape, and Robust Statistics Lesson 49 of 120

Skewness and Tail Asymmetry

Recognizing the direction of a service-delay tail.

2:41 clip2:32:45–2:35:27 in the full courseWatch on YouTube

Transcript

19 sentences · select one to jump there

Check your understanding

Does positive skewness imply that most values are above their mean?

Choose one answer

Code lab

Run it yourself

The lesson source in 7 languages. Edit it, run TypeScript and Python right here, and compare with the expected output.

049-skewness-and-tail-asymmetry.ts
Start from GitHub
/**
 * Fintech Math Bootcamp · Lesson 049 of 120
 * Skewness and Tail Asymmetry
 * Module 05: Dispersion, Shape, and Robust Statistics
 *
 * Scenario: Recognizing the direction of a service-delay tail
 * Rule:     moment skewness = m₃ / m₂^(3/2)
 *
 * Try it:   Does positive skewness imply that most values are above their mean?
 *
 * Lesson article: https://thefintechbuilder.com/financial-mathematics-statistics-and-data-foundations/dispersion-shape-and-robust-statistics/skewness-and-tail-asymmetry/
 * Free course:    https://courses.thefintechbuilder.com
 * Synthetic teaching example, not financial advice or a production library.
 */

export function lesson049() {
  const x = [1,2,2,4,9];
  const mean = x.reduce((a,b)=>a+b,0)/x.length;
  const m = (k:number) => x.reduce((s,v)=>s+(v-mean)**k,0)/x.length;
  const result = m(3) / m(2)**1.5;
  return result;
}

export const checkedResult = 1.1140963830468877;

// Run this file directly: npx tsx lessons/05-dispersion-shape-and-robust-statistics/049-skewness-and-tail-asymmetry.ts
if (process.argv[1] && import.meta.url.endsWith(process.argv[1].replace(/\\/g, "/").split("/").pop()!)) {
  console.log(JSON.stringify(lesson049(), null, 2));
}

Your output

Press Run to execute the code in your browser.

Expected output

1.1140963830468877

Prefer your own machine? Every file is in the course repository · open it in Codespaces.

Lesson notes

The rule

moment skewness = m₃ / m₂^(3/2)