[R] r: eviews and r // eigen analysis
Clark Allan
Allan at STATS.uct.ac.za
Mon Mar 14 11:59:45 CET 2005
hi all
i have a question that about the eigen analysis found in R and in
eviews.
i used the same data set in the two packages and found different
answers. which is incorrect?
the data is:
aa ( a correlation matrix)
1 0.9801 0.9801 0.9801 0.9801
0.9801 1 0.9801 0.9801 0.9801
0.9801 0.9801 1 0.9801 0.9801
0.9801 0.9801 0.9801 1 0.9801
0.9801 0.9801 0.9801 0.9801 1
now
> svd(aa)
$d
[1] 4.9204 0.0199 0.0199 0.0199 0.0199
$u
[,1] [,2] [,3] [,4] [,5]
[1,] -0.4472136 9.283999e-18 1.939587e-17 -2.101554e-15 0.8944272
[2,] -0.4472136 8.089763e-01 7.115435e-17 3.091235e-01 -0.2236068
[3,] -0.4472136 2.178563e-02 8.226578e-18 -8.657513e-01 -0.2236068
[4,] -0.4472136 -4.153810e-01 -7.071068e-01 2.783139e-01 -0.2236068
[5,] -0.4472136 -4.153810e-01 7.071068e-01 2.783139e-01 -0.2236068
$v
[,1] [,2] [,3] [,4] [,5]
[1,] -0.4472136 0.00000000 0.000000e+00 0.0000000 0.8944272
[2,] -0.4472136 0.80897632 -4.976488e-17 0.3091235 -0.2236068
[3,] -0.4472136 0.02178563 1.077421e-17 -0.8657513 -0.2236068
[4,] -0.4472136 -0.41538097 -7.071068e-01 0.2783139 -0.2236068
[5,] -0.4472136 -0.41538097 7.071068e-01 0.2783139 -0.2236068
the results from Eviews is:
eigenvectors = (note that Eviews arranges the eigen vectors in ascending
order of the size of the eigen values)
0.305963 -0.266024 -0.219066 -0.766569 0.447214
0.315257 -0.603871 0.075772 0.574640 0.447214
0.461958 0.726861 0.199385 0.136062 0.447214
-0.482609 0.185567 -0.700705 0.204124 0.447214
-0.600569 -0.042534 0.644614 -0.148258 0.447214
eigen values =
0.019900
0.019900
0.019900
0.019900
4.920400
NOTE THAT THE EIGEN VALUES ARE THE SAME BUT THE EIGEN VECTORS ARE NOT!!!
why is this so?
if one sets aa=
1.000000 0.500000 0.250000
0.500000 1.000000 0.350000
0.250000 0.350000 1.000000
then both packages give the same answers.
More information about the R-help
mailing list