Module 12 · Statistical Computing and Reproducibility Lesson 120 of 120

Reproducible Analysis, Metadata, and Audit Trails

Making a result reproducible without confusing metadata with truth.

2:57 clip6:25:01–6:27:59 in the full courseWatch on YouTube

Transcript

17 sentences · select one to jump there

Check your understanding

Does a matching teaching checksum prove the financial analysis is correct?

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.

120-reproducible-analysis-metadata-and-audit-trails.ts
Start from GitHub
/**
 * Fintech Math Bootcamp · Lesson 120 of 120
 * Reproducible Analysis, Metadata, and Audit Trails
 * Module 12: Statistical Computing and Reproducibility
 *
 * Scenario: Making a result reproducible without confusing metadata with truth
 * Rule:     result + data identity + code version + parameters + information cutoff
 *
 * Try it:   Does a matching teaching checksum prove the financial analysis is correct?
 *
 * Lesson article: https://thefintechbuilder.com/financial-mathematics-statistics-and-data-foundations/statistical-computing-and-reproducibility/reproducible-analysis-metadata-and-audit-trails/
 * Free course:    https://courses.thefintechbuilder.com
 * Synthetic teaching example, not financial advice or a production library.
 */

export function lesson120() {
  const record={dataset:"synthetic-five-values",version:"course-1",
    unit:"hours",cutoff:"2026-01-01T00:00:00Z",method:"sample-variance"};
  const keys=["dataset","version","unit","cutoff","method"];
  const canonical=JSON.stringify(Object.fromEntries(Object.entries(record)
    .sort(([a],[b])=>a<b?-1:a>b?1:0))); // locale-independent key order
  let hash=2166136261;
  // Teaching FNV-1a over UTF-16 code units (equals byte-wise FNV-1a for ASCII input)
  for(let k=0;k<canonical.length;k++){hash=Math.imul(hash^canonical.charCodeAt(k),16777619)>>>0;}
  const result={complete:keys.every(k=>k in record),
    checksum:hash.toString(16).padStart(8,"0"),canonical};
  return result;
}

export const checkedResult = {"complete":true,"checksum":"391bbb44","canonical":"{\"cutoff\":\"2026-01-01T00:00:00Z\",\"dataset\":\"synthetic-five-values\",\"method\":\"sample-variance\",\"unit\":\"hours\",\"version\":\"course-1\"}"};

// Run this file directly: npx tsx lessons/12-statistical-computing-and-reproducibility/120-reproducible-analysis-metadata-and-audit-trails.ts
if (process.argv[1] && import.meta.url.endsWith(process.argv[1].replace(/\\/g, "/").split("/").pop()!)) {
  console.log(JSON.stringify(lesson120(), null, 2));
}

Your output

Press Run to execute the code in your browser.

Expected output

{
  "complete": true,
  "checksum": "391bbb44",
  "canonical": "{\"cutoff\":\"2026-01-01T00:00:00Z\",\"dataset\":\"synthetic-five-values\",\"method\":\"sample-variance\",\"unit\":\"hours\",\"version\":\"course-1\"}"
}

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

Lesson notes

The rule

result + data identity + code version + parameters + information cutoff