Virginia Morera Pujol - 2 months ago 12

R Question

I am having some troubles trying to produce a leverage plot for a point pattern model in

`spatstat`

I have a model with 3 covariates and a Geyer interaction, that runs correctly without producing any warning messages. However, when I try to produce the leverage plot I get first this warning:

`Large quadrature scheme split into blocks to avoid memory size`

limits;6404 dummy points split into 8 blocks, the first 7 blocks

containing 801 dummy points and the last block containing 797 dummy

points

And then this error:

`Error in ppmInfluenceEngine(fit, what = what, ..., iScore = iScore, iHessian = iHessian, :`

number of items to replace is not a multiple of replacement length

I assume the problem has something to do with the fact that R tries to split the quadrature scheme, because before, when it didn't crash and I was able to produce a leverage plot with the exact same model, it didn't have to split it (or at least it din't let me know about it!)

`library(spatstat)`

#generate a pattern

pattern <- rpoispp(1454)

summary(pattern)

#generate a covariate

cov1 <- rnoise(rgen = rnorm, dimyx=32, mean=2, sd=1, w = pattern$window)

cov2 <- rnoise(rgen = rnorm, dimyx=32, mean=1, sd=7, w = pattern$window)

cov3 <- rnoise(rgen = rnorm, dimyx=32, mean=5, sd=10, w = pattern$window)

#fit the model

fit <- ppm(pattern ~ cov1 + cov2 + cov3, Geyer(r = 0.01, s = 0.02))

leverage(fit) #this produces the warning and then the error

I am running R version 3.3.1 and spatstat version 1.46-1

Answer

Thank you for reporting this. It is a bug in spatstat which we will try to fix as quickly as possible. If you have sufficient memory on your computer you can avoid the quadrature splitting by setting:

```
spatstat.options(maxmatrix = 2^26)
```

**BEWARE: Your computer may hang for a while if you do this** and you don't have enough memory. In some cases it may be hard to interrupt these calculations, so just to be safe I would save any open files etc. before trying this.