How to calculate p-values
Why Cross Validated Stack Exchange recommends it
Cross Validated users link it when someone is confused about how a p-value is calculated, especially the rule of counting the observed outcome plus equally rare and rarer outcomes.
Recommended by 1 people across 1 different months, 2021 to 2022.
What it is
A StatQuest video by Josh Starmer on how p-values are actually computed, first for discrete data such as coin tosses and then for continuous data such as heights. It shows that a p-value is the sum of the probability of the observed result, equally rare results, and rarer results. It closes with one-sided versus two-sided p-values and why to avoid one-sided ones.
What people said
Strong rec Mariusz · 2022-06 · Cross Validated Stack Exchange · on “Is my understanding of the p-value correct?”
Please check that video from StatQuest: \ How to calculate p-values [this video] . \ It is wonderful explanation of p-values.
Cites mon · 2021-09 · Cross Validated Stack Exchange · on “p-value calculation method”
Background Trying to understand the way to calculate the p-value . Please exclude hypothesis testing here because in my understanding, hypothesis testing as one p-value use case is a different topic from calculating p-value itself. I believe mixing them making things complicated unnecessarily. Suppose there is a Hard Disk Drive (HDD) type 0 called $H_0$ . The MTTF (Mean Time to Failure) data has been collected and its mean $\mu=2.97$ and $\sigma=1.54$ .. H0 = np.array([1] * 10000 + [2] * 25000 + [3] * 4000 + [4] * 3000 + [5] * 20000) np.random.shuffle(H0) u = np.mean(H0) sd = np.std(H0) print(f"mean {u:.2f} std {sd:.2f}") --- mean 2.97 std 1.54 [LINK] Then, run random sampling (sample size 1
Cites william007 · 2022-05 · Cross Validated Stack Exchange · on “p-value calculation for coin flipping”
Here [this video] it mentioned we need to take into consideration of rare and rarer event (up to 12:28) for p-value calculation. There is a problem: You observed 3 sequences of 5 flips of coin with at least one sequence was all heads. The hypothesis to test is - whether the coin is bias. (The null hypothesis is the fair is not bias) The probability calculation would be 3 sequences of 5 flips of coin with at least one sequence was all heads = prob of at least one sequence in 3 sequence was all heads = 1- prob of no all heads in 3 sequence = 1- (no all heads in 1 sequence)^3 = 1 - (1-all heads in 1 sequence)^3 = 1 - (1-(1/2)^5)^3 = 0.09 But what is the p-value?