A one-sample z-test is a statistical test used to compare the mean of a sample to a known population mean. It is used to test a hypothesis about the population mean and is based on the assumption that the sample is drawn from a normally distributed population.

## Steps in One Sample Z Test

To conduct a one-sample z-test, the following steps are typically followed:

**Specify the null and alternative hypotheses.**The null hypothesis is usually that the population mean is equal to a specific value, while the alternative hypothesis is that the population mean is not equal to that value.**Select a sample**from the population and calculate the sample mean and standard deviation.**Calculate the test statistic,**which is the difference between the sample mean and the population mean, divided by the standard error of the mean.**Determine the critical value**of the test statistic based on the significance level (alpha) of the test.**Compare the calculated test statistic to the critical value**to determine whether to reject or fail to reject the null hypothesis. If the calculated test statistic exceeds the critical value, the null hypothesis is rejected, and the alternative hypothesis is accepted.

## Conditions for Z test

To conduct a valid z-test, the following conditions must be met:

- The sample must be
**drawn randomly**from the population. - Each observation in the sample must be
**independent of the others.**- The sampling must be done with replacement, OR
- If sampling without replacement, the sample size must be less than 10% of the population.

- The population distribution must approximate a
**normal distribution.** - The population
**standard deviation must be known**, or the**sample size must be large**(30 or more).

## Typical Null and Alternate Hypothesis in one-sample Z test

### a) Two Tail Test:

In a one-sample Z-test, the null hypothesis is that there is no difference between the mean of the sample and the known population mean. This can be expressed as:

H0: μ = μ0

where μ is the mean of the sample and μ0 is the known population mean.

The alternate hypothesis is the opposite of the null hypothesis and is that there is a difference between the mean of the sample and the known population mean. This can be expressed as:

Ha: μ ≠ μ0

### b) Left Tail Test

A left-tailed hypothesis is one in which the mean of the sample is less than the known population mean. This can be expressed as:

H0: μ >= μ0

Ha: μ < μ0

### c) Right Tail Test

A right-tailed hypothesis is one in which the mean of the sample is greater than the known population mean. This can be expressed as:

H0: μ <= μ0

Ha: μ > μ0

## Calculating Test Statistic

The z-score represents the number of standard deviations that the sample mean is from the population mean. It is used to determine whether the difference between the sample mean and the population mean is statistically significant.

The formula for calculating the z-score in a one-sample z-test is as follows:

$$\LARGE{z = \frac{(\bar{x} - \mu)}{(s / \sqrt{n})}}$$

Where \(\bar{x}\) is the sample mean, \(\mu\) is the population mean, \(s\) is the sample standard deviation, and \(n\) is the sample size.

## Typical Critical Values

The critical values for the z-score in a one-sample z-test depend on whether the test is a one-tail or two-tail test.

For a one-tail test, the critical value is determined based on the tail of the distribution in which the alternative hypothesis is located. For example, if the alternative hypothesis is that the population mean is greater than a specific value, the critical value would be the value that corresponds to the upper tail of the distribution.

For a two-tail test, the critical value is determined based on the significance level of the test and the total area of both tails of the distribution. For example, if the significance level is 0.05 and the test is two-tailed, the critical value would be the value that corresponds to an area of 0.05 in both tails of the distribution (or 0.025 area in one tail, as the normal distribution is symmetric).

The most common critical values for the z-score in a one-sample z-test are as follows:

- For a one-tail test with a significance level of 0.05, the critical value is 1.64.
- For a one-tail test with a significance level of 0.01, the critical value is 2.33.
- For a one-tail test with a significance level of 0.001, the critical value is 3.09.
- For a two-tail test with a significance level of 0.05, the critical value is 1.96.
- For a two-tail test with a significance level of 0.01, the critical value is 2.58.
- For a two-tail test with a significance level of 0.001, the critical value is 3.29.

These critical values are based on the standard normal distribution and are used to determine whether the calculated z-score is statistically significant. If the calculated z-score is greater than the critical value, the null hypothesis is rejected, and the alternative hypothesis is accepted.

You can find the critical values using a Normal Distribution table or software such as Excel. The formula to find out this value in Excel is **=NORM.S.INV(alpha)** for the one-tail test and **=NORM.S.INV(alpha/2)** for the two-tail test. This provides the critical z value for the left tail.