# Testing population means with Z-tests and T-tests

## Z-test

### Z-test for variable significance

#### The standard score

We may want to see how different a mean statistic is from a specific value.

The standard score allows us to measure this, by taking this distance and standardising by the standard deviation.

\(z=\dfrac{\bar x-x_0}{\sigma }\)

This requires us to know the standard deviation, which is in general not known.

If the sample size is large, we know this converges to the normal distribution through the central limit theorem.

#### The Z-test

We can see how likely our statistic was to be produced if it was drawn from a normal distribution with mean \(x_0\) and standard deviation \(s_0\).

#### P-values

This is the chance of the statistic being produced by chance.

## t-test

### T-test for variable significance

#### T-statistic

In practice we don’t know the population standard deviation and so must estimate it instead.

We use the standard deviation on the sample.

\(t=\dfrac{\bar x-x_0}{s_0 }\)

#### Student’s t-distribution

As we have used the sample standard deviation we have lost a degree of freedom, and can no longer model the variable as a normal distribution, as we did for the z-statistic.

We now have a distribution with an addition parameter, the number of degrees of freedom.

The number of degrees of freedom is \(n-1\).

As the sample size tends towards infinity, the distribution tends towards the normal distribution.

#### Student’s t-test

#### Confidence interval

### Welch’s t-test

Alternative to student.