spatstat - user-supplied list of point patterns in envelope() error

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

spatstat - user-supplied list of point patterns in envelope() error

Joe Lewis
Dear list,

I'm trying to use a user-supplied list of point patterns in envelope()
rather than test against the CSR. Page 400 of Spatial Point Patterns:
Methodology and Applications in R states that "the argument simulate
can be a list of point patterns". However, I get the following error
when I try  to supply a list of ppp:

 ekls <- envelope.lpp(Y =  xx, fun = linearK, nsim=5, simulate = pp_list)
Error in envelopeEngine(X = X, fun = fun, simul = simrecipe, nsim = nsim,  :
  ‘simulate’ should be an expression, or a list of point patterns

for reference,

xx
Point pattern on linear network
680 points
Linear network with 22 vertices and 21 lines
Enclosing window: rectangle = [284086.69, 309740] x [709900, 726547.7] metres

class(xx)
[1] "lpp" "ppx"

pp_list
List of point patterns

Component 1:
Planar point pattern: 513 points
window: rectangle = [284086.69, 309740] x [709900, 726547.7] metres

Component 2:
Planar point pattern: 422 points
window: rectangle = [284086.69, 309740] x [709900, 726547.7] metres

Component 3:
Planar point pattern: 495 points
window: rectangle = [284086.69, 309740] x [709900, 726547.7] metres

Component 4:
Planar point pattern: 557 points
window: rectangle = [284086.69, 309740] x [709900, 726547.7] metres

Component 5:
Planar point pattern: 576 points
window: rectangle = [284086.69, 309740] x [709900, 726547.7] metres

class(pp_list)
[1] "ppplist" "solist"  "anylist" "listof"  "list"

Any ideas why the error is occurring? Thanks.

_______________________________________________
R-sig-Geo mailing list
[hidden email]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo
Reply | Threaded
Open this post in threaded view
|

Re: [FORGED] spatstat - user-supplied list of point patterns in envelope() error

Rolf Turner

On 12/08/19 8:51 AM, Joe Lewis wrote:

> Dear list,
>
> I'm trying to use a user-supplied list of point patterns in envelope()
> rather than test against the CSR. Page 400 of Spatial Point Patterns:
> Methodology and Applications in R states that "the argument simulate
> can be a list of point patterns". However, I get the following error
> when I try  to supply a list of ppp:
>
>   ekls <- envelope.lpp(Y =  xx, fun = linearK, nsim=5, simulate = pp_list)
> Error in envelopeEngine(X = X, fun = fun, simul = simrecipe, nsim = nsim,  :
>    ‘simulate’ should be an expression, or a list of point patterns
>
> for reference,
>
> xx
> Point pattern on linear network
> 680 points
> Linear network with 22 vertices and 21 lines
> Enclosing window: rectangle = [284086.69, 309740] x [709900, 726547.7] metres
>
> class(xx)
> [1] "lpp" "ppx"
>
> pp_list
> List of point patterns
>
> Component 1:
> Planar point pattern: 513 points
> window: rectangle = [284086.69, 309740] x [709900, 726547.7] metres
>
> Component 2:
> Planar point pattern: 422 points
> window: rectangle = [284086.69, 309740] x [709900, 726547.7] metres
>
> Component 3:
> Planar point pattern: 495 points
> window: rectangle = [284086.69, 309740] x [709900, 726547.7] metres
>
> Component 4:
> Planar point pattern: 557 points
> window: rectangle = [284086.69, 309740] x [709900, 726547.7] metres
>
> Component 5:
> Planar point pattern: 576 points
> window: rectangle = [284086.69, 309740] x [709900, 726547.7] metres
>
> class(pp_list)
> [1] "ppplist" "solist"  "anylist" "listof"  "list"
>
> Any ideas why the error is occurring? Thanks.

It's hard to say without having a *reproducible* example.  Since we
don't have access to "xx" or to "pp.list" we cannot experiment to see
what's going on.

One problem that leaps out at me --- although it doesn't seem that this
should trigger the error message that you received --- is that the
entries of pp_list appear to be *planar point patterns* (of class "ppp")
whereas "xx" is a pattern on a linear network (of class "lpp").
Consequently there is a fundamental incompatibility here.

However I don't see why you would get the error message that you did.  I
am CC-ing this email to Adrian Baddeley who has more insight than I, and
may be able to point you in the right direction.  Adrian is kind of
overwhelmed with work at the moment, so it may be a while till you hear
from him.

If you provide a reproducible example I *may* be able to help.

cheers,

Rolf Turner

--
Honorary Research Fellow
Department of Statistics
University of Auckland
Phone: +64-9-373-7599 ext. 88276

_______________________________________________
R-sig-Geo mailing list
[hidden email]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo
Reply | Threaded
Open this post in threaded view
|

Re: [FORGED] spatstat - user-supplied list of point patterns in envelope() error

Rolf Turner

Dear Joe,

Further to my previous response to your post:  I have now been in touch
with Adrian Baddeley and he has confirmed that the problem is as I
conjectured:   The patterns in "pp_list" need to be compatible with
"xx".  The error message was a bit misleading.  (Adrian has now adjusted
the error message so as to make it more clear what the problem actually is.)

However there was also a genuine bug (that was revealed by your
question; thank you!!!) in the software, so even if pp_list had been a
list of patterns of the appropriate type, you would still have got an
error.  (A spurious error, caused by the bug; different message of course.)

The bug has been been fixed in the development version of spatstat
(1.60-1.022).  You will need to install that from github:

library(remotes)
install_github('spatstat/spatstat')

or wait for the next "official release" of spatstat on CRAN.  Such
releases happen about every three months; the last one was on
23/June/2019.

cheers,

Rolf

> On 12/08/19 8:51 AM, Joe Lewis wrote:
>
>> Dear list,
>>
>> I'm trying to use a user-supplied list of point patterns in envelope()
>> rather than test against the CSR. Page 400 of Spatial Point Patterns:
>> Methodology and Applications in R states that "the argument simulate
>> can be a list of point patterns". However, I get the following error
>> when I try  to supply a list of ppp:
>>
>>   ekls <- envelope.lpp(Y =  xx, fun = linearK, nsim=5, simulate =
>> pp_list)
>> Error in envelopeEngine(X = X, fun = fun, simul = simrecipe, nsim =
>> nsim,  :
>>    ‘simulate’ should be an expression, or a list of point patterns
>>
>> for reference,
>>
>> xx
>> Point pattern on linear network
>> 680 points
>> Linear network with 22 vertices and 21 lines
>> Enclosing window: rectangle = [284086.69, 309740] x [709900, 726547.7]
>> metres
>>
>> class(xx)
>> [1] "lpp" "ppx"
>>
>> pp_list
>> List of point patterns
>>
>> Component 1:
>> Planar point pattern: 513 points
>> window: rectangle = [284086.69, 309740] x [709900, 726547.7] metres
>>
>> Component 2:
>> Planar point pattern: 422 points
>> window: rectangle = [284086.69, 309740] x [709900, 726547.7] metres
>>
>> Component 3:
>> Planar point pattern: 495 points
>> window: rectangle = [284086.69, 309740] x [709900, 726547.7] metres
>>
>> Component 4:
>> Planar point pattern: 557 points
>> window: rectangle = [284086.69, 309740] x [709900, 726547.7] metres
>>
>> Component 5:
>> Planar point pattern: 576 points
>> window: rectangle = [284086.69, 309740] x [709900, 726547.7] metres
>>
>> class(pp_list)
>> [1] "ppplist" "solist"  "anylist" "listof"  "list"
>>
>> Any ideas why the error is occurring? Thanks.
>
> It's hard to say without having a *reproducible* example.  Since we
> don't have access to "xx" or to "pp.list" we cannot experiment to see
> what's going on.
>
> One problem that leaps out at me --- although it doesn't seem that this
> should trigger the error message that you received --- is that the
> entries of pp_list appear to be *planar point patterns* (of class "ppp")
> whereas "xx" is a pattern on a linear network (of class "lpp").
> Consequently there is a fundamental incompatibility here.
>
> However I don't see why you would get the error message that you did.  I
> am CC-ing this email to Adrian Baddeley who has more insight than I, and
> may be able to point you in the right direction.  Adrian is kind of
> overwhelmed with work at the moment, so it may be a while till you hear
> from him.
>
> If you provide a reproducible example I *may* be able to help.

_______________________________________________
R-sig-Geo mailing list
[hidden email]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo
Reply | Threaded
Open this post in threaded view
|

Re: [FORGED] spatstat - user-supplied list of point patterns in envelope() error

Joe Lewis
Hi Rolf,

Thank you for the prompt reply.

Now that you mentioned it, it seems such a silly mistake for me to make!

I appreciate the help.

Kind regards,
Joe

On Mon, Aug 12, 2019 at 3:31 AM Rolf Turner <[hidden email]> wrote:

>
>
> Dear Joe,
>
> Further to my previous response to your post:  I have now been in touch
> with Adrian Baddeley and he has confirmed that the problem is as I
> conjectured:   The patterns in "pp_list" need to be compatible with
> "xx".  The error message was a bit misleading.  (Adrian has now adjusted
> the error message so as to make it more clear what the problem actually is.)
>
> However there was also a genuine bug (that was revealed by your
> question; thank you!!!) in the software, so even if pp_list had been a
> list of patterns of the appropriate type, you would still have got an
> error.  (A spurious error, caused by the bug; different message of course.)
>
> The bug has been been fixed in the development version of spatstat
> (1.60-1.022).  You will need to install that from github:
>
> library(remotes)
> install_github('spatstat/spatstat')
>
> or wait for the next "official release" of spatstat on CRAN.  Such
> releases happen about every three months; the last one was on
> 23/June/2019.
>
> cheers,
>
> Rolf
>
> > On 12/08/19 8:51 AM, Joe Lewis wrote:
> >
> >> Dear list,
> >>
> >> I'm trying to use a user-supplied list of point patterns in envelope()
> >> rather than test against the CSR. Page 400 of Spatial Point Patterns:
> >> Methodology and Applications in R states that "the argument simulate
> >> can be a list of point patterns". However, I get the following error
> >> when I try  to supply a list of ppp:
> >>
> >>   ekls <- envelope.lpp(Y =  xx, fun = linearK, nsim=5, simulate =
> >> pp_list)
> >> Error in envelopeEngine(X = X, fun = fun, simul = simrecipe, nsim =
> >> nsim,  :
> >>    ‘simulate’ should be an expression, or a list of point patterns
> >>
> >> for reference,
> >>
> >> xx
> >> Point pattern on linear network
> >> 680 points
> >> Linear network with 22 vertices and 21 lines
> >> Enclosing window: rectangle = [284086.69, 309740] x [709900, 726547.7]
> >> metres
> >>
> >> class(xx)
> >> [1] "lpp" "ppx"
> >>
> >> pp_list
> >> List of point patterns
> >>
> >> Component 1:
> >> Planar point pattern: 513 points
> >> window: rectangle = [284086.69, 309740] x [709900, 726547.7] metres
> >>
> >> Component 2:
> >> Planar point pattern: 422 points
> >> window: rectangle = [284086.69, 309740] x [709900, 726547.7] metres
> >>
> >> Component 3:
> >> Planar point pattern: 495 points
> >> window: rectangle = [284086.69, 309740] x [709900, 726547.7] metres
> >>
> >> Component 4:
> >> Planar point pattern: 557 points
> >> window: rectangle = [284086.69, 309740] x [709900, 726547.7] metres
> >>
> >> Component 5:
> >> Planar point pattern: 576 points
> >> window: rectangle = [284086.69, 309740] x [709900, 726547.7] metres
> >>
> >> class(pp_list)
> >> [1] "ppplist" "solist"  "anylist" "listof"  "list"
> >>
> >> Any ideas why the error is occurring? Thanks.
> >
> > It's hard to say without having a *reproducible* example.  Since we
> > don't have access to "xx" or to "pp.list" we cannot experiment to see
> > what's going on.
> >
> > One problem that leaps out at me --- although it doesn't seem that this
> > should trigger the error message that you received --- is that the
> > entries of pp_list appear to be *planar point patterns* (of class "ppp")
> > whereas "xx" is a pattern on a linear network (of class "lpp").
> > Consequently there is a fundamental incompatibility here.
> >
> > However I don't see why you would get the error message that you did.  I
> > am CC-ing this email to Adrian Baddeley who has more insight than I, and
> > may be able to point you in the right direction.  Adrian is kind of
> > overwhelmed with work at the moment, so it may be a while till you hear
> > from him.
> >
> > If you provide a reproducible example I *may* be able to help.

_______________________________________________
R-sig-Geo mailing list
[hidden email]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo