From kjetil at acelerate.com  Mon Apr 11 03:16:47 2005
From: kjetil at acelerate.com (Kjetil Brinchmann Halvorsen)
Date: Mon Apr 11 11:39:35 2005
Subject: [Rd] cancor bug
Message-ID: <4259CFFF.4080405@acelerate.com>

I think the following is a bug in cancor. When one of the inputs
are rank deficient, the output loses dimensions.

Look at the following taken from example(cancor):

 > pop <- LifeCycleSavings[, 2:3]
 > oec <- LifeCycleSavings[, -(2:3)]
 > cancor(pop, oec)
$cor
[1] 0.8247966 0.3652762

$xcoef
              [,1]        [,2]
pop15 -0.009110856 -0.03622206
pop75  0.048647514 -0.26031158

$ycoef
             [,1]           [,2]            [,3]
sr   0.0084710221  0.03337935588 -0.005157129776
dpi  0.0001307398 -0.00007588232  0.000004543705
ddpi 0.0041706000 -0.01226789642  0.051883236069

$xcenter
  pop15   pop75
35.0896  2.2930

$ycenter
       sr       dpi      ddpi
   9.6710 1106.7584    3.7576

 > pop <- sweep(pop, 1, apply(pop, 1, sum), "/") # artificially 
constructing rank-deficient data.
 > cancor(pop, oec)
$cor
[1] 0.8184737

$xcoef
           [,1]
pop15 -2.818801

$ycoef
             [,1]           [,2]           [,3]
sr   0.0065719475  0.03128130402 -0.01381394682
dpi  0.0001349168 -0.00006333436  0.00002564945
ddpi 0.0036178800  0.00226518493  0.05330614649

$xcenter
     pop15      pop75
0.92893618 0.07106382

$ycenter
       sr       dpi      ddpi
   9.6710 1106.7584    3.7576

 >

Look at xcoef: The coefficient for pop75 is mising. (I encountered this
programming reduced rank regression).

Kjetil

-- 

Kjetil Halvorsen.

Peace is the most effective weapon of mass construction.
               --  Mahdi Elmandjra





-- 
No virus found in this outgoing message.
Checked by AVG Anti-Virus.


[Rd] cancor bug
Kjetil Brinchmann Halvorsen