[R] reversing distance matrix for original values

David L Carlson dcarlson at tamu.edu
Wed Nov 14 16:14:46 CET 2012


You might reconstruct the values if you have some of the original data.
Metric multidimensional scaling (cmdscale) will give you a set of values
that produces your distance matrix. If it is based on a single voltage, you
only have one dimension to reconstruct. There are an infinite number of sets
of values that will produce your distance matrix, but all of them differ by
one constant value added to the vector so you must know the voltage of at
least one observation to get back to the original values. See the example
below:

> vals
 [1]  1  2  3  4  5  6  7  8  9 10
> out <- cmdscale(dist(vals))
> out 
      [,1]          [,2]
 [1,] -4.5  1.793550e-07
 [2,] -3.5 -4.537897e-08
 [3,] -2.5 -3.241355e-08
 [4,] -1.5 -1.944813e-08
 [5,] -0.5 -6.482710e-09
 [6,]  0.5  6.482710e-09
 [7,]  1.5  1.944813e-08
 [8,]  2.5  3.241355e-08
 [9,]  3.5  4.537897e-08
[10,]  4.5  5.834439e-08
> out[,1] +  1-out[1,1]
 [1]  1  2  3  4  5  6  7  8  9 10

If the distance matrix is based on more than one variable, you would need to
know at least as many of the original observations as variables.

----------------------------------------------
David L Carlson
Associate Professor of Anthropology
Texas A&M University
College Station, TX 77843-4352

> -----Original Message-----
> From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-
> project.org] On Behalf Of Prof Brian Ripley
> Sent: Wednesday, November 14, 2012 8:48 AM
> To: eliza botto
> Cc: r-help at r-project.org
> Subject: Re: [R] reversing distance matrix for original values
> 
> On 14/11/2012 14:33, eliza botto wrote:
> >
> > dear useRs,
> > i created a distance matrix, of certain voltage values.
> unfortunately, i lost the original values. i am only left with the
> distance matrix that i created from those values. i wanted to ask that
> is there a way in R to reverse distance matrix for the original values?
> 
> Partially: see ?cmdscale.  Distances contain no information on
> location,
> rotations or reflections.
> 
> > thanks in advance
> > eliza
> > 	[[alternative HTML version deleted]]
> >
> > ______________________________________________
> > R-help at r-project.org mailing list
> > https://stat.ethz.ch/mailman/listinfo/r-help
> > PLEASE do read the posting guide http://www.R-project.org/posting-
> guide.html
> > and provide commented, minimal, self-contained, reproducible code.
> >
> 
> 
> --
> 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
> 
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-
> guide.html
> and provide commented, minimal, self-contained, reproducible code.




More information about the R-help mailing list