Page 1 of 1
Canonical Correlation
Posted: Wed Dec 26, 2007 1:30 pm
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.
Posted: Tue Jan 22, 2008 5:53 pm
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
Posted: Tue Mar 25, 2008 10:26 am
by TomDoan
There's a new procedure on the RATS Procedures forum for doing general canonical correlations.