[R] Oja median

Rahul-A.Agarwal at ubs.com Rahul-A.Agarwal at ubs.com
Mon Oct 13 07:10:29 CEST 2008


 i have tried the code.
 
The first function (which computes the Oja median) has a slight problem:
If you try four points that create a square centred at (2,2)
 
 oja.median(cbind(c(1,3,1,3),c(1,1,3,3)))
 
gives (-2,-2) instead of (2,2). Probably just a sign switch somewhere.
 
The second function seems to get the Oja median right but I don't
understand what it does when computing quantiles other than the median.
It seems to me (but I might be missing something!) that the ordering of
observations in the computation of the cofactors, i.e. how signs
alternate, should depend on an angle theta that is given as an input. In
Koenker's book (p. 274) this is obtained by sorting the bivariate
observations y(i), i=1,...,n, according to the quantity
y(i,1)cos(theta)+y(i,2)sin(theta). In the p>2 case I would expect to
provide p-1 angles to determine a direction in p dimensions. If I have
understood correctly, the code just follows the order in which the
observations are found in the original data matrix. 


Rahul Agarwal 



More information about the R-help mailing list