# I need help on choosing the correct t test for my data, I am debating whether to use a one sample, independent samples, or both. Please help?

I have two sample sizes of data from a survey (one has 41 replies and the other 12) and I am comparing the mean results (i.e. mean of the 41 sample size to a mean of 60 and the mean of the 12 sample size also to a mean of 60) to a mean of 60. The two surveys administered (hence two different sample sizes) were in two different languages. I want to compare the respective means of the sample sizes to the mean of 60 so this would involve a one sample t test. My question is, would I do two different one sample t tests or do I do only do one one sample t test using a total of 52 responses and comparing it to the mean of 60?

My data is normally distributed, randomly chosen and the data is continuous.

And is it okay to also do an independent samples t test after running a one samples t test to see for significant differences between the two groups?

I am using SPSS. [See results in Comments.]

• What is the question you are asking of your data, if the two means are equal?
– Dave
Commented Jul 20, 2021 at 23:53
• Hi Dave, my question is if with my data, if I can do a one sample t test twice (once with the sample size of 41 and another time with the sample size of 12) or if I should do it as one entire sample? Essentially, I am comparing the results of my survey to the mean of 60. And if I do the one sample t test, could I use the same data to do an independent samples t test to compare the means of both sample sizes to each other. Commented Jul 20, 2021 at 23:56

Suppose you have a random sample of size $$n_1 = 41$$ from a normal population $$\mathsf{Norm}(\mu_1,\sigma_1),$$ with $$\mu_1$$ and $$\sigma_1$$ both unknown. You want to test $$H_0: \mu=60$$ against $$H_a: \mu \ne 60$$ at the 5% level of significance.

Suppose your $$n_1 = 41$$ observations are the fictitious ones below (sampled in R).

set.seed(2021)
x1 = rnorm(41, 65, 10)
summary(x1);  length(x1);  sd(x1)
Min. 1st Qu.  Median    Mean 3rd Qu.    Max.
45.36   53.99   65.14   64.11   73.98   82.30
[1] 41        # sample size
[1] 11.28525  # sample SD


In R, a one-sample t test using these data gives the following output. The relevant quantities used to compute the t statistic are the sample mean $$\bar X_1 = 64.11,$$ sample SD $$S_1 = 11.285,$$ and sample size $$n_1 = 41:$$ Thus $$T = \frac{\bar X_1 -\mu_1}{S_1/\sqrt{n_1}} = 36.373.$$ Also $$DF = \nu_1 = n_1 -1 = 40.$$ The computation (perhaps except for rounding conventions) is the same in R. Other parts of the output may differ slightly between R and SPSS, but you should be able to follow either one.

t.test(x1)

One Sample t-test

data:  x1
t = 36.373, df = 40, p-value < 2.2e-16
alternative hypothesis:
true mean is not equal to 0
95 percent confidence interval:
60.54305 67.66717
sample estimates:
mean of x
64.10511


Because the P-value is near $$0 \le 0.05 = 5\%$$ you ould reject $$H_0$$ at the 5% level of significance (for my fictitious data). Of course your real data may give a different result.

You could do a similar one-sample t test to test whether your second sample x2 came from a normal distribution with mean $$\mu_2 = 60.$$

It doesn't seem to me that you have directly answered @Dave's question about what your really want to know from your data, merely repeating what you said in your question. For what purpose were the data collected?

If you really want to know whether each of the samples is consistent with sampling from a normal population with mean $$60,$$ then you would be done at this point.

If you really want to know whether the two samples x1 and x2 are from normal populations with the same mean (whether that is 60 or not), then you need to do a two-sample t test. Because it seems unlikely you would know whether both normal populations have the same variance, I recommend the Welch two-sample t test, which does not assume that the variances are equal. You can find details of the Welch two-sample t test in your text, elsewhere on this site, or in numerous pages online.

For a fictitious sample x2 of size $$n_2 = 12.,$$ the output for a a Welch two-sample t test in R is as shown below:

x2 = rnorm(12, 60, 12)
summary(x2);  length(x2);  sd(x2)
Min. 1st Qu.  Median    Mean 3rd Qu.    Max.
32.93   53.32   60.06   61.75   70.65   85.44
[1] 12
[1] 14.78855

stripchart(list(x1,x2), ylim=c(.5,2.5), pch="|")


The quantities needed to find the t statistic for the Welch 2-sample t test are $$\bar X_1, S_1, n_1$$ and $$\bar X_2, S_2, n_2.$$ For the degrees of freedom, you need the sample sizes and the sample standard deviations.

t.test(x1, x2)

Welch Two Sample t-test

data:  x1 and x2
t = 0.50982, df = 14.95, p-value = 0.6176
alternative hypothesis:
true difference in means is not equal to 0
95 percent confidence interval:
-7.492507 12.201830
sample estimates:
mean of x mean of y
64.10511  61.75045


Even though the two sample means $$\bar X_1$$ and $$\bar X_2$$ do differ, they are not enough different in view of the variability of the two samples, to say that the difference is statistically significant at the 5% level (because the P-value exceeds 5%). (Again here, you might get a different result from your actual data.)

If you did the two-sample test first, found no significant difference, but still wondered if either sample is consistent with a normal distribution with mean 60, you could then do the two one-sample tests. Strictly speaking you should do each of these two tests at the 2.5% level (according to the Bonferroni method of avoiding 'false discovery' by repeated analysis of the same data). [Also, if you do the two one-sample tests first, and then decide to do the two-sample test later (with the same data), it should be at level 2.5%.]

• Hi BruceET, thanks for your response. I now understand what I want with my data and I wanted to compare my respective sample means to the established mean of 60. Following that I wanted to compare the two sample means to see if they were statistically different from one another. As per SPSS, my data for one sample t test they are statistically different from the mean of 60 but independent samples t test says the sample means are not statistically different from each other. Commented Jul 23, 2021 at 0:15