Eigenvalues/Eigenvectors

Econometrics questions and discussions
atrad

Eigenvalues/Eigenvectors

Unread post by atrad »

I would like to obtain eigenvalues and eigenvectors of a complex matrix using RATS version 6.1. Is there a RATS function like eigen for real matrices that can do such a decomposition for complex matrices? The RATS 6.1 reference manual has a function %cxeigdecomp(z). Could someone tell me if this is the function I am looking for?

Additionally, would anyone know if a RATS procedure exists for the dynamic PCA estimates of the Forni, Hallin, Lippi, Reichlin (FHLR) dynamic factor model.

Thanks.
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Unread post by TomDoan »

For a Hermitian matrix (which is what you get when you do a multivariate spectral density), the %CXSVD function will give you the eigen decomposition. The 1st and 3rd components will be equal and are the column eigenvectors and the 2nd component will be the vector of eigenvalues (though it will actually be stored as an Nx1 complex matrix).
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Unread post by TomDoan »

This is a (not very polished) bivariate example of the frequency domain PC analysis. I'm surprised that Forni, et al do the filtering in the time domain - the results should be effectively the same either way.

Code: Select all

open data "c:\rats\candata.rat"
calendar 1961 1 12
all 1999:02
data(format=rats) / canrgdps usargdps
*
set lcan = log(canrgdps/canrgdps{1})
set lusa = log(usargdps/usargdps{1})
*
freq 15 4*%freqsize(1999:2)
*
rtoc
# lcan lusa
# 1 2
fft 1 / 3
fft 2 / 4
cmult(scale=1.0/(2*%pi*%nobs)) 3 3 / 5
cmult(scale=1.0/(2*%pi*%nobs)) 3 4 / 6
cmult(scale=1.0/(2*%pi*%nobs)) 4 4 / 7
window(type=flat,width=15) 5
window(type=flat,width=15) 6
window(type=flat,width=15) 7
*

dec series[cmatrix] spectmat pcmatz
gset spectmat 1 2048 = ||%z(t,5),%conjg(%z(t,6))|%z(t,6),%z(t,7)||
gset pcmatz 1 2048 = %cxsvd(spectmat(t))(1)
dec series[cvector] pcfitz
gset pcfitz 1 2048 = %cxadj(pcmatz)*||%z(t,3)|%z(t,4)||
cset 8 1 2048 = pcfitz(t)(1)
cprint 1 100 1 2 8
graph 2
# lcan
# lusa
set factor 1 500 = %real(%z(t,8))
graph
# factor 1 1999:2
graph 3
# lcan
# lusa
# factor 1 1999:2
set factor 1 1999:2 = -factor
Post Reply