Canonical Correlation

Econometrics questions and discussions
atrad

Canonical Correlation

Unread post by atrad »

I'm trying to do canonical correlation analysis in RATS. If anyone has a piece of code that allows me to implement this procedure, I'd be grateful if they could post it on this site.
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Unread post by TomDoan »

Actually, the Johansen MLE procedure for estimating cointegrating vectors is an application of canonical correlations (of the first differences on the lag levels after eliminating short-term components). If S is the grand covariance matrix of the Y,X variables, then the following (which has been stripped from the JOHMLE procedure) computes the canonical vectors as the columns of eigvec.

compute %%s00=%xsubmat(s, 1,numvar, 1,numvar)
compute %%s11=%xsubmat(s,numvar+1,sweepv,numvar+1,sweepv)
compute %%s01=%xsubmat(s, 1,numvar,numvar+1,sweepv)
*
* Compute the generalized eigenvalues and vectors
*
compute s10_00_01=tr(%%s01)*inv(%%s00)*%%s01
eigen(general=%%s11) s10_00_01 eigval eigvec
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Unread post by TomDoan »

There's a new procedure on the RATS Procedures forum for doing general canonical correlations.
Post Reply