[R] different results in MASS's mca and SAS's corresp

Gavin Simpson gavin.simpson at ucl.ac.uk
Mon Feb 7 11:10:12 CET 2011


On Sat, 2011-02-05 at 23:39 -0600, Paul Johnson wrote:
> On Sat, Feb 5, 2011 at 9:19 AM, David Winsemius <dwinsemius at comcast.net> wrote:
<snip />
> > cbind(scalermca[,1] * 0.827094, scalermca[,2] *  -0.7644828)
>           [,1]        [,2]
> 1   1.06070017 -0.81549999
> 2   0.77057891  0.63456780
> 3   1.07031764 -1.30675217
> 4   1.07031764 -1.30675217
> 5   0.23075886  0.90002547
> 6   0.69488883  0.60993995
> 7   0.10530240  0.78445402
> 8  -0.27026650  0.44225049
> 9   0.13426089  1.15670532
> 10  0.11861965  0.64778456
> 11  0.23807570  1.21775202
> 12  1.01156703 -0.01927226
> 13  0.28051938 -0.59805897
> 14 -1.17343686 -0.27122981
> 15 -0.83838041 -0.64003061
> 16 -0.05453708 -0.22925816
> 17 -0.91732401 -0.49899374
> 18 -0.92694148 -0.00774156
> 19 -1.30251038 -0.34994509
> 20 -1.30251038 -0.34994509
> 
> So, that does reproduce SAS exactly.  And I'm a little frustrated I
> can't remember the matrix command to get that multiplication done
> without cbinding the 2 columns together that way.

You might have been thinking of sweep():

sweep(scalermca[,1:2], 2, c(0.827094,-0.7644828), "*")

<snip/>

HTH

G
-- 
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
 Dr. Gavin Simpson             [t] +44 (0)20 7679 0522
 ECRC, UCL Geography,          [f] +44 (0)20 7679 0565
 Pearson Building,             [e] gavin.simpsonATNOSPAMucl.ac.uk
 Gower Street, London          [w] http://www.ucl.ac.uk/~ucfagls/
 UK. WC1E 6BT.                 [w] http://www.freshwaters.org.uk
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%



More information about the R-help mailing list