I’m trying to figure out exactly what the difference is between t-tests and z-tests.

As far as I can tell, for both classes of tests one uses the same test statistic, something of the form

ˆb−C^se(ˆb)

where ˆb is some sample statistic, C is some reference (location) constant (which depends on the particulars of the test), and ^se(ˆb) is the standard error of ˆb.

The only difference, then, between these two classes of tests is that in the case of t-tests, the test statistic above follows a t-distribution (for some sample-determined degrees-of-freedom d), whereas in the case of z-tests, the same test statistic follows a standard normal distribution N(0,1). (This in turn suggests that the choice of a z-test or a t-test is governed by whether or not the sample is large enough.)

Is this correct?

**Answer**

The names “t-test” and “z-test” are typically used to refer to the special case when X is normal N(μ,σ2), ˆb=ˉx and C=μ0. You can however of course construct tests of “t-test type” in other settings as well (bootstrap comes to mind), using the same type of reasoning.

Either way, the difference is in the s.e.(ˆb) part:

- In a z-test, the standard deviation of ˆb is assumed to be

**known without error**. In the special case mentioned above, this means that s.e.(ˉx)=σ/√n. - In a t-test, it is
**estimated using the data**. In the special case mentioned above, this means that s.e.(ˉx)=ˆσ/√n, where ˆσ=√1n−1∑ni=1(xi−ˉx)2 is an estimator of σ.

The choice between a t-test and a z-test, therefore, depends on **whether or not σ is known prior to collecting the data**.

The reason that the distribution of the two statistics differ is that the t-statistic contains more unknowns. This causes it to be more variable, so that its distribution has heavier tails. As the sample size n grows, the estimator ˆσ comes very close to the true σ, so that σ essentially is known. So when the sample size is large, the N(0,1) quantiles can be used also for the t-test.

**Attribution***Source : Link , Question Author : kjo , Answer Author : L.V.Rao*