# TI-BASIC:Zinterval

{{Template:TI-BASIC:Command |picture=ZINTERVAL.GIF |summary=Using either already-calculated statistics, or a data set, computes a Z confidence interval. |syntax=ZInterval std. deviation, [list, [frequency}} [,confidence level] (data list input)

ZInterval std. deviation, mean, sample size, [confidence level] (summary stats input) |location=When editing a program, press:

1. STAT to access the statistics menu
2. LEFT to access the TESTS submenu
3. 7 to select ZInterval, or use arrows

(this key sequence will give you the ZInterval... screen outside a program) |compatibility=TI-83/84/+/SE |size=2 bytes ]]

The ZInterval command calculates a confidence interval for the mean value of a population, at a specific confidence level: for example, if the confidence level is 95%, you are 95% certain that the mean lies within the interval you get. Use ZInterval when you have a single variable to analyze, and you already know the standard deviation. The ZInterval assumes that your distribution is normal, but it will work for other distributions if the sample size is large enough.

There are two ways to call the ZInterval command: by supplying it with needed sample statistics (mean and sample size), or by entering a list and letting the calculator work the statistics out. In either case, you will need to enter the standard deviation and desired confidence level as well.

# Sample Problem

You want to know the average height of a student at your school. You haven't asked everyone, but you took a random sample of 30 people and found out their height (and stored it to L,,1,,). You've read in your textbook that the standard deviation of teenagers' heights is usually 6 inches. You've decided to use a 95% confidence interval.

Since the syntax for entering a data list is ZInterval std. deviation, list, confidence level, the code would look like:

```:ZInterval 6,L1,95
you can also use
:ZInterval 6,L1,.95
```

Alternatively, you could calculate the mean and sample size and enter those instead. The sample size in this case is 30; let's say the mean was 63 inches. The syntax for entering statistics is ZInterval std. deviation, mean, sample size, confidence level, so your code would look like:

```:ZInterval 6,63,30,95
you can also use
:ZInterval 6,63,30,.95
```

Of course, the main use of the ZInterval command is in a program. While you can enter the ZInterval command on the home screen as well (just look in the catalog for it), it would probably be easier to select ZInterval... from the STAT>TEST menu (see the sidebar).

As with most other statistical commands, you can enter a second list after the data list, to add frequencies (only with the data list syntax, of course). The frequency list must contain non-negative real numbers, and can't be all 0.

# Optimization

Using the data list syntax, all items but the standard deviation are optional: the calculator will assume you want to use L1 for your data unless another list is supplied, and that the confidence level you want is 95% unless you give another one. Using the summary stats syntax, the confidence level is also optional - again, the calculator will assume 95%. This means we can rewrite our code above in a simpler manner:

```:ZInterval 6,L1,95
can be
:ZInterval 6
```

```:ZInterval 6,63,30,95
can be
:ZInterval 6,63,30
```