# Test the relationship between two point patterns

I have two point patterns obtained from medical images. Points are used to represent cell markers. By visualization, the point pattern A is extremely possible to be a subset of point pattern B. So is there any statistical package or function in R that I can use to verify my guess?  • Is your hypothesis that the two point patterns are realisations of the same process, or that the points of A are a subset of the points of B? That is for every point A there is a point at that exact location in B? – Spacedman Jun 10 at 20:42
• It works like this: there is a tumor, and all cells within the tumor are dyed with two types of stains separately and gives two images. What I did is extract stained cells for both two images, and recorded the cell coordinates, and use points to represent the cells. So that I got two point patterns. Due to the size of two images and segmentation algorithm, even though one cell could be dyed with two stains, they are not necessarily have the same coordinates for two images, but similar. – Shawn Jun 11 at 2:30
• Here is a forestry based example: gis.stackexchange.com/a/44946/8104. – Aaron Jun 11 at 3:34
• "How similar?" is the important question. You can then reject your subset hypothesis if there exists any point in A that is further than that "similarity distance" from any point in B, (which is a standard nearest-neighbour query). If your cells are 90-110 units wide and your two points representing the cell centres are typically 10-15 units apart then test for a near neighbour > 60 should be specific and sensitive enough. Hard to tell without a picture or your own insight, it also depends on the shape and size distribution of the cells... – Spacedman Jun 11 at 6:48
• For two sets of points stored in 2-column matrices, `max(splancs::nndistF(p1, p2))` returns the furthest distance of a point in `p1` from any point in `p2`. So if a `p1` point is so far from a `p2` point that its unlikely to be referring to the same cell then it can't be a subset of `p2`. – Spacedman Jun 11 at 7:31