What is an eigenvector of a covariance matrix?

What is an eigenvector of a covariance matrix?

One of the most intuitive explanations of eigenvectors of a covariance matrix is that they are  the directions in which the data varies the most

(More precisely, the first eigenvector is the direction in which the data varies the most, the second eigenvector is the direction of greatest variance among those that are orthogonal (perpendicular) to the first eigenvector, the third eigenvector is the direction of greatest variance among those orthogonal to the first two, and so on.)

Here is an example in 2 dimensions [1]:

Each data sample is a 2 dimensional point with coordinates x, y. The eigenvectors of the covariance matrix of these data samples are the vectors u and v; u, longer arrow, is the first eigenvector and v, the shorter arrow, is the second. (The eigenvalues are the length of the arrows.) As you can see, the first eigenvector points (from the mean of the data) in the direction in which the data varies the most in Euclidean space, and the second eigenvector is orthogonal (perpendicular) to the first.

It's a little trickier to visualize in 3 dimensions, but here's an attempt [2]:


In this case, imagine that all of the data points lie within the ellipsoid. v1, the direction in which the data varies the most, is the first eigenvector (lambda1 is the corresponding eigenvalue). v2 is the direction in which the data varies the most  among those directions that are orthogonal to v1. And v3 is the direction of greatest variance among those directions that are orthogonal to v1 and v2 (though there is only one such orthogonal direction). 

[1] Image taken from  Duncan Gillies's lecture on Principal Component Analysis
[2] Image taken from Fiber Crossing in Human Brain Depicted with Diffusion Tensor MR Imaging
  
 
Given a set of random variables  {x1,...,xn}, the covariance matrix A is defined so that Ai,j=Cov(xi,xj). We can represent a linear combination bixi as a vector x=(b1,...,bn).

It turns out that the covariance of two such vectors x and y can be written as Cov(x,y)=xtAy. In particular, Var(x)=xtAx. This means that covariance is a Bilinear form.

Now, since A is a real symmetric matrix, there is an orthonormal basis for Rnof eigenvectors of A. Orthonormal in this case means that each vector's norm is 1 and they're orthogonal with respect to A, that is vt1Av2=0, or Cov(v1,v2)=0.

Next, suppose v is a unit eigenvector of A with eigenvalue λ. Then Var(v)=λv2=λ.

There are a couple interesting conclusions we can draw from this. First, since the eigenvectors form a basis {v1,...,vn}, every linear combination of the original random variables can actually be represented as a linear combination of the independent random variables vi. Second, every unit vector's variance is a weighted average of the eigenvalues. This means that the leading eigenvector is the direction of greatest variance, the next eigenvector has the greatest variance in the orthogonal subspace, and so on.

So, sum up, eigenvectors are uncorrelated linear combinations of the original set of random variables.

The primary application of this is Principal Components Analysis. If you have n features, you can find eigenvectors of the covariance matrix of the features. This allows you to represent the data with uncorrelated features. Moreover, the eigenvalues tell you the amount of variance in each feature, allowing you to choose a subset of the features that retain the most information about your data.
  
 
The largest eigenvector of a covariance matrix points into the direction of the largest variance. All other eigenvectors are orthogonal to the largest one.

Now, if this direction of the largest variance is axis-aligned (covariances are zero), then the eigenvalues simply correspond to the variances of the data:


It becomes a little more complicated if the covariance matrix is not diagonal, such that the covariances are not zero. In this case, the principal components (directions of largest variance) do no coincide with the axes, and the data is rotated. The eigenvalues then still correspond to the spread of the data in the direction of the largest variance, whereas the variance components of the covariance matrix still defines the spread of the data along the axes:


An in-depth discussion of how the covariance matrix can be interpreted from a geometric point of view (and the source of the above images) can be found on: A geometric interpretation of the covariance matrix
  
Shreyas Ghuge Shreyas Ghuge
3 upvotes by Sameer GuptaAnonymous, and Ram Shankar
 
Finding the directions of maximum and minimum variance is the same as looking for where the orthogonal least squares best fit line and plane of the data. The sums of squares for that line and plane can be written in terms of covariance matrix.The connections between them can be worked out to get the Eigen vectors of this covariance matrix.
  
Julius Bier Kirkegaard Julius Bier Kirkegaardphysics, computers, 'n' stuff
4 upvotes by David Joyce (Professor of Mathematics at Clark University), Andrei Kucharavy (PhD student in Bioinformatics), Martin Andrews, and Laasya Alamuru
 
Finding the eigenvectors a covariance matrix is exactly the technique of Principal Component Analysis (PCA).

The eigenvectors are those variables that are  linearly uncorrelated.
  
 
 
Write an answer
 

转载于:https://www.cnblogs.com/yymn/p/4661725.html

1. To calculate the covariance matrix, we first need to calculate the mean values for x and y: mean_x = (2+5+6+8)/4 = 5.25 mean_y = (3+5+6+9)/4 = 5.75 Then, we calculate the deviations from the mean for each point: A: (2-5.25, 3-5.75) = (-3.25, -2.75) B: (5-5.25, 5-5.75) = (-0.25, -0.75) C: (6-5.25, 6-5.75) = (0.75, 0.25) D: (8-5.25, 9-5.75) = (2.75, 3.25) Using these deviations, we can calculate the covariance matrix: | var(x) cov(x,y) | Cov = | cov(x,y) var(y) | where var(x) = sum((xi - mean_x)^2)/n var(y) = sum((yi - mean_y)^2)/n cov(x,y) = sum((xi - mean_x)*(yi - mean_y))/n Plugging in the values, we get: var(x) = (3.25^2 + 0.25^2 + 0.75^2 + 2.75^2)/4 = 4.1875 var(y) = (2.75^2 + 0.75^2 + 0.25^2 + 3.25^2)/4 = 4.1875 cov(x,y) = (-3.25*-2.75 + -0.25*-0.75 + 0.75*0.25 + 2.75*3.25)/4 = 3.9375 So the covariance matrix is: | 4.1875 3.9375 | Cov = | 3.9375 4.1875 | 2. To calculate the eigenvalues and eigenvectors of the covariance matrix, we first need to solve for the characteristic equation: | 4.1875-lambda 3.9375 | | x | | 0 | | 3.9375 4.1875-lambda | * | y | = | 0 | Expanding the determinant, we get: (4.1875-lambda)^2 - 3.9375^2 = 0 Solving for lambda, we get lambda1 = 8.375 and lambda2 = 0 For lambda1 = 8.375, we need to solve for the eigenvector: (4.1875-8.375)x + 3.9375y = 0 3.9375x + (4.1875-8.375)y = 0 Simplifying, we get: -4.188x + 3.938y = 0 3.938x - 4.188y = 0 This system has infinitely many solutions, but we can choose any non-zero vector that satisfies it. One such solution is (1, 1), so the corresponding eigenvector is: v1 = (1, 1) For lambda2 = 0, we similarly get: (4.1875-0)x + 3.9375y = 0 3.9375x + (4.1875-0)y = 0 Simplifying, we get: 4.188x + 3.938y = 0 3.938x + 4.188y = 0 This system has a unique solution (x=0, y=0), which means that there is only one linearly independent eigenvector for lambda2. We can choose any non-zero vector that is orthogonal to v1, such as (-1, 1), so the corresponding eigenvector is: v2 = (-1, 1) Therefore, the eigenvalues and eigenvectors of the covariance matrix are: lambda1 = 8.375, v1 = (1, 1) lambda2 = 0, v2 = (-1, 1)
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值