[R-sig-Geo] quadracount on multitype points

Marcelino de la Cruz Rot marcelino.delacruz at urjc.es
Wed Sep 13 11:04:54 CEST 2017


Hi Guy,
I only like real pies :-) but, what about something like this:


library(spatstat)
data(lansing)
qs<- quadratcount(split(lansing))
dqs <- dim(qs[[1]])
nr <- dqs[1]
nc <- dqs[2]
le <- length(qs[[1]])
m<- matrix( 1:le, nr=nr, nc=nc, byrow=T)
layout(m, heights=rep(1,nr), widths=rep(1,nc))
#layout.show(25)
par(mar=c(0,0,0,0))
for (i in 1:nc){
    for (j in 1:nr){
      pie(sapply(qs, function(x) x[i,j]), labels=NA )
      box()
  }
}

Cheers,
Marcelino




El 13/09/2017 a las 10:21, Ege Rubak escribió:
> Hi Guy,
>
> Maybe your explorative analysis could also benefit from `relrisk` in 
> case you don't know that function?
>
> It basically gives you a list of smooth images (one for each type) of 
> the probability that a hypothetical sample at that location is of a 
> given type. E.g. for the built-in multitype point pattern dataset 
> `lansing` you would do:
>
>     library(spatstat)
>     prob <- relrisk(lansing, diggle=TRUE)
>     plot(prob)
>
> This example and more (e.g. a division of the sampling area into 
> subsets of dominant types) can be found in Chapter 14 of our "spatstat 
> book" if you need more details (sorry about the shameless self 
> promotion, but I don't know a better source for this :-)).
>
> Kind regards,
> Ege
>
> On 09/13/2017 01:08 AM, Guy Bayegnak wrote:
>> Thanks a lot for your response and suggestion Rolf.  Yes, by 
>> "quadrant" I mean the little sub-windows.  My problem is the following:
>>
>> We have collected thousands of groundwater samples across a vast 
>> area, and analysed them. Based on the analysis we are able to assign 
>> a "type" to each water sample.  When plotted, there seems to be a 
>> spatial trend in water type. But a given area may have more than one 
>> water type,  usually with a dominant type (most frequently 
>> occurring). What I am trying to do is identify the dominant type for 
>> each sub-region /sub-windows but show the count side by side, for 
>> example:
>>
>>            x
>>   y         [0,0.801)            [0.801,1.6]
>>    [0.5,1]   Off =     36                Off =  6
>>             On =   3     On = 39
>>
>>     [0,0.5)   Off =  4              Off = 36
>>              On = 42        On = 6
>>
>> I think I can achieve what I am looking for with your suggestion. 
>> Once I get the table list, I will copy the numbers side by side 
>> manually.
>>
>> Sincerely,
>>
>> Guy
>>
>> -----Original Message-----
>> From: Rolf Turner [mailto:r.turner at auckland.ac.nz]
>> Sent: September 12, 2017 3:45 PM
>> To: Guy Bayegnak <Guy.Bayegnak at gov.ab.ca>
>> Cc: r-sig-geo at r-project.org; Adrian.Baddeley at curtin.edu.au; Ege Rubak 
>> <rubak at math.aau.dk>
>> Subject: Re: [R-sig-Geo] quadracount on multitype points
>>
>>
>> On 13/09/17 02:11, Guy Bayegnak wrote:
>>
>>> Dear all,
>>>
>>> I am working on a multitype point pattern, and I'd like to estimate
>>> how many of each type of point occurs into each quadrant. I know it is
>>> possible to use the quandracount on split marks as follows using
>>> spatstats: quadratcount(split(marks)). But the result produces as many
>>> windows as they are marks. I am wondering is there is a way to know
>>> many occurrence of each type there is per quadrant and to plot it in a
>>> single grid.
>>>
>>> Thanks.
>>
>> You really should start by mentioning that you are dealing with the 
>> spatstat package.
>>
>> It's not clear to me what you are after.  A minimal reproducible 
>> example would be helpful.  I presume that by "quadrant" you mean one 
>> of the four equal sub-windows formed by bisecting your (rectangular) 
>> window vertically and horizontally.
>>
>> If my presumption is correct then perhaps
>>
>>       lapply(split(X),quadratcount,nx=2)
>>
>> (where "X" is your point pattern) does what you want.  E.g.:
>>
>>> lapply(split(amacrine),quadratcount,nx=2)
>>> $off
>>>           x
>>> y         [0,0.801) [0.801,1.6]
>>>    [0.5,1]        36          36
>>>    [0,0.5)        34          36
>>>
>>> $on
>>>           x
>>> y         [0,0.801) [0.801,1.6]
>>>    [0.5,1]        35          39
>>>    [0,0.5)        42          36
>>
>> Is this something like what you wish to achieve?
>>
>> cheers,
>>
>> Rolf Turner
>>
>> -- 
>> Technical Editor ANZJS
>> Department of Statistics
>> University of Auckland
>> Phone: +64-9-373-7599 ext. 88276
>> This email and any files transmitted with it are confi...{{dropped:3}}
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
> .
>

-- 
Marcelino de la Cruz Rot
Depto. de Biología y Geología
Física y Química Inorgánica
Universidad Rey Juan Carlos
Móstoles España



More information about the R-sig-Geo mailing list