[R-sig-Geo] Help w/ transposed matrix indices for "owin" object with quadrat.test

Robin W Hunnewell rhunne at mac.com
Tue May 17 19:21:14 CEST 2011


Dear R-sig Geo people,
I've run a quadrat.test on a "ppp" object, for which the obs. window "owin" is a convex polygon:

> summary(my.ppp)
Planar point pattern: 660 points
Average intensity 0.461 points per square kilometer  

Window: polygonal boundary
single connected closed polygon with 41 vertices
enclosing rectangle: [-7420.406, -7373.856]x[5451.656, 5506.241]kilometer
Window area =  1432.66 square kilometer 
Unit of length: 1 kilometer 


After running the test,
> M <- quadrat.test(my.ppp, nx= 2, ny= 2) 

and then printing / plotting M, an object of class "quadrattest" "htest", the returned value is plotted as levels (colored tiles) of a pixel image:

>Chi-squared test of CSR using quadrat counts 
data: my.ppp 
X-squared = 89.6415, df = 3, p-value < 2.2e-16 
Quadrats: 4 tiles (levels of a pixel image)


why the pixellation?  From what I can gather, it has to do with the row / column matrix indices of my "owin" -- when typing  str(M), there's a warning in the digest referring to the window: "Transpose matrices to get the standard presentation in R" "Example: image(result$xcol,result$yrow,t(result$d))" 
Here is that section with the warning:

>str(M)

 .. ..$ window:List of 11
  .. .. ..$ type    : chr "mask"
  .. .. ..$ xrange  : num [1:2] -7420 -7374
  . .. ..$ yrange  : num [1:2] 5452 5506
  .. .. ..$ dim     : int [1:2] 100 100
  .. .. ..$ xstep   : num 0.465
  .. .. ..$ ystep   : num 0.546
  .. .. ..$ warnings: chr [1:3] "Row index corresponds to increasing y coordinate; column to increasing x" "Transpose matrices to get the standard presentation in R" "Example: image(result$xcol,result$yrow,t(result$d))"
  .. .. ..$ xcol    : num [1:100] -7420 -7420 -7419 -7419 -7418 ...
  .. .. ..$ yrow    : num [1:100] 5452 5452 5453 5454 5454 ...
  .. .. ..$ m       : logi [1:100, 1:100] FALSE FALSE FALSE FALSE FALSE FALSE ...
  .. .. ..$ units   :List of 3
  .. .. .. ..$ singular  : chr "kilometer"
  . .. .. ..$ plural    : chr "kilometer"
  .. .. .. ..$ multiplier: num 1
  .. .. .. ..- attr(*, "class")= chr "units"
  .. . ..- attr(*, "class")= chr "owin"


I understand for "im" objects in {spatstat}, the correspondence between matrix indices mat[i,j] and cartesian coordinates is: rows correspond to the y coordinate, and the columns to the x coordinate. 

But guess I'm just not sure whether and if the row / column index for my "owin" object needs to be transposed, or if this is something to worry about at all. 
I'd created the "owin" by importing it from .shp file (readShapePoly) and then used  as(W,"owin"). Is it a problem to do it that way?
 
Thanks v much for any clarification, and how to 'fix' if necessary?
Robin

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://stat.ethz.ch/pipermail/r-sig-geo/attachments/20110517/d69c0b4e/attachment.html>


More information about the R-sig-Geo mailing list