# test statistics needed for data to be normalised

I understand from one of the post that t-test is preferred over z-test. Based on this assumption can anyone help me answer the below queries

1. will t-test works better than z-test when we take sample size >=30, if not what should be ideal sample size to be taken.
2. Do we need to carry out hypothesis tests before carrying out prediction like regression - to ensure that samples taken are coming from the same population. If not, when these tests are carried out.
3. Regression requires normality of the residuals. If the residuals are not normally distributed , do we take one more sample until residuals attain normality? Are they any other pre-requisites for regression.
4. Do we go with Box and whisker plot only to identify outliers.If they are outliers are we going with median and if they are no outliers we go with mean? If not, do we have any other measure
5. For z-test, we plot Histogram to check if the plot is normally distributed or not. Similarly do we have any plot that we can visualize for t-test. If yes, what do we need to look into the plot to make inferences

First of all: I assume you are asking about testing population mean with z-test or t-test.

Second: t-test is not 'preferred' over z-test. For z-test one have to know the population variance, for t-test it is not needed. So with know population variance you can use z-test, otherwise t-test (if all the other assumptions are met: random sample, normality of the sample mean).

1. No, it won't work better or worse. As sample size increased, Student's t distribution converges to normal distribution. That is why it is said for big samples you can use z-test instead of t-test even if the population variance unknown. By big sample someone means $$n > 30$$, someone means $$n > 100$$. But this is just rule of the thumb for calculations carried out on paper (more detailed tables are available for standard normal distribution, easier to use). Nowdays it doesn't matter with a computer.

2. Yes, linear regression have some assumptions (iid observations, exogeneity, homoscedasticity, normality, no multicollinearity, etc.), you have check them prior fitting the model.

3. Methods for dealing with non-normality: data transformation, reverse data transformation, applying rank based non-parametric methods, bootstrapping, trimming, winzorize, etc. Other pre-requsities: see point 2.

4. No, you do not use median or mean for outliers, that is a simple way to deal with missing values, not outliers. A simple way to handle outliers is to skip them, although it is not the best practice. Another common way to deal with them is winsorization.

And yes, there are other measures for outliers: e.g. Grubbs' Test, Tietjen-Moore Test, Generalized Extreme Studentized Deviate (ESD) Test, etc.

5. As both z-test and t-test assumes the sample mean follows normal distribution, it is common way to check the histogram. Although it is not needed that the data itself normally distributed, but in that case the assumption is met.