[R] Distances between two datasets of x and y co-ordinates

Rolf Turner r.turner at auckland.ac.nz
Thu Mar 18 05:11:38 CET 2010


On 18/03/2010, at 12:25 PM, Tom_R wrote:

> 
> Hi,
> How do I  use nncross to measure min distances between point patterns i,j,
> ENSURING each point in pattern i is only connected to a single partner 
> point  in pattern j ?
> I do realise that there are many possible pairings between the i-j point
> pairs... perhaps some average min distance for many pairings would be
> better.   Alternatively pairings could be randomly assigned. 
> 
> Basically, i am tracking a population of moving objects over time, and want
> to indirectly estimate the collective movement- which might be better
> estimated by telling nncross to randomly assign (somehow) paired nearest
> neighbour distances ; 1-to-1 rather than  many-to-one.

This is a question about the spatstat package and as such should be directed
to the maintainers of the package, rather than the list.  (Unless a response
cannot be evoked from the maintainers.)  See the Posting Guide.

Having said that --- I'm afraid that I don't understand your question.

If you do

	nncross(X,Y)

where X and Y are point patterns (``i'' and ``j'' suggest indices and as such
are not good names for point patterns) you get a vector of distances which are
the distances from each x in X to its nearest neighbour in Y.  Thus you get
the minimal distance from each x in X to the pattern Y.  There are no multiple
pairings to worry about. If you *want* all possible distances you could use
crossdist() --- and then average these distances by using apply() on the
result.

If this doesn't answer your question, can you please clarify your question?

	cheers,

		Rolf Turner
######################################################################
Attention: 
This e-mail message is privileged and confidential. If you are not the 
intended recipient please delete the message and notify the sender. 
Any views or opinions presented are solely those of the author.

This e-mail has been scanned and cleared by MailMarshal 
www.marshalsoftware.com
######################################################################



More information about the R-help mailing list