Skip to content
Prev 13798 / 15274 Next

Time-Varying Cointegration in R

Johannes

Ordering complex numbers is not obvious, so one likely thing would be 
that you have the same result but in a different order. If the 
eigenvalues are the same, only the vectors are different, it is a 
normalization issue. If it is not that, then verify that you are 
calculating eigenvalues with the same matrix in both systems. A matrix 
that has several orders of magnitude difference between the largest and 
smallest eigenvalues (in abs value) will be ill-conditioned, in which 
case the result can differ a lot based on seemingly small differences in 
the matrix. You can verify if this is a problem by copy and paste of 
exactly the same matrix into both systems. (Round to a reasonable number 
of digits and truncate the rest.)

BTW, if ill-conditioning is the problem, and the results depend 
critically on this calculation, there is a problem with the technique.

If those are not the problem, then you might consider checking which 
result is correct. This problem does have an answer that can be 
verified.  From ?eigen

    If ?r <- eigen(A)?, and ?V <- r$vectors; lam <- r$values?, then

                               A = V Lmbd V^(-1)

      (up to numerical fuzz), where Lmbd =?diag(lam)?.

Please let us know if R is getting an incorrect result. It seems highly 
unlikely, but it might affect a lot of calculations.

HTH,
Paul
On 03/22/2016 05:14 AM, Johannes Lips wrote: