Ripetizioni di Analisi
EN

Theory

Measures of location and spread

The mean, median, quantiles, and measures of spread for describing and comparing groups of observations.

On this page
  1. Arithmetic and weighted means
  2. The median, mode, and quantiles

In Chapter 1 the collected data were summarized with frequency tables and graphs. This chapter summarizes them with a few numbers, called measures or indices. Suppose, for example, that five patients at a clinic wait , , , , and minutes. The mean waiting time is minutes; the median, the waiting time in the middle of the ordered list, is minutes; and the shortest and longest waits differ by minutes.

The mean and the median are measures of location, because each gives in a single number the typical length of a wait. The difference of minutes is a measure of spread, because it says how different the waits are from one another. The mean exceeds the median because the single wait of minutes raises the sum; the chapter shows how each measure changes when one observation lies far from the others, and how the measures are computed from the frequency tables of Chapter 1. The chapter also defines the variance and the standard deviation, two measures of spread computed from the distances of the data from the mean.

In Chapters 5 and 6, on probability, the mean and the variance become the expected value and the variance of a number that depends on chance. In Chapters 8 to 12, on inference, the mean and the standard deviation of a sample are used to estimate the mean of the whole population and to compute the error of this estimate. The property of the mean proved in this chapter, that it minimizes the sum of the squared distances from the data, is the criterion used to construct the regression line of Chapter 12.

Arithmetic and weighted means

1. Arithmetic mean

Four appointments at a clinic last , , , and minutes, minutes in all. If the total time were divided equally among the four appointments, each would last minutes. This value is the arithmetic mean of the four durations.

In symbols, let be the observations of a quantitative variable (Chapter 1). The arithmetic mean , read “x bar”, is the sum of the observations divided by their number:

The symbol denotes the sum .

The mean has the same units as the data. Multiplying it by the number of observations recovers the total, because , even when the individual values are unknown. If all that is known about four appointments is that they last on average, their total duration is . This step is used to combine two groups and to update a mean.

2. Weighted means and frequencies

A student scored on a -credit exam and on a -credit exam. The -credit exam counts twice as much, so each grade is multiplied by its credits and the sum is divided by the total number of credits:

The simple mean of the two grades, , treats the two exams as if they carried the same credits. The number is a weighted mean of the grades, and the credits are the weights.

In symbols, let be numerical values with nonnegative weights whose sum is positive. The weighted mean is

The denominator is the sum of the weights, so multiplying every weight by the same positive constant leaves the mean unchanged.

When is the absolute frequency (Chapter 1) of the value , the product is the sum of the observations equal to , and the sum of the weights is the number of observations. The mean computed from the frequency table therefore equals the mean of the individual observations. For example, the data have the table “value with frequency , value with frequency ”, and is also the mean .

Recovering the total from group summaries

A laboratory measured a mean concentration of in ten test tubes and in thirty other test tubes. The groups are disjoint and the measurements are in the same units. The sum of the measurements is for the first group and for the second. The overall mean is therefore

This is the weighted mean of the means and with weights equal to the group sizes and . The result is closer to because the second group has three times as many test tubes as the first. The simple mean of the two group means would give , because it would give the two groups the same weight.

x n 11121314151617048121620242832 1030
The bars represent the two groups by their means and sizes. The vertical line at 15 marks the weighted mean.

Remark

When observations are grouped into classes (Chapter 1), the number of observations in each class is known, but the individual values are not. Each observation is then replaced by the midpoint of its class, and the weighted mean of the midpoints is computed with the frequencies as weights; the result is called the approximate mean. For six observations in and four in , the midpoints are and , and the approximate mean is .

The actual mean depends on how the values lie within the classes. If the six observations of the first class all equal and the four of the second all equal , the actual mean is , far from .

x density 48121620242832 O 6 values4 valuesmean 11
Histogram of the two classes. The heights are the frequency densities and , and the areas are the counts and . The points on the axis mark the midpoints and . The vertical line marks the approximate mean .

Remark

The class endpoints give two bounds on the actual mean. A table reports three times in and two in , in minutes. Each time in the first class is at least and less than , and each time in the second is at least and less than . Hence the total of the five times is at least minutes and strictly less than minutes. Dividing by , the mean is at least and less than . The approximate mean computed with the midpoints is , the center of this interval.

Remark

Five times have mean , so their total is . A sixth time of is added; the total becomes and the new mean is .

In symbols, if a value is added to observations with mean , the new mean is . Subtracting the previous mean gives

The mean therefore moves toward the new value, and the shift is smaller the larger the original group; in the example it is . If instead the time of replaces a recorded time of , the group still has five observations and the total increases by , so the mean increases by . When a value is added the denominator is ; when a value is replaced it stays .

The median, mode, and quantiles

1. Median and empirical quantiles

Seven students take , , , , , , and minutes to get to the university. In increasing order the times are . The time in the middle of the list, , has three times before it and three after it, and is the median of the seven times.

In symbols, arrange the observations from smallest to largest and denote by the value in position of the ordered list. The position is called the rank of the observation. Repeated values occupy separate positions; in the list , for example, the value has ranks and . The median is the middle observation when is odd and the mean of the two middle observations when is even. Writing in the first case and in the second,

For the seven times and . In both cases at least half the observations are less than or equal to the median, and at least half are greater than or equal to it.

In the same way, one can look for a value that has a quarter of the observations at or below it. A quarter of the seven times corresponds to observations. Up to rank there is only one observation, fewer than ; up to rank there are two, which is at least . The required value is therefore the observation of rank , namely .

The empirical quantile of order , with , is the observation in the first rank at which the proportion of observations up to that position reaches at least . The condition is equivalent to , so the required rank is the smallest integer greater than or equal to , denoted by ; for example and . In a formula,

This rule is called the upper-rank rule, or rounding the rank up, and it is the rule used throughout this course; for the median defined above is used instead. The orders and give the first and third quartiles, denoted by and , which together with the median divide the ordered list into four parts of about observations each. The quantile is also called the percentile of order .

The quartiles are used to measure the spread of the middle half of the data and to draw the box plot, later in this chapter. Quantiles of a random variable return in Chapter 6 and in the confidence intervals of Chapter 10.

Ranks and cumulative frequencies

The ordered data are , so . The first quartile has rank , so . The third quartile has rank , so . The median uses ranks and , occupied by and , so .

In a frequency table, the cumulative absolute frequency of a value (Chapter 1) is the rank of the last copy of that value. Rank is therefore found by looking for the first value whose cumulative count reaches at least . At the value the cumulative count is , while at the value it is . This gives without writing out the whole list.

In the graph the horizontal axis shows the rank and the vertical axis shows the value with that rank.

k xₖ 123456789246810 O
The points show the values in rank order. The vertical lines at ranks 2 and 6 reach the first and third quartiles, respectively.

Warning

Software packages use different rules for quantiles, and the results differ when is not an integer. For the data , the upper-rank rule gives , because . Another common rule uses rank and, when it is not an integer, takes the intermediate value between the two neighboring observations, a procedure called linear interpolation. Here lies halfway between the first and second ranks, so the quartile is . Two quartiles computed with different rules are therefore not comparable.

2. Mode

In a survey on favorite colors, red, blue, and green occur , , and times, respectively. A mode is a category or value with the highest frequency, so in this survey there are two modes, red and blue. The mode is the only measure of location in this chapter that can also be found for an unordered categorical variable (Chapter 1), because it only requires counting the answers.

With data grouped into classes of unequal width, the frequency densities of the histogram (Chapter 1) are compared. With waiting times in minutes and in minutes, the class with more waiting times is , but the density of the first class is waiting times per minute and that of the second is waiting times per minute. The modal class is the class with the highest frequency density, that is, the one with the tallest rectangle in the histogram; here it is .

Remark

In the data , the third quartile has rank and value . Six observations are less than or equal to , that is of the eight, while only two are strictly less than , that is . The two proportions are very different because the value is repeated four times.

For every quantile obtained with the upper-rank rule, with , two inequalities hold.

  • The proportion of observations less than or equal to is at least , because the observations of ranks to are less than or equal to and .
  • The proportion of observations strictly less than is less than , because these observations have ranks before , so there are at most of them, and since is the smallest integer greater than or equal to .

With the empirical distribution function of Chapter 1 the two inequalities read and , so the quantile is the point where the graph of reaches or jumps past the level . The statement “the third quartile has of the observations below it” should therefore be read as “at least of the observations are less than or equal to ”.

x Fₙ(x) -1135791 O 0.750.25
Empirical distribution function of . The jump at goes from to and reaches the level , so .

3. Minimizing the sum of absolute deviations

Three houses stand along a straight road, at kilometers , , and . With a meeting point at kilometer , the median of the three data, the total distance from the three houses is kilometers. At kilometer , the mean, the total distance is kilometers.

Let be real observations, with . The sum of the distances of the observations from a number , namely , is minimized when is the median. When is even, every value between the two middle observations minimizes the sum, so taking their mean as the median is a convention. The theorem states in what sense the median is a center of the data.

c S(c) 246810-12581114172023 O (2, 8)(4, 10)
Graph of . The function is piecewise linear and attains its minimum at the median . At the mean its value is .
Proof

Order the observations and pair the smallest with the largest, the second smallest with the second largest, and so on. For a pair the sum equals

  • if ;
  • , which is greater than , if ;
  • , which is greater than , if .

The contribution of each pair is therefore minimized exactly when lies in the interval of the pair. The intervals of the pairs are nested, that is, each contains the next, because moving from one pair to the next the left observation increases and the right observation decreases. Hence every in the interval of the innermost pair belongs to all the intervals and minimizes all the contributions at once. When is even, this is the interval between the two middle observations. When is odd, the middle observation is left without a partner, and its contribution is minimized, with value , at . For the data the pair contributes at least and the observation at least , so the minimum of is , at .

End of the free preview

The theory of this topic continues with 6 more sections

  1. Descriptive variance and corrected sample variance
  2. Computational identities and changes of scale
  3. Absolute and relative measures of spread
  4. Box plots and observations beyond the fences
  5. Standardization and the shape of a distribution
  6. Keep studying

Full access also includes the other 7 worked examples of this topic and the solutions of the 14 practice exercises.

Unlock Statistics and probability · €49

Read the first 3 worked examples in this chapter for free.

Report a mistake

Where:

Ripetizioni di Analisi

Keep studying

With a free account, you can pick up where you left off and see your progress next time you visit.

Sign up for free

Already have an account? Sign in

Contents