# Confusion on statistical testing and confidence intervals

I am currently self-studying basic statistical testing (Z-testing and t-testing of at least approximately normally distributed one sample) and calculating confidence interval estimates for true population means. I've seen different approaches and formulas/notations and I just want to clarify/check my understanding.

I understand that the t-test should be used when the population standard deviation is unknown or when sample size $$n<30$$. Otherwise the Z-test can be used with reasonable accuracy due CLT or due SD simply being known.

Question 1: Regardless of the chosen test, is the formula used to calculate the Z or t-score always of form $$\dfrac{\bar{X}-\mu}{\sigma/\sqrt{n}}\text{ or } \dfrac{\bar{X}-\mu}{s/\sqrt{n}}$$ where $$\bar{X}$$ is the sample mean, $$\mu$$ the hypothesis mean, $$\sigma$$ the known population SD in the case of Z-test and $$s$$ the calculated sample SD from $$s=\sqrt{\dfrac{\sum_{i=1}^n(x_i-\bar{X})^2}{n-1}}$$ or must I always use the right hand side formula? Is it never possible to simply use only $$\sigma$$ in the denominator if it is known?

Question 2: Is the formula for the confidence interval always of the form $$\bar{X}\pm z^*\dfrac{s}{\sqrt{n}} \text{ or }\bar{X}\pm t^*\dfrac{s}{\sqrt{n}},$$ depending on which distribution is appropriate?

• (1) If $\sigma$ is known, why would you want to estimate. (2) Formulas given are appropriate for normal data. // Statement "I understand that the t-test should be used when the population standard deviation is unknown or when sample size n<30. " is a vast oversimplification. Strictly speaking, t procedures are only for normal data.. They may be reasonable approximations for nearly normal data. However, for example if data are exponential, Weibull, or Pareto, then $n=30$ is often nowhere near large enough to use t tests or t confidence intervals. Oct 25, 2021 at 22:10
• @BruceET Yes, I should've specified that all data is at least approximately normal as of yet. Thank you for clarification. Oct 26, 2021 at 13:06
The answer to your question lies in the fact that $$s$$ is an estimator. In other words, it is a function of the sample that attempts to "guess" the true value of $$\sigma$$. But if $$\sigma$$ is known, then it doesn't need to be estimated, and the resulting test statistic using $$\sigma$$ will have more power. The confidence interval will also be smaller for the same nominal coverage probability.
Note that you never use the margin of error $$z^* \frac{s}{\sqrt{n}}.$$ This is wrong. Either it is $$z^* \frac{\sigma}{\sqrt{n}}$$ or $$t^* \frac{s}{\sqrt{n}}$$ depending on whether $$\sigma$$ is known.