The Variance Ellipse
Total Page:16
File Type:pdf, Size:1020Kb
The Variance Ellipse ✧ 1 / 28 The Variance Ellipse For bivariate data, like velocity, the variabililty can be spread out in not one but two dimensions. In this case, the variance is now a matrix, and the spread of the data is characterized by an ellipse. This variance ellipse eccentricity indicates the extent to which the variability is anisotropic or directional, and the orientation tells the direction in which the variability is concentrated. ✧ 2 / 28 Variance Ellipse Example Variance ellipses are a very useful way to analyze velocity data. This example compares velocities observed by a mooring array in Fram Strait with velocities in two numerical models. From Hattermann et al. (2016), “Eddydriven recirculation of Atlantic Water in Fram Strait”, Geophysical Research Letters. Variance ellipses can be powerfully combined with lowpassing and bandpassing to reveal the geometric structure of variability in different frequency bands. ✧ 3 / 28 Understanding Ellipses This section will focus on understanding the properties of the variance ellipse. To do this, it is not really possible to avoid matrix algebra. Therefore we will first review some relevant mathematical background. ✧ 4 / 28 Review: Rotations T The most important action on a vector z ≡ [u v] is a ninety-degree rotation. This is carried out through the matrix multiplication 0 −1 0 −1 u −v z = = . [ 1 0 ] [ 1 0 ] [ v ] [ u ] Note the mathematically positive direction is counterclockwise. A general rotation is carried out by the rotation matrix cos θ − sin θ J(θ) ≡ [ sin θ cos θ ] cos θ − sin θ u u cos θ − v sin θ J(θ) z = = . [ sin θ cos θ ] [ v ] [ u sin θ + v cos θ ] The ninety-degree rotation matrix is J(π/2), while J(π), the 180 degree rotation matrix, just changes the sign of z. ✧ 5 / 28 Review: Matrix Basics Recall that a matrix M is said to be unitary if 1 0 MT M = I = [ 0 1 ] where “T” represents the matrix transpose, and I is called the identity matrix. T For a unitary matrix, M M z = z, i.e. when the matrix and its transpose operate in succession, nothing happens. We can see that the rotation matrix J(θ) is unitary since cos θ sin θ cos θ − sin θ 1 0 JT (θ) J(θ) = = . [ − sin θ cos θ ] [ sin θ cos θ ] [ 0 1 ] T We also note that J (θ) = J(−θ), the transpose of a rotation matrix is the same as a rotation in the opposite direction. Makes sense! ✧ 6 / 28 Complex Notation A pair of time series can also be grouped into a single complex valued time series zn = un + ivn n = 0, 1, 2, … N − 1 where i = √−‾‾1‾. The real part represents east-west, and the imaginary part represents north-south. We will use both the complex-valued and vector representations. Complex notation turns out to be highly useful not only for bivariate data, but also in the analysis of real-valued time series as well. Complex numbers are reviewed in detail in another lecture. ✧ 7 / 28 The Mean of Bivariate Data Next we look at the mean and variance for the case of bivariate data, which we represent as the vector-valued time series zn . The sample mean of the vector time series zn is also a vector, 1 N−1 ⎯u⎯⎯ ⎯z⎯⎯ ≡ z = N ∑ n [ ⎯v⎯⎯ ] n=0 that consists of the sample means of the u and v components of zn . ✧ 8 / 28 Variance of Bivariate Data The variance of the vector-valued times series zn is not a scalar or a vector, it is a 2 × 2 matrix 1 N−1 Σ ≡ z − ⎯z⎯⎯ z − ⎯z⎯⎯ T N ∑ ( n ) ( n ) n=0 T where “T” represents the matrix transpose, z = [ u v ]. Carrying out the matrix multiplication leads to N−1 ⎯⎯⎯ 2 ⎯⎯⎯ ⎯⎯⎯ 1 (un − u) (un − u) (vn − v) Σ = N ∑ [ ⎯⎯⎯ ⎯⎯⎯ ⎯⎯⎯ 2 ] n=0 (un − u) (vn − v) (vn − v) 2 2 The diagonal elements of Σ are the sample variances σu and σv , while the off-diagonal gives the covariance between un and vn . Note that the two off-diagonal elements are identical. ✧ 9 / 28 Standard Deviation Σ is generally called the velocity covariance matrix. We can still define a scalar-valued standard deviation σ. This is done by taking the mean of an inner product rather than an outer product, 1 N−1 1 N−1 Σ ≡ z − ⎯z⎯⎯ z − ⎯z⎯⎯ T , σ 2 ≡ z − ⎯z⎯⎯ T z − ⎯z⎯⎯ . N ∑ ( n ) ( n ) N ∑ ( n ) ( n ) n=0 n=0 2 The squared velocity standard deviation σ is related to the covariance matrix as the sum of the diagonal elements: 2 2 2 σ = Σuu + Σvv = σu + σv . The sum of the diagonal elements of matrix is known as the trace of 2 the matrix, denoted tr. Thus σ = tr{Σ}. Note σ 2 is only a factor of two away from the eddy kinetic energy, K = 1 σ 2 ✧ 2 . Clearly we only need to use one of these quantities. 10 / 28 Eigenvalue Decomposition For bivariate data zn , the second moment—the velocity covariance matrix—takes on a geometric aspect that can be highly informative. We will shown that the covariance matrix Σ can be written as cos θ − sin θ a2 0 cos θ sin θ Σ = [ sin θ cos θ ] [ 0 b2 ] [ − sin θ cos θ ] T or more compactly as Σ = J(θ) D(a, b) J (θ), where we have introduced the diagonal matrix D(a, b) defined as a2 0 D(a, b) ≡ . [ 0 b2 ] This is the eigenvalue decomposition of the covariance matrix Σ. Generally, the eigenvalue decomposition is found numerically, though for the 2 × 2 case this is not necessary because there are simple expressions for a, b, and θ, as will be shown later. ✧ 11 / 28 Diagonalization The operation of the eigenvalue decomposition is to diagonalize the covariance matrix. In other words, Σ = J(θ) D(a, b) JT (θ) implies that JT (θ)ΣJ(θ) = D(a, b) which means that if we rotate the observed velocities by −θ, we obtain an ellipse its major axis oriented along the x-axis, and with no correlation between the x- and y-velocities. These rotated velocities are given by ˜u ˜z ≡ ≡ JT (θ)z [ ˜v ] with ˜u being the component of the velocity along the major axis, ˜v ✧ and the component of the velocity along the minor axis. 12 / 28 Diagonalization If we form the covariance matrix of the velocities rotated by the angle of θ that comes out of the eigenvalue decomposition, we find N−1 1 ⎯⎯⎯ ⎯⎯⎯ T ˜Σ ≡ ˜z − ˜z ˜z − ˜z [ N ∑ ( n ) ( n ) ] n=0 1 N−1 ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯ ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯ T = JT (θ)z − JT (θ)z JT (θ)z − JT (θ)z J(θ) [ N ∑ ( n ) ( n ) ] n=0 N−1 T 1 ⎯⎯⎯ ⎯⎯⎯ T = J (θ) (zn − z) (zn − z) J(θ) [ N ∑ ] n=0 = JT (θ) [J(θ) D(a, b) JT (θ)] J(θ) = D(a, b) T T T using (Az) = z A . Thus the eigenvalue matrix D(a, b) is simply the covariance matrix computed in a rotated frame. The eigenvalue decomposition has found the rotation for which the ✧ covariance between the rotated velocity components vanishes. 13 / 28 The Variance Ellipse The covariance matrix describes an ellipse with major axis a and minor axis b, orientated at an angle θ with respect to the x-axis. The usual equation for an ellipse with major axis a oriented along the u-axis and minor axis b oriented along the v-axis is u2 v2 1/a2 0 u + = [ u v ] = zT D−1(a, b) z = 1 a2 b2 [ 0 1/b2 ] [ v ] where the “−1” denotes the matrix inverse. Recall the inverse of a −1 matrix M is defined to give M M = I. Thus −1 zT Σ−1 z = zT [J(θ) D(a, b) JT(θ)] z T = [JT(θ) z] D−1(a, b) [JT(θ) z] = 1 is the equation for an ellipse with semi-major axis a, semi-minor axis b, and oriented θ radians counterclockwise from the x-axis. ✧ 14 / 28 The Variance Ellipse Thus we have shown the covariance matrix Σ of a bivariate time series zn defines an ellipse that captures how the data is spread out about its mean value, as claimed. ✧ 15 / 28 Expressions for the Axes Exact expression can be found for a, b, and θ. Here we introduce some new notation. tr{M} denotes the matrix trace, which is defined to be the sum of all diagonal elements of M. Similarly det{M} denotes the determinant. 2 2 2 For Σ we have tr{Σ} = σuu + σvv and det{Σ} = ΣuuΣvv − Σuv. The eigenvalues of Σ are given explicitly by 1 1 a2 = tr{Σ} + ‾[t‾r‾{‾Σ‾}‾‾]2‾‾−‾‾4‾d‾e‾t‾{‾Σ‾}‾ 2 2 √ 1 1 b2 = tr{Σ} − ‾[t‾r‾{‾Σ‾}‾‾]2‾‾−‾‾4‾d‾e‾t‾{‾Σ‾}‾ 2 2 √ as can easily be shown by inserting the values for tr{Σ} and det{Σ}. Born and Wolf (1959), Principles of Optics Samson (1980), “Comments on polarization and coherence” ✧ 16 / 28 Expression for the Angle To find the angle θ, we carry out the matrix multiplications, giving 1 1 cos 2θ sin 2θ J (θ) D(a, b)JT (θ) = (a2 + b2) I + (a2 − b2) 2 2 [ sin 2θ − cos 2θ ] and we also rewrite the covariance matrix Σ in the form Σuu Σuv 1 Σuu − Σvv Σuv Σ = = (Σuu + Σvv) I + . [ Σuv Σvv ] 2 [ Σuv Σvv − Σuu ] Equating terms in the anisotropic parts of these matrices leads to 2 2 2 2 Σuu − Σvv = (a − b ) cos 2θ, 2Σuv = (a − b ) sin 2θ and dividing these two expressions, we find θ satisfies 2Σ tan(2θ) = uv .