[R] Minimizing mahalanobis distance to negative orthant

Prof Brian Ripley ripley at stats.ox.ac.uk
Thu Jan 19 13:10:26 CET 2006

On Thu, 19 Jan 2006, DED (David George Edwards) wrote:

> I have the following problem: given x (px1) and S (pXp positive 
> definite), find y such that y_i<=0 (i=1..p) minimizing the mahalanobis 
> distance (x-y)'S^{-1}(x-y).
> Has anyone worked on this problem? Tips or R code would be appreciated.

If I read this correctly (some spaces would help) you want

y such that y <= 0 and y minimizes (x-y)'Q(x-y) for a symmetric pos def Q.

That is a quadratic program, so see package quadprog.

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

More information about the R-help mailing list