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

P-Values, Significance, Type I/II Errors, and Power

Preventing p-values from becoming certainty scores.

2:36 clip4:10:40–4:13:17 in the full courseWatch on YouTube

Transcript

19 sentences · select one to jump there

Check your understanding

Can you calculate power for every possible effect from p=.04 alone?

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.

079-p-values-significance-type-i-ii-errors-and-power.ts
Start from GitHub
/**
 * Fintech Math Bootcamp · Lesson 079 of 120
 * P-Values, Significance, Type I/II Errors, and Power
 * Module 08: Sampling, Estimation, and Statistical Inference
 *
 * Scenario: Preventing p-values from becoming certainty scores
 * Rule:     p-value: tail probability under H₀; power=1−β under a specified alternative
 *
 * Try it:   Can you calculate power for every possible effect from p=.04 alone?
 *
 * Lesson article: https://thefintechbuilder.com/financial-mathematics-statistics-and-data-foundations/sampling-estimation-and-statistical-inference/p-values-significance-type-i-ii-errors-and-power/
 * Free course:    https://courses.thefintechbuilder.com
 * Synthetic teaching example, not financial advice or a production library.
 */

export function lesson079() {
  const pValue=.04,alpha=.05;
  const result={reject:pValue<alpha,typeIReference:alpha,
    powerAtSpecifiedAlternative:1-.20};
  return result;
}

export const checkedResult = {"reject":true,"typeIReference":0.05,"powerAtSpecifiedAlternative":0.8};

// Run this file directly: npx tsx lessons/08-sampling-estimation-and-statistical-inference/079-p-values-significance-type-i-ii-errors-and-power.ts
if (process.argv[1] && import.meta.url.endsWith(process.argv[1].replace(/\\/g, "/").split("/").pop()!)) {
  console.log(JSON.stringify(lesson079(), null, 2));
}

Your output

Press Run to execute the code in your browser.

Expected output

{
  "reject": true,
  "typeIReference": 0.05,
  "powerAtSpecifiedAlternative": 0.8
}

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

Lesson notes

The rule

p-value: tail probability under H₀; power=1−β under a specified alternative