# How to calculate the p-value

I'm following a statistics course for the first time and I'm wondering how can I find the difference beteween two indepentent samples. I read the explanation but still couldn't understand how it works and I'm still stuck at finding the p-value. Here is the data:

$$\bar x_1=5.9$$ $$\bar x_2=4.1$$ $$\sigma_1=4.1$$ $$\sigma_2=3.7$$ $$n_1=42$$ $$n_2=47$$ And I want to test: $$H_0:\mu_1-\mu_2>0$$ $$H_a:\mu_1-\mu_2<0$$

Lets say at a 0.05 level. So I find SE: $$SE^2=\frac{\sigma_1^2}{n_1}+\frac{\sigma_2^2}{n_2}$$ This gives SE = 0.83 So I calculate my t stat: $$t=\frac{\bar x_1-\bar x_2}{SE}=2.16458$$

How can I calculate the p-value and what would it mean?

• You could also try to find the value of $t$ for $\alpha=0.05$ from a $t$ student table (or a normal table indeed $Z$ since your values are greater than 30), and it will be enough for testing. – Valerin Jan 31 at 3:27
• It's 2.012, but what does it mean? – Ruslan Tolstsikau Jan 31 at 3:31
• It means that the 95% of all good cases ($H_0$ not to be rejected) are less than $2.012$ (if this is ok, I need to check) so in this case since $t=2.1645 >2.012$ you should reject $H_0$ as the value is on the rejection zone. Which distribution Are you using? as this value of 2.012 doesn't seems to be ok – Valerin Jan 31 at 3:39
• So if t is greater than p, then I should reject $H_0$? – Ruslan Tolstsikau Jan 31 at 3:43
• Normal distribution – Ruslan Tolstsikau Jan 31 at 3:44

The notation $$\sigma_i$$ rather than $$s_i$$ suggests you are treating the standard deviations as known rather than as being estimated based on the data. Furthermore, the way you find your standard error makes sense only if that is what you are doing. That is not realistic but is often done in early exercises. Therefore you should treat your test statistic $$Z = (\overline x_1-\overline x_2)/\text{SE}$$ as being normally distributed rather than as having a t-distribution.
Suppose your null hypothesis is that the means of the two populations are equal and the alternative hypothesis says only that they are not equal, without saying which direction the inequality goes. Then the p-value is the probability that $$|Z|,$$ the absolute value of $$Z,$$ exceeds the value actually observed, given that the null hypothesis is true. So, for example, suppose you have $$|Z| = 2.3.$$ then you need $$\Pr(|Z|>2.3) = \Pr(Z>2.3) + \Pr(Z<-2.3) = 2\Pr(Z< -2.3).$$ Normally you would find that probability by using either a table or a software package.