0
$\begingroup$

I have 3D gridded oceanographic data for a variety of properties and I'm computing depth weighted averages (the gridding is irregular, but the dataset comes with the gridding data which can be called easily).

Let's say that I have a segment of ocean (for simplicity let's say I've already averaged in longitude and now have latitude, X, versus depth, Z), and I want to find the weighted depth average temperature, for example. If I'm not mistaken, this should be the each Z level of my X by Z grid multiplied by the corresponding Z cell value. Then I would sum over the Z dimension and then divide by the total depth (the sum of the values of Z).

This made me think that if I thought of X vs Z as a matrix, I could think of this as

$\frac{{X}^T\vec{z} }{\sum_i{{z_i}}}$ (Right?)

But this looks a lot like a projection of the columns of $X$ onto $\vec{z}$, but with $\sum{z_i}$ instead of $\sum{z_i^2}$. Is there a way to think of this weighted average as a projection? Is there a different sense of norm I could use? This doesn't change my answer (unless my answer is wrong :/) but I would like to have a better way to relate my linear algebra knowledge to practical applications. Feel free to wax poetic about this.

$\endgroup$

1 Answer 1

0
$\begingroup$

From your description, it looks like both $X$ and $\vec{z}$ are vectors. So instead of talking about the columns of $\vec{z}$, it makes more sense to talk about its components. I'll use bold notation for both $\mathbf{x}$ and $\mathbf{z}$ as vectors When taking a weighed average, you are taking a weighted combination of the components of the $n$-dimensional vector $\mathbf{x}$ (the measurements) we can write it like this

$$ w_{1} x_{1} + w_{2} x_{2} + \ldots + w_{n} x_{n} $$

For this to be an average we need

$$ \sum_{k=1}^{n} w_{k} = 1 $$

For the ordinary mean average we use

$$ w_{1} = \ldots = w_{n} = \frac{1}{n} $$

If you use the depth data to weight the components of $\mathbf{x}$, you are using

$$ w_{k} = \frac{z_{k}}{Z} $$

where $Z$ is the sum of all components in $\mathbf{z}$ - this ensures that the sum of the $w_{k}$'s equals one.

You can think of this as a kind of projection, if we consider the result of dividing the vector $\mathbf{z}$ by the total of its components: $$ \mathbf{v} = \frac{\mathbf{z}}{Z} = \left( \frac{z_{1}}{Z} , \ldots , \frac{z_{n}}{Z} \right)^{T} $$

The weighted average is then $\mathbf{x}^{T} \mathbf{v}$. We can normalise the vector $\mathbf{v}$, so that it has unit length in $\mathbb{R}^{n}$, by dividing it by the Euclidean norm $v = |\mathbf{v}| = \sqrt{v_{1}^{2} + \ldots + v_{n}^{2}}$

$$ \mathbf{u} = \frac{\mathbf{v}}{v} $$

Now the weighted average is $\mathbf{x}^{T} \mathbf{v} = v \mathbf{x}^{T} \mathbf{u}$, so it is $v$ times the component of $\mathbf{x}$ in the direction of the $n$-vector $\mathbf{u}$. I.e. it is a scaled projection in $\mathbb{R}^{n}$

$\endgroup$
2
  • $\begingroup$ No, you've misunderstood. $X$ is a matrix, each of whose entry is a tracer value for a particular cell in the grid. The vector $\vec{z}$ contains the "height" of each cell. So $X^T\vec{z}$ weights each component of X by the "height" of its cell; obviously the "taller" the cell, the more weight it should get in the average. Then the division would be by the total depth; that is $sum{z_i}$. To be clear though, you're saying that in order to write it as a projection, we need to replace $\vec{z}$ by $\frac{\vec{z}}{\sum{z_i}}$ and then normalize it. I see $\endgroup$
    – BenL
    Commented Jun 26, 2017 at 17:34
  • $\begingroup$ Okay, thanks. Glad the answer was at least partially helpful. $\endgroup$ Commented Jun 26, 2017 at 18:54

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .