# When should I use one-sample t-test and when should I use t-test for two population means?

One of the exercises from my lecture gives us the number of the population (which are annual savings) and the population mean and standard deviation at time T. Then at time T + 1, a random sample is chosen from the population and the sample mean and sample standard deviation (which is the same as the population standard deviation at time A) are given. We are asked to test the substantial hypothesis that the annual savings have increased in time T+1, assuming a significance level of 1%.

The lecturer told us that we should use one-sample t-test for both cases (I currently cannot contact him). Why shouldn't we use t-test for two population means in this cases?

On the other hand, in another question in which every data in sample is listed out for us, we should use t-test for two population means despite the two sample standard deviations of the two samples from the two population in concern are not the same. The substantial hypothesis to be tested is: "Habitants in City A spends more money than in City B." In this question, a random sample of a fixed number of participants are selected in both cities and asked about the money they spent at where they live.

In another of the exercises, a random sample of people are selected to provide satisfaction index in time T and time T+1 respectively (i.e. the two sample (at the two different time point) are not independent). Every data in the sample is given. The hypothesis to be tested is: "The mean satisfaction of them has improved from T to T+1." One-sample t-test is used to test this hypothesis. Am I correct that t-test for two population means can not be used because the two samples are not independent of each other?

So how should we decide between using one-sample t-test and t-test for two population means?

This is our formula of t-statistic the t-test for two population means: $$t= \frac{\overline{x}-\overline{y}}{\sqrt{\frac{(n_1+n_2)[(n_1-1)s_1^{2}+(n_2-1)s_2^{2}]}{n_1\cdot n_2(n_1+n_2-2)}}}$$

$\overline{x}$ and $\overline{y}$: sample means

$n_1$ and $n_2$: sample size

$s_1$ and $s_2$: sample standard deviation

In the first case, you have been given the population mean at time $T$, and, as a consequence, you only have one sample - the time $T+1$ sample - which you are comparing to a known parameter value. So you use the one-sample t-test. If, instead of being given the population mean and standard deviation at time $T$, you had been given a sample from that population, you would have two samples, one from time $T$ and one from time $T+1$, and you would use the two-sample t-test.