Two rather similar tests are available to us: the one-sample z-test and the one-sample t-test. You shall choose one of them, depending on a handful of factors such as, for example, the normality of the population, the number n of observations or whether the standard deviation of the population is a known factor. Note that there is a certain degree of flexibility when it comes to the choice of the test and we will also discuss it below.
In brief, one should use a z-test in cases where:
- the distribution is assumed to be normal,
- both population mean and population standard deviation are known,
- n, the number of individuals/observations is higher than 30 (moderate to large samples).
However, one should use a t-test in cases where:
- the distribution is assumed to be normal,
- the population mean is known, but population standard deviation is unknown,
- n, the number of individuals/observations is lower than 30 (small samples).
On top of that, you should know that such tests are performed when variable are continuous (or considered continuous) and the data are independent (meaning that the data are not related to each other in any way, or that each subject in the study gave no more than one sample data).
How flexible is this?
Well… this is a subjective topic. Here are some tips that could fit many cases:
- very often, you will be lacking the standard deviation of the population. In that case, opt for the t-test, regardless of the sample size n.
- normality appears to be a problem? Then, go for a t-test. This test appears to provide good results even if the distribution isn’t normal, providing that n is moderate to large, and that the distribution is somehow symmetrical (look at a histogram or a boxplot for example).
- the standard deviation of the population is unknown? Regardless of the other parameters (normality, sample size…), use a t-test. So, in a way, it seems like you would run a z-test only if you know the population standard deviation, the sample size is moderate to large (n > 30) and normality is assumed. For the rest, the t-test will save you.
So, in a way, it seems like you would run a z-test only if you know the population standard deviation, the sample size is moderate to large (n > 30) and normality is assumed. For the rest, the t-test will save you.