## p value of the test

p-value of the test is the probability that the test statistic under null hypothesis will take on values as extreme as or more extreme than the observed value of test statistic.

The smaller p-value of the test indicate strong evidence against the null hypothesis $H_0$.

In this tutorial we discuss about how to find the $p$-value of the t-test. The p-value of the $t$-test depends on the direction of the alternative hypothesis.

## $p$-Value of t-test

If the test statistic $t$ has $t$ distribution with $n-1$ degrees of freedom, then the $p$-value of the test for testing

a. left-tailed hypothesis is $p$-value = $P(t_{n-1}\leq t)$.

b. right-tailed hypothesis is $p$-value = $P(t_{n-1}\geq t)$.

c. two-tailed hypothesis is $p$-value = $2P(t_{n-1}\geq |t|)$.

### Interpretation from p-value

If the $p$-value of the test is less than or equal to the level of significance ($\alpha$) (i.e., $p \leq \alpha$), we reject the null hypothesis $H_0$ at $\alpha$ level of significance.

If the $p$-value of the test is greater than the level of significance ($\alpha$) (i.e., $p > \alpha$), we fail to reject the null hypothesis $H_0$ at $\alpha$ level of significance.

## Example 1

The one sample t-statistic for testing $H_0: \mu=453$ against $H_1:\mu< 453$ (left-tailed test) from a sample of $n=6$ observations has the value $-2.738$.

a. What is the degrees of freedom for $t$?

b. What is the $p$-value of the test?

c. Is the value of $t=-2.738$ is statistically significant at $\alpha=0.05$?

### Solution

The hypothesis testing problem is $H_0 : \mu = 453$ against $H_1 : \mu < 453$ ($\text{left-tailed}$).

a. The degrees if freedom for $t$ is $n-1= 6-1 =5$.

b. Because the alternative hypothesis is left-tailed, the $p$-value of the test is given by
`$$ \begin{aligned} p&=P(t_{n-1}\leq t)\\ &=P(t_{6-1}\leq -2.738)\\ &=P(t_{5}\leq -2.738)\\ &= 0.0204 \end{aligned} $$`

c. Because the p-value ($0.0204$) is $\text{less than}$ the significance level $\alpha = 0.05$, we $\text{reject}$ the null hypothesis at $0.05$ level of significance. The value of $t=-2.738$ is $\text{statistically significant}$ at $\alpha = 0.05$ level of significance.

## Example 2

Find the p-value for a right-tailed hypothesis test for a sample size with a test statistic of $t=2.571$ from a sample of $n=10$ observations. If the level of significance is $\alpha = 0.05$, decide whether to reject $H_0$.

### Solution

The sample size is $n = 10$. So the degrees of freedom is $df =9$.

The test statistic is $t_{obs} = 2.571$. The level of significance is $\alpha = 0.05$.

Because the alternative hypothesis is left-tailed, the $p$-value of the test is given by
`$$ \begin{aligned} p&=P(t_{n-1}\geq t)\\ &=P(t_{10-1}\geq 2.571)\\ &=P(t_{9}\geq 2.571)\\ &= 0.025 \end{aligned} $$`

Because the p-value of the test ($0.025$) is less than the level of significance ($\alpha= 0.05$), we reject the null hypothesis at $0.05$ level of significance.

## Example 3

Find the p-value for a two tailed hypothesis test for a sample size with a test statistic of $t=2.671$ from a sample of $n=10$ observations. If the level of significance is $\alpha = 0.05$, decide whether to reject $H_0$.

### Solution

The sample size is $n = 15$. So the degrees of freedom is $df =14$.

The test statistic is $t_{obs} = 2.671$. The level of significance is $\alpha = 0.05$.

Because the alternative hypothesis is left-tailed, the $p$-value of the test is given by
`$$ \begin{aligned} p&=2*P(t_{n-1}\geq |t|)\\ &=2*P(t_{15-1}\geq |2.671|)\\ &=2* 0.0091\\ &= 0.0182 \end{aligned} $$`

Because the p-value of the test ($0.0182$) is less than the level of significance ($\alpha= 0.05$), we reject the null hypothesis at $0.05$ level of significance.