On 7/03/2009, at 2:59 AM, Ricardo Perrone wrote:


Hi,

i am using spatstat package for spatial data analysis and now i have a problem to create a point pattern. The points are in file "points.txt" (first column for Latitude and second column for Longitude ) and I imported them and separated each columns in two arrays x and y. If I plots x and y ( e.g plot(x,y) ) the result appears in square area without problems and the scale is adequate to visual analysis of points ploted. But if i try to use ppp function to create a point pattern the result appears in rectangle area with a poor scale, dificulting in this case the analysis of the points. I think that is probably because of xrange and yrange parameter of ppp function, that was calculated based on max and min values of both x and y, but i am not sure:

latitude <- dataset$V2
longitude <- dataset$V3
xrange <-c(min(longitude), max(longitude))
yrange <-c(min(latitude), max(latitude))

area <- ppp(longitude/10000, latitude/100000, xrange, yrange) /* there are 181 point in file */ plot(longitude, latitude) / * square area of visualisation has an adequate scale to analysis */ plot(area) /* poor rectangle area of visualisation showing point too concentrated and hiding details - possible hot spots */


Is there a way of automatically define the size of window parameter (owin object) in ppp function from dataset of points? How can i scale the window without problems like: "warning message: 181 points were rejected as lying outside the specified window"


In the first instance questions about contributed packages should be sent to the maintainer(s)
of the packages, not to the r-rhelp list.

The function which plots spatial point patterns in spatstat is designed to maintain an aspect ratio equal to ***one***. This is so that lines which appear to be orthogonal
to each other actually are orthogonal to each other, and vice versa.

It would generally be bad policy --- visually misleading --- to have any other aspect
ratio.

You can force a bad aspect ratio on your plot by pre-plotting a null plot with the bad aspect ratio and then plotting the point pattern using ``add=TRUE''. E.g.:

plot(xrange,yrange,type="n",ann=FALSE,axes=FALSE)
box()
plot(area,add=TRUE)

THIS IS NOT RECOMMENDED HOWEVER.

It distorts the pattern and gives a misleading visual impression of the data.

You appear to have tried to rescale your data, dividing longitude by 10,000 and lattitude by 100,000. But you used xrange and yrange determined from the orginal, unscaled, variables to specify the observation window. This will surely
produce an unreadable plot.

You probably want to do something like:

latitude <- dataset$V2/100000
longitude <- dataset$V3/10000
xrange <-c(min(longitude), max(longitude))
yrange <-c(min(latitude), max(latitude))

area <- ppp(longitude, latitude, xrange, yrange)

This is STILL NOT ADVISABLE since it distorts the aspect ratio by a factor
of 10 (and is thus again visually misleading).

Finally, you are letting the data determine the observation window. This is almost never a good idea. The window of a point pattern should be specified
as the region in which points were *looked for*.  Remember:

        There is information in where the points ***aren't***
        as well as in where they are.

        cheers,

                Rolf Turner


######################################################################
Attention:\ This e-mail message is privileged and confid...{{dropped:9}}

______________________________________________
R-help@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.

Reply via email to