# Comparing the means between two independent groups.

Assuming that we are dealing with a normal distribution.

I have two different groups and I want to compare the means between this two independent groups.

Group 1 has $\bar X_1 =2.60$, and I have calculated the Standard deviation from that sample which is $\sigma_1= 0.56$;

Group 2 has $\bar X_2 =1.30$, I have calculated the Standard deviation from the sample $\sigma_2= 1.02$;

The sample size for both are $n=12$.

a) Using parametric tests I need to know whether the mean is lower in the second group than in the first group. By $t$-distribution tables I need to know the approximate $p$-value for this.

b) Find $95\%$ CI for the difference in the mean the two groups.

My work:

a) I am not sure how to do that but I think I can use this formula:

\begin{align*} z&= \frac{\mu_1-\mu_2}{\sqrt{\sigma_1^2/n_1+\sigma_2^2/n_2}}\\ &= \frac{2.60-1.30}{\sqrt{\frac{0.56^2}{12}+\frac{1.02^2}{12}}}\\ &=3.9 \end{align*} and then $$P(z>3.9)=1-0.999952=0.0000048,$$ so the $p$-value is $0.0000048$. Because $p <0.001$ there is a strong difference between the two groups.

But I am not really sure.

b) I did:

formula: $$\mu_1-\mu_2 \pm(1.96)\sqrt{\frac{\sigma_1^2}{n_1}+\frac{\sigma_2^2}{n_2}}$$

$\mu_1-\mu_2=2.60-1.30=1.3$

$95\%$CI=$1.3 \pm(1.96)\sqrt{\frac{0.56^2+1.02^2}{12}} =$
$1.3\pm (0.65)\to$ that gives the interval $(0.65 ,1.96)$.
So, the confidence interval is $$95\% \text{ CI}=(0.65 ,1.96)$$

Can anyone let me know if I am doing it correctly?

• Standard notation is that $\mu_1$ and $\mu_2$ are the $population$ means and that $\sigma_1$ and $\sigma_2$ are the $population$ standard deviations. In that case the population mean is clearly lower in the second group than in the first because you have assumed that from the start. Is it possible that you mean to give values for $sample$ means $\bar X_1$ and $\bar X_2?$ Are the population SDs known or estimated by sample SDs. Please edit your question to clarify. – BruceET Feb 15 '16 at 21:33
• @BruceET Actually, ignore my previous. We will have to wait for OP to clarify. To OP, I changed the $SD$ to $\sigma$ and cleaned up the post to make it easier to read. Please address BruceET's comments. – Em. Feb 15 '16 at 22:08
• You are right, it was my mistake, I will edit the question, these values are the mean and Standard deviation of the sample and not from the whole population. – user290335 Feb 15 '16 at 23:11

In the current version of the question, we have sample sizes $n_1 = n_2 = 12,$ sample means $\bar X_1 = 2.60,\, \bar X_2 = 1.30,$ and $known$ population standard deviations $\sigma_1 = 0.56,\, \sigma_2 = 1.02.$

(a) This is an unlikely situation in practice, but perhaps a useful problem on the two-sample z-test. The z-statistic is $$Z = \frac{\bar X_1 - \bar X_2}{\sqrt{\sigma_1^2/n_1 + \sigma_2^2/n_2}} = \frac{1.03}{0.3359} = 3.87.$$ So your numerical computation for the statistic $Z$ is correct.

From what you say, you are testing $H_0: \mu_1 = \mu_2$ against the one-sided alternative $H_a: \mu_1 > \mu_2.$ At the 5% level, we reject $H_0$ in favor of $H_a$ if $Z > 1.645,$ where 1.645 cuts area 5% from the right hand tail of the standard normal curve.

The P-value is the probability $$P(Z > 3.87) = 1 - 0.9999456 = 0.0000544 = 5.441768 \times 10^{-05},$$ from software Within rounding error, this is the same as your result. This indicates that we could reject $H_0$ at a fixed significance level much smaller than 5%.

(b) You seem to want a 95% $two$-side confidence interval for the difference $\mu_1 - \mu_2$ in population means. That computation gives $1.3 \pm 1.96(0.3359)$ or $1.3 \pm 0.66.$ This is the interval $(0.64, 1.96).$ Again, this numerical result is in substantial agreement with your result (although your formula is incorrectly written in terms of population parameters).

[The number 1.96 from normal tables is used because 1.96 cuts probability 2.5% from the upper end of the standard normal distribution and -1.96 cuts 2.5% from the lower end, leaving 95% in the middle.]

$Note:$ Back to (a). In practice a more realistic problem would give sample means and sample standard deviations. (It is a rare practical situation in which population means are unknown, but population standard deviations are known.) Below is Minitab printout for this version of part (a). Estimating SDs would make this a two-sample t test. The version shown does not assume population variances to be equal. It is sometimes called the "separate-variances" or the "Welch" two-sample t test.

 MTB > TwoT 12 2.60 .58 12 1.30 1.02.

Two-Sample T-Test

Sample   N   Mean  StDev  SE Mean
1       12  2.600  0.580     0.17
2       12   1.30   1.02     0.29

Difference = mu (1) - mu (2)
Estimate for difference:  1.300

T-Test of difference = 0 (vs >):
T-Value = 3.84  P-Value = 0.001  DF = 17


[The 'equal variances' or 'pooled' version of the test would have the same T-value (owing to equal sample sizes), but then DF = 22 and a slightly different P-value.]

A Welch 95% CI from a related Minitab procedure is $(0.585, 2.015)$.

Very roughly speaking, the smaller P-value and the longer CI can be regarded as 'penalties' for the having to estimate $\sigma_1$ by the sample SD $S_1$ and $\sigma_2$ by the sample SD $S_2$.

• I was checking again and I found that for 2 independent small samples, as you said we can use two-sample t-test but we need to make 3 assumptions 1) the samples are random and independent,2)the population are normal and 3)the population variance are equal. They are all true except the 3) but again I saw that we can assume that $\sigma_1^2= \sigma_2^2$ the two variances of the sample can be pooled to form one estimated $Sp^2$ so because n1=n2 $, sp^2 = (s1^2+s^22) /2$ which is $\frac{0.56^2+1.02^2}{2}=0.677$ After that we need to perform a F test to check point 3)$\sigma_1^2=\sigma_2^2$ – user290335 Feb 16 '16 at 12:40
• where H0: $\sigma_1^2=\sigma_2^2$ and Ha: $\sigma_1^2>\sigma_2^2$ so $F=\frac{s1^2}{s2^2}=\frac{1.02^2}{0.56^2}=3.32~F(11,11)=2.81793047$ 'degrees of freedom' and I understood that because p is not greater than 0.05 as calculated before there is a significant difference from normal. To procedure with t-test we need to conclude that there is no evidence that the population variances are different. And I do not understand that part, how can I conclude that there is no evidence that the population variance are dif.Then I continued to use the previous formulas to find the 95%CI. Is this correct? – user290335 Feb 16 '16 at 12:41
• I also found that the confidence interval for $\mu1-\mu2$ is given by $\bar x_1 -\bar x_2\pm t. (sp\sqrt(\frac{1}{n1}+\frac{1}{n2}))=1.3.(2.0484).(0.276)=1.3\pm(0.565)=(0.735,1.865)$ but I am not sure.Because in my previous formula to solve b) I used $\mu1-\mu2$ instead of $\bar x_1-\bar x_2$ and I used the z*=1.96 and I am using t values because the sample is small and gave me another solution.So my question is: Can I use my first formula using $\mu1-\mu2$ if I estimate the population mean (standard error of the mean) using the fact that $\bar X=\frac{\sigma}{\sqrt(n)}$ – user290335 Feb 16 '16 at 13:35
• I did a mistake in my calculations in my previous comment because $sp=\sqrt(0.677)=0.823$ so using the formula it will give me $1.3 \pm (0.688) = (0.612,1.988)$ – user290335 Feb 16 '16 at 14:21
• I think the only place for a 'pooled' t test may be in an intro stat class. The Welch test is never worse and frequently better. For the Welch test there is a messy formula for DF. Result shown in Minitab output. No formula for final results should use unknown population parameters. You raise too many topics to discuss in comments. – BruceET Feb 16 '16 at 17:40