-
-
Notifications
You must be signed in to change notification settings - Fork 588
Open
Description
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