# When do you calculate a z-interval

## Confidence interval

What is a confidence interval and a confidence level? This question and how you do that Calculate confidence interval can, the connections with the Probability of error and the Standard error, we show you here.

Would you prefer to acquire the topic vividly in a short period of time? We explain this to you in our video Confidence interval!

### Confidence interval explained in simple terms

To put it simply, askConfidence intervals represents a statistically calculated area with which one can better assess where, for example, the true mean of a data set lies. You do this because values ​​calculated in statistics are often based on a sample. The hypotheses and prognoses should apply to whole groups of people.

For example, you can take the mean expenditure of 100 students on pizza and calculate a confidence interval around this value, in which the mean value of all students' expenditure on pizza is then with 95 percent certainty. The step-by-step calculation for exactly this example will be explained in an understandable manner after the definition has been presented in the course of the article.

### Confidence Interval Definition

Under the confidence interval, also abbreviated AI called, is to be understood as a statistical interval that is supposed to localize the position of a true parameter of a population with a certain probability.

In contrast to the estimated parameter, which is known to come about through calculations with the data of a sample, a true parameter can seldom be determined exactly. Confidence intervals at least offer the possibility of being able to locate it more precisely with a certain probability of success.

### Confidence interval

For the sake of completeness, it should also be noted that the confidence interval is in rare cases under the name Confidence interval or Trust area occurs. In the same way, the confidence level, which will be discussed in the article, can also be used as Confidence level describe.

### Calculate confidence interval

In this section, after introducing the formula, the calculation of the confidence interval will be demonstrated using an illustrative example.

### Confidence interval formula

A confidence interval always has two endpoints that separate it from the range of the probability of error. In order to calculate the interval, you need the values ​​for the so-called upper and lower limit. The final formulas for calculating the upper and lower bounds are as follows:  Stand here and respectively for the lower limit and the upper limit. denotes the mean value of the data set, and are the z-transformed interval boundaries. Finally, it is multiplied by the fraction from the standard error and the square root of the sample size .

### Confidence interval example

Before starting the calculation, you set the desired Confidence level determines the probability with which the true mean should lie in the certain confidence interval. Often you orient yourself towards 95%, which is why this value also applies to the example. For this example, we use data from a fictitious survey of student pizza consumption. Here we consider the expenditure in € per month per student based on a sample size of 100 students.

The goal is to determine a confidence interval around the estimated mean of these values ​​in order to narrow down the location of the true mean of the population. With this example, one moves on the normal distribution, since from a sample size of 50 the t-distribution can be approximated to the normal distribution. Once all the important key data and requirements have been collected and defined, the calculation can begin.

#### Step 1: Calculating the estimated parameter:

In this example, the confidence interval should span the following estimated parameter of the sample: the mean. Therefore it has to be calculated in a first step. Because of the large sample size, grouped data is used for convenience.

 Number of respondents Expenses / month 20 8€ 30 32€ 10 0€ 30 48€ 10 16€ For this example, the mean value is therefore at .

#### Step 2: Transformation of the interval limits into normally distributed values ​​using the z-distribution table

The specified confidence level of 95% results in the following interval limits: the lower limit is at % and the upper limit at %. You now have to standardize these values ​​and look up for this in the z-distribution table.

 0,65 0,7 0,75 0,8 0,85 0,9 0,95 0,975 0,99 0,995 Z-Value 0,385 0,524 0,674 0,842 1,036 1,282 1,645 1,960 2,326 2,576

The z-value for the upper limit you are looking for is easy to read, because it can be found in decimal form as 0.975 in the table. The value for the lower limit is not shown in the table, but can be determined as follows: Since the normal distribution is symmetrical and mirrored on the x-axis, you can simply enter the value for the upper limit, i.e. , and read off the equivalent, that is , form. The z-transformed values ​​for the upper and lower limits of the confidence interval are thus determined: They are included for the lower limit and for the ceiling. With a mean , the lower limit , the upper limit and a sample size of are all required parameters for the formula except for the standard error given.

##### Standard error

The standard error is essentially nothing more than the standard deviation of a sample. The term is mainly used to differentiate it from the standard deviation of the population. Before one can calculate the standard error, however, the variance must first be determined.

##### Normal distribution

As is known, the standard error results from the root of the variance. The information provided by the respondents has been grouped again in a table for illustration.

 Number of respondents Expenses / month 20 8€ 30 32€ 10 0€ 30 48€ 10 16€

#### Step 3: Calculation of variance and standard deviation or standard error

The variance can be calculated using the values ​​from the table as follows:  This then simply gives the standard error for the estimated mean: Now, in the last step, you can transfer all calculated values ​​into the formulas.

#### Step 4: Enter all values ​​in the formulas for the lower and upper limit  The limits of the contingency interval are therefore at points 23.82 and 30.58. So there is a 95% probability that the true one is within this range. The conclusion for the example is: With a 95% certainty, the true mean for students' monthly pizza spend is between € 23.82 and € 30.58.

### 95 confidence interval

The width of the confidence interval, i.e. the range in which the true mean of the population is expected, must, as already mentioned, be determined before the calculation. In most cases it makes sense to work with a confidence interval of 95%. This given probability is what is known as the confidence level. In rare cases you can work with a confidence level of 99%. If, for example, the certainty or guarantee that a true value is located in the confidence interval should be even greater, then the confidence level can be increased and the interval thus extended. The width of the confidence interval must always be specified in the form of a lower and upper limit. In the specific example of this article, this means, as already mentioned, that the KI spans between the values ​​23.83 and 30.58 and 95% of the true mean of the population is in this value range.

### Probability of error

Based on that 95 confidence interval it is then also very easy to determine the probability of error. In the case of a 95% confidence interval, this is 5%. For an interval with a confidence of 99%, the associated error probability would be 1%. Consequently, the probability of error is the difference between the whole, i.e. 100%, and the size of the confidence interval. It is then distributed evenly on both sides of the confidence interval.

### Confidence interval exercise

If you want to use your knowledge right away, you can try our exercise video.