[Rd] Additional output in cancor

Jonathan Rougier J.C.Rougier@durham.ac.uk
Mon, 11 Jun 2001 09:21:37 +0100


Hi everyone,

Can I suggest an additional output component in cancor, from package
mva?  It would be useful to have the number of canonical correlation
vectors, equivalently the rank of the covariance between x and y (label
"rank").  This would usually be min(dx, dy), where dx and dy have
already been computed for the svd function, but there might be
situations where it was less than this, so I guess the safe option would
be to include

	rank = qr(t(x) %*% y)$rank

among the outputs.  Then the last four lines of the help might be
amended to

     rk <- cxy$rank
     all.equal(cor(x %*% cxy$xcoef[, 1:rk, drop=FALSE],
       y %*% cxy$ycoef[, 1:rk, drop=FALSE]), diag(cxy$cor))
     all.equal(cor(x %*% cxy$xcoef[, 1:rk, drop=FALSE]), diag(1, rk))
     all.equal(cor(y %*% cxy$ycoef[, 1:rk, drop=FALSE]), diag(1, rk))

which I think is more intuitive.

More radically, the xcoef and ycoef components of cancor might
themselves be restricted to the appropriate columns (1:rank).  This
might affect some existing code, although any code that uses the
non-informative columns has got to be broken, hasn't it?!

Can I also suggest an extra reference for the help page:

	Mardia, K. V., J. T. Kent and J. M. Bibby (1979).  Multivariate 		
Analysis, London, Academic Press Ltd, ch. 10.

Cheers, Jonathan.

-- 
Jonathan Rougier                       Science Laboratories
Department of Mathematical Sciences    South Road
University of Durham                   Durham DH1 3LE
tel: +44 (0)191 374 2361, fax: +44 (0)191 374 7388
http://www.maths.dur.ac.uk/stats/people/jcr/jcr.html
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-devel-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._