## The Weighted Average

This article deals with a mathematical concept / tool that's worth recognizing on inspection. To get started, here ere are a couple of examples you are familiar with:

#### So You're Back in School...

... And your grade point average needs a boost.  The instructor tells you that the 2 midterm examinations and the final examination will be weighted according to how many questions are on each examination. After a few bogus questions get thrown out, the first midterm has 47 remaining legitimate questions, the second midterm has 46, and the final has 93.  Your grades on each of the 3 exams are 3.5, 2.0 (oops), and 3.0 respectively.  Any recommendations for how to figure out the grade?

Probably the most obvious thing is for the prof to simply add up all your correct answers and divide by the total number possible, i.e. 47+46+93.  However there might be a situation where some of the questions are "worth" more than others within the exams.

Since we have grades from the individual exams, how about  $$\Large\frac{47\cdot 3.5 + 46\cdot 2.0 + 93\cdot 3.0 }{47+46+93} \approx 2.88$$

This has the effect of weighting each of the grades according to how many questions were on the associated exam.  Notice that this is equivalent to multiplying each grade by a fraction where the sum of the fractions add up to 1.0.

#### What's the Average Pressure

If you are given that the systolic pressure is 130 mmHg and diastolic is 86, what's the mean?

The formula that most people applied to this situation is to weight the diastolic value by 2/3 and the systolic by 1/3.  For a typical arterial pressure pulse, the pressure spends more time close to the diastolic value than to the systolic value.

$$\Large\frac{1\cdot 130 + 2\cdot 86}{1+2} \approx 100.67$$ mmHg

I once ran across an impending cardiologist who seemed to think that the mean systolic pressure was defined by this formula (No). Here's an expression that defines the average of a function, that changes with variable  $$x$$ , over the interval $$x_1 \to x_2$$ .

$$\bar{f(x)}=\Large\frac{\int_{x_1}^{x_2}f(x)\,dx}{\int^{x_2}_{x_1} \,dx}$$

The numerator of the above expression is the area under the curve of the function   $$f(x)$$ between $$x_1 \to x_2$$ .  The denominator is simply the difference - $$x_2-x_1$$ .

The (simple) average value has a clear graphical interpretation in this case.  Both the (gray) arbitrary function and (blue) rectangle have the same base length ($$x_2-x_1$$ ).  The average value of the function ($$x_1 \to x_2$$ ) is the height of the rectangle such that the gray area and blue area are equal.

#### Generalization

You're probably starting to get the hang of this. The above are common applications of the weighted average where we want to obtain some kind of average value but not every value receives the same weight or emphasis.  The generalized weighted average of $$N$$ values of $$y$$   looks like this:

$$\Large\frac{\sum_{i=1}^{N} y_i w_i}{\sum_{i=1}^N w_i}$$

The $$y_i$$ correspond to the individual values of the $$y$$  quantity ($$N$$ of them) and the  $$w_i$$ correspond to the weighting factors; $$w_i$$ is the individual weighting factor for $$y_i$$ .  In the numerator, we're summing the products of each value of $$y$$ with its weighting factor; the denominator is simply the sum of the weighting factors. ($$\Sigma$$ is the symbol for summation.) It's worth taking a look at this formula so that you will be able to spot it readily. When you run across it in real life, they're probably not going to name the weighting factors with a $$w$$ for you so you have to be on guard to recognize it.

#### More Examples

Flamm's formula for estimating right atrial oxygen saturation is:

3/4 SVC O2 + 1/4 IVC O2

SVC is the superior vena cava, IVC the inferior, and O2 is to indicate the oxygen saturation level in each. Spot the weighted average?  The formula is an approximation based on typical resting adult (human) patients, due to the fact that we can't measure saturation from all sources of venous return readily. Obviously the SVC contributes more to the mixed venous saturation based on the formula, but the estimated values for the weights in the formula are also contributed to by unmeasured sources of venous return like the coronary sinus. The actual rate of oxygen flow into the right atrium could be expressed as follows:

$${\sum_{i=1}^{N} S_i q_i}$$

$$S_i$$ are the individual oxygen saturations ( i.e. percentage or fraction of oxygen in the blood ) from any of $$N$$ sources of blood return back to the right atrium, e.g. superior ( cranial ) vena cava, inferior ( caudal ) vena cava, azygos vein, coronary sinus, atrial septal defect, etc. etc.  $$q_i$$ are the blood flow rates for each of the venous return routes.  Then the actual average oxygen saturation in the right atrium is as follows:

$$\Large\frac{\sum_{i=1}^{N} S_i q_i}{\sum_{i=1}^N q_i}$$

Here we're making use of a physical law here that I haven't discussed yet which is a general law of conservation (conservation of oxygen in this case). Hopefully the sense of this formula will be apparent prior to laying down the law.

#### The Dreaded $$\int$$

Folks that haven't taken a course in calculus are easily spooked by the dreaded integral symbol shown.  It may not have occurred to you that $$\int$$   is just a big sloppy "S" as in summation.  The integral symbol can just be thought of as a summation if calculus makes you squeamish.  It's a summation where the whole has been divided into an essentially infinite number of parts. The weighted average of a function of variable x (over the interval  $$x_1 \to x_2$$ ) in calculus looks like this:

$$\Large\frac{\int_{x_1}^{x_2} f(x) \, w(x) \,dx}{\int_{x_1}^{x_2}w(x) \,dx}$$