Solved – how to calculate a p-value for a null hypothesis given a z-score

p-valueself-studyz-statistic

I'm new to statistics and would love help with the following:

Given an iid sample $X_1,…,X_{10}$ assume that $X_i\sim N(\mu,5)$.
using the one-sample test we got a z-score of $2.2$.

How do I calculate the p-value for the null hypothesis (1) $\mu=\mu_0$; (2) $\mu\leq \mu_0$ (3) $\mu\geq\mu_0$

Please elaborate on how to solve this. I'm new to the field 🙂

Best Answer

I'll outline an answer with a different example, rather than in terms of the specific details of this question.

A p-value ...

[...] is the probability of obtaining the observed sample results, or "more extreme" results, when the null hypothesis is actually true (where "more extreme" is dependent on the way the hypothesis is tested)

In your particular case, the more extreme cases are the ones more consistent with the alternative.

Let's say we have a sample mean of 5.347, and $\mu_0=2.5$

The z-statistic is $Z=\frac{\bar{x}-2.5}{5/\sqrt{10}}=1.8$

If the true population mean was 2.5 (i.e. the equality null), and we have the assumed normal distribution and the specified value for $\sigma$, then:

(a) the data should be normally distributed with mean $2.5$ and s.d. $5$ -- i.e. it should have this density:

enter image description here

(b) the sample mean should be normally distributed with mean $2.5$ and s.d. $5/\sqrt{10}$, so it should have this density:

enter image description here

(c) the standardized sample mean $Z=\frac{\bar{x}-2.5}{5/\sqrt{10}}$ should represent a single draw from a standard normal distribution:

enter image description here

(1) Under the equality null, $\mu=\mu_0$; , the alternative is values not equal to $\mu_0=2.5$ (values of the sample mean most suggestive of the alternative are values far from 2.5 in either direction). The probability of a result at least as extreme as the one observed (i.e. away from 2.5 in either direction) corresponds to values in this shaded region, and the probability is the shaded area:

enter image description here

As for how you compute this probability, the precise steps involved depend on what tables you have or what software you use.

(2) In the case of the one-sided null $\mu\leq \mu_0$, the alternative would be values greater than $\mu_0$, so the p-value is the area in the tail to the right of the observed statistic:

enter image description here

(3) In the case of the one-sided null $\mu\geq \mu_0$, the alternative would be values less than $\mu_0$, so the p-value is the area in the tail to the left of the observed statistic:

enter image description here

Here's a set of data consistent with the above sample mean if you want to start with some data:

 -0.075  4.476 -1.899  4.390  7.851  5.076  6.673  8.811  6.614 11.555

(This is the data depicted in the first plot)