# Statistics/Testing Data/z-tests

The Null Hypothesis should be an assumption concerning the value of the population mean. The data should consist of a single sample of quantitative data from the population.

## RequirementsEdit

The sample should be drawn from a population from which the Standard Deviation (or Variance) is known. Also, the measured variable (typically listed as is the *sample statistic*) should have a Normal Distribution.

Note that if the distribution of the variable in the population is non-normal (or unknown), the z-test can still be used for approximate results, provided the sample size is sufficiently large. Historically, sample sizes of at least 30 have been considered sufficiently large; reality is (of course) much more complicated, but this rule of thumb is still in use in many textbooks.

If the population Standard Deviation is unknown, then a z-test is typically not appropriate. However, when the sample size is large, the sample standard deviation can be used as an estimate of the population standard deviation, and a z-test can provide approximate results.

## Definitions of TermsEdit

- = Population Mean

- = Population Standard Deviation

- = Sample Mean

- = Sample Population

## ProcedureEdit

- The Null Hypothesis:

This is a statement of *no change* or *no effect;* often, we are looking for evidence that this statement is *no longer true.*

- H
_{0}: μ = μ_{0}

- The Alternate Hypothesis:

This is a statement of inequality; we are looking for evidence that this statement *is* true.

- H
_{1}: μ < μ_{0}or

- H
_{1}: μ > μ_{0}or

- H
_{1}: μ ≠ μ_{0}

- The Test Statistic:

- The Significance (p-value)

Calculate the probability of observing a value of z (from a Standard Normal Distribution) using the Alternate Hypothesis to indicate the direction in which the area under the Probability Density Function is to be calculated. This is the Attained Significance, or p-value.

Note that some (older) methods first chose a Level Of Significance, which was then translated into a value of z. This made more sense (and was easier!) in the days before computers and graphics calculators.

- Decision

The Attained Significance represents the probability of obtaining a test statistic as extreme, or more extreme, than ours - if the null hypothesis is true.

If the Attained Significance (p-value) is sufficiently low, then this indicates that our test statistic is unusual (rare) - we usually take this as evidence that the null hypothesis is in error. In this case, we *reject the null hypothesis.*

If the p-value is large, then this indicates that the test statistic is usual (common) - we take this as a lack of evidence against the null hypothesis. In this case, we *fail to reject the null hypothesis.*

It is common to use 5% as the dividing line between the common and the unusual; again, reality is more complicated. Sometimes a lower level of uncertainty must be chosen should the consequences of error results in a decision that can injure or kill people or do great economic harm. We would more likely tolerate a drug that kills 5% of patients with a terminal cancer but cures 95% of all patients, but we would hardly tolerate a cosmetic that disfigures 5% of those who use it.

## Worked ExamplesEdit

### Are The Kids Above Average?Edit

Scores on a certain test of mathematical aptitude have mean μ = 50 and standard deviation σ = 10. An amateur researcher believes that the students in his area are brighter than average, and wants to test his theory.

The researcher has obtained a random sample of 45 scores for students in his area. The mean score for this sample is 52.

Does the researcher have evidence to support his belief?

The null hypothesis is that *there is no difference,* and that the students in his area are no different than those in the general population; thus,

- H
_{0}: μ = 50

(where μ represents the mean score for students in his area)

He is looking for evidence that the students in his area are above average; thus, the alternate hypothesis is

- H
_{1}: μ > 50

Since the hypothesis concerns a single population mean, a z-test is indicated. The sample size is fairly large (greater than 30), and the standard deviation is known, so a z-test is appropriate.

We now find the area under the Normal Distribution to the right of z = 1.3416 (*to the right, since the alternate hypothesis is to the right*). This can be done with a table of values, or software- I get a value of 0.0899.

If the null hypothesis is true (and these students are no better than the general population), then the probability of obtaining a sample mean of 52 or higher is 8.99%. This occurs fairly frequently (using the 5% rule), so it does not seem unusual. I fail to reject the null hypothesis (at the 5% level).

It appears that the evidence *does not* support the researcher's belief.

### Is The Machine Working Correctly?Edit

Sue is in charge of Quality Control at a bottling facility. Currently, she is checking the operation of a machine that is supposed to deliver 355 mL of liquid into an aluminum can. If the machine delivers too little, then the local Regulatory Agency may fine the company. If the machine delivers too much, then the company may lose money. For these reasons, Sue is looking for any evidence that the amount delivered by the machine is different from 355 mL.

During her investigation, Sue obtains a random sample of 10 cans, and measures the following volumes:

- 355.02 355.47 353.01 355.93 356.66 355.98 353.74 354.96 353.81 355.79

The machine's specifications claim that the amount of liquid delivered varies according to a normal distribution, with mean μ = 355 mL and standard deviation σ = 0.05 mL.

Do the data suggest that the machine is operating correctly?

The null hypothesis is that the machine is operating according to its specifications; thus

- H
_{0}: μ = 355

(where μ is the mean volume delivered by the machine)

Sue is looking for evidence of *any* difference; thus, the alternate hypothesis is

- H
_{1}: μ ≠ 355

Since the hypothesis concerns a single population mean, a z-test is indicated. The population follows a normal distribution, and the standard deviation is known, so a z-test is appropriate.

In order to calculate the test statistic (z), we must first find the sample mean from the data. Use a calculator or computer to find that .

The calculation of the p-value will be a little different. If we only find the area under the normal curve *above* z = 2.34, then we have found the probability of obtaining a sample mean of 355.037 or *higher*—what about the probability of obtaining a low value?

In the case that the alternate hypothesis uses ≠, the p-value is found by *doubling the tail area*—in this case, we double the area above z = 2.34.

The area above z = 2.34 is 0.0096; thus, the p-value for this test is 0.0192.

If the machine is delivering 355 mL, then the probability of obtaining a sample mean this far (0.037 mL) or farther from 355 mL is 0.0096, or 0.96%. This is pretty rare; I'll reject the null hypothesis.

It appears that the machine is not working correctly.

N.B.: since the alternate hypothesis is ≠, we cannot conclude that the machine is delivering *more* than 355 mL—we can only say that the amount is *different* from 355 mL.