rplotcoordinatesspatstatr-ppp

how to set the ranges of coordinates X & Y for observation window geometry in spatstat package in R


Hi? I have a data of seedlings distribution which contains species types, X and Y coordinates in UTM. I want to create a point pattern by their X & Y coordinate location with the help of ppp() function in spatstat package. I tried it with following 2 ways:

 p.patt <- ppp(mydata$X, mydata$Y)
 p.patt <- ppp(mydata$X, mydata$Y, owin(c(100,131), c(100,130)))

But there is a “Warning message: 435 points were rejected as lying outside the specified window” for both of them.

I guess this is related to ranges of X and Y coordinates that should be specified in this code in c(…), c(…). I checked the range of X &Y and R gave me following ranges:

for X: 368615 and 368746, 
for Y: 4587355 and 4587485 

When I plot the data, a shape of the plot looks like "tilted rombo". I don't know if it is help.

Here I have just randomly chosen tried some numbers: 100 & 131 & 130. I couldn’t find any information how to set them online.

So my question is how I can use these ranges of coordinates to set observation window geometry of point patterm in spatstat package in R?.

Thank you very much in advance!


Solution

  • The numbers in the owin call are not the width and height of the window; they are the X and Y coordinates of the corners of the window.

    Since the range of X coordinate values of the data points is from 368615 to 368746, the window needs to contain this range, at least. Similarly the range of Y values must be contained in the window. The minimal window that will not give a warning is

    p.patt <- ppp(mydata$X, mydata$Y, owin(c(368615,368746), c(4587355,4587485)))
    

    or equivalently

    p.patt <- ppp(mydata$X, mydata$Y, c(368615,368746), c(4587355,4587485))
    

    But this is just the minimal window that is acceptable; for a proper analysis, you need information about the survey region. If it is not a rectangle then, as Ege says, you need to specify owin(poly=...) using the coordinate locations of the vertices of the polygon.