When would you use a t-test vs. a z-test?
Technicaldata science and data analystData ScientistData AnalystStatisticianI would use a t-test when the sample size is small, typically less than 30, and when the population standard deviation is unknown. In contrast, I opt for a z-test when the sample size is larger and the population standard deviation is known. The key difference lies in the assumption of normality and the availability of population parameters.
For example, if I have a small sample from a normally distributed population, a t-test is more appropriate to avoid inaccuracies in estimating the mean.