Module 3 · Data, Variables, Samples, and Measurement Lesson 23 of 120

Population, Sample, Census, and Sampling Frame

A sample of approved loans cannot represent all applications.

2:34 clip1:13:44–1:16:18 in the full courseWatch on YouTube

Transcript

21 sentences · select one to jump there

Check your understanding

Can more sampling from the same incomplete frame recover E?

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.

023-population-sample-census-and-sampling-frame.ts
Start from GitHub
/**
 * Fintech Math Bootcamp · Lesson 023 of 120
 * Population, Sample, Census, and Sampling Frame
 * Module 03: Data, Variables, Samples, and Measurement
 *
 * Scenario: A sample of approved loans cannot represent all applications
 * Rule:     target population → sampling frame → observed sample
 *
 * Try it:   Can more sampling from the same incomplete frame recover E?
 *
 * Lesson article: https://thefintechbuilder.com/financial-mathematics-statistics-and-data-foundations/data-variables-samples-and-measurement/population-sample-census-and-sampling-frame/
 * Free course:    https://courses.thefintechbuilder.com
 * Synthetic teaching example, not financial advice or a production library.
 */

export function lesson023() {
  const population = ["A", "B", "C", "D", "E"];
  const frame = ["A", "B", "C", "D"];
  const sample = ["A", "C"];
  const result = {population: population.length,
    frame: frame.length, sample: sample.length,
    uncovered: population.filter(x => !frame.includes(x))};
  return result;
}

export const checkedResult = {"population":5,"frame":4,"sample":2,"uncovered":["E"]};

// Run this file directly: npx tsx lessons/03-data-variables-samples-and-measurement/023-population-sample-census-and-sampling-frame.ts
if (process.argv[1] && import.meta.url.endsWith(process.argv[1].replace(/\\/g, "/").split("/").pop()!)) {
  console.log(JSON.stringify(lesson023(), null, 2));
}

Your output

Press Run to execute the code in your browser.

Expected output

{
  "population": 5,
  "frame": 4,
  "sample": 2,
  "uncovered": [
    "E"
  ]
}

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

Lesson notes

The rule

target population → sampling frame → observed sample