Skip to content

Chapter 3 - calculating p-value #463

@dominikszyszko-bit

Description

@dominikszyszko-bit

There is an issue on chapter 03, in the following paragraph "Key Ideas", regarding calculation of p-value.

As for the confidence interval in this line of code:

def critical(se): return -se*stats.norm.ppf((1 - confidence)/2)

we say that confidence interval is for two-sided hypothesis. For a two-tailed test, the p-value is the probability of observing a test statistic as extreme as, or more extreme than, the one calculated, in either direction (positive or negative), assuming the null hypothesis is true; it's typically found by taking the one-tailed p-value (the area in one tail) and multiplying it by two, accounting for both tails of the distribution.

So the line

p_value = stats.norm.cdf(z_stats)

should become

p_value = stats.norm.cdf(z_stats) * 2

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions