Module 8 · Sampling, Estimation, and Statistical Inference Lesson 76 of 120

Standard Error

Measuring uncertainty in a mean rather than variation among payments.

2:38 clip4:02:45–4:05:23 in the full courseWatch on YouTube

Transcript

19 sentences · select one to jump there

Check your understanding

Which is the larger number here: sample SD or mean SE?

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.

076-standard-error.ts
Start from GitHub
/**
 * Fintech Math Bootcamp · Lesson 076 of 120
 * Standard Error
 * Module 08: Sampling, Estimation, and Statistical Inference
 *
 * Scenario: Measuring uncertainty in a mean rather than variation among payments
 * Rule:     estimated SE(mean) = sample SD / √n
 *
 * Try it:   Which is the larger number here: sample SD or mean SE?
 *
 * Lesson article: https://thefintechbuilder.com/financial-mathematics-statistics-and-data-foundations/sampling-estimation-and-statistical-inference/standard-error/
 * Free course:    https://courses.thefintechbuilder.com
 * Synthetic teaching example, not financial advice or a production library.
 */

export function lesson076() {
  const x=[2,3,3,4,4];
  const mean=x.reduce((s,v)=>s+v,0)/x.length;
  const variance=x.reduce((s,v)=>s+(v-mean)**2,0)/(x.length-1);
  const result={mean,sd:Math.sqrt(variance),se:Math.sqrt(variance/x.length)};
  return result;
}

export const checkedResult = {"mean":3.2,"sd":0.8366600265340756,"se":0.3741657386773941};

// Run this file directly: npx tsx lessons/08-sampling-estimation-and-statistical-inference/076-standard-error.ts
if (process.argv[1] && import.meta.url.endsWith(process.argv[1].replace(/\\/g, "/").split("/").pop()!)) {
  console.log(JSON.stringify(lesson076(), null, 2));
}

Your output

Press Run to execute the code in your browser.

Expected output

{
  "mean": 3.2,
  "sd": 0.8366600265340756,
  "se": 0.3741657386773941
}

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

Lesson notes

The rule

estimated SE(mean) = sample SD / √n