Prof Brian Ripley ripley at stats.ox.ac.uk
Tue Nov 30 09:35:17 CET 2004

```On Tue, 30 Nov 2004, yan zhao wrote:

> Hello,
> I'm a beginning user of R, now I have a question about canonical correlation
> analysis (cca). In R,there is a function "cancor.R" used for cca; For example

There is no such function in R, and I can't find it in any add-on package.
Do you mean the function cancor() in the stats package?

> X(n*p1) and Y(n*p2)are the two matrix to be analyzed. In the example given by
> R, when n> max(p1,n2), cancor(X,Y) works; but when n<p1 or n<p2, cancor(X,Y)
> doesn't work well because cancor\$cor == 1; how to cope with this case? maybe
> before apply the two matrix to cancor.R, some time-space transformation
> should be done? could you give some suggestion? Thanks you in advance!

You need to understand the underlying theory: the problem is not with the
function but your use of the technique.  Assuming non-degenerate matrices,
you have a situation in which one of the matrices spans the entire space
of observations and so imposes no restriction.

R help pages come with references: please consult them.  Since you have
not told us why you are using CCA, we can't help you with the
methodological questions, even if they are off topic for the R-help list.

--
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

```