In statistics, we often ask a simple question:
Is what we see in the data real, or could it just be random chance?
The p-value helps us answer this question.
In statistics, we often ask a simple question:
Is what we see in the data real, or could it just be random chance?
The p-value helps us answer this question.
We will begin with two statements:
\[ H_0: \mu = \mu_0 \]
\[ H_a: \mu \neq \mu_0 \]
To test the hypotheses, we compute:
\[ t = \frac{\bar{x} - \mu_0}{s / \sqrt{n}} \]
This value tells us
how far the sample mean is from the null value, measured in standard error units.
The p-value is:
\[ \text{Probability of seeing results this extreme if } H_0 \text{ is true} \]
We will generate sample data from a normal distribution.
The goal is to test
whether the population mean is equal to 50.
This plot shows:
It helps us see where the data values fall.
The shaded areas show the p-value.
They represent outcomes that are
as extreme or more extreme than our data, assuming the null hypothesis is true.
R can calculate the p-value directly
using a one-sample t-test.
## ## One Sample t-test ## ## data: data ## t = 3.1361, df = 39, p-value = 0.00325 ## alternative hypothesis: true mean is not equal to 50 ## 95 percent confidence interval: ## 50.79029 53.66154 ## sample estimates: ## mean of x ## 52.22592
This plot shows how the p-value changes as the sample mean moves away from the null value and as the sample size increases. Smaller p-values mean stronger evidence against the null hypothesis.
Context always matters.