Aggs
Aggs

Reputation: 55

getting error `spatstat::density` function related to "iterMax"

Help with error "No of time iterations exceeds iterMax; increase dtt or increase iterMax" for density function in R

How do I increase the iterMax?

I am using the library spatstat.

this is my script:

d660 <- density(unmark(control23_network.ppp), 660)

My Point pattern on linear network has:

1969 points Linear network with 20126 vertices and 21363 lines Enclosing window: rectangle = [-87.63141, -87.55547] x [41.75817, 41.83858] units

enter image description here

An example of it working is in the spatstat library with sample dataset:

data(chicago)

chicago

d60 <- density(unmark(chicago), 60)

plot(d60)

d60

This sample dataset has:

Point pattern on linear network 116 points Multitype, with possible types: assault, burglary, cartheft, damage, robbery, theft, trespass Linear network with 338 vertices and 503 lines Enclosing window: rectangle = [0.3894, 1281.9863] x [153.1035, 1276.5602] feet

Upvotes: 0

Views: 140

Answers (2)

Adrian Baddeley
Adrian Baddeley

Reputation: 1984

This is a question about spatstat::density.lpp, the method for density for point patterns on a linear network (class lpp).

The chosen bandwidth sigma is far too large. The enclosing rectangle is about 0.1 units wide, while the bandwidth is sigma=660 units. This would require a prohibitively large number of iterations of the algorithm, so it refuses.

A reasonable value of bandwidth sigma in this example would be between 0.001 and 0.05 units.

Upvotes: 1

Ege Rubak
Ege Rubak

Reputation: 4507

Your smoothing bandwidth sigma appears to be huge (660 units) compared to the scale of the network (the enclosing rectangle has approximate side lengths 0.1 units). Did you try with something like sigma = 0.001 or similar? A big value of sigma is doomed to give problems. The help says:

Computational time is short, but increases quadratically with sigma.

It may be that this is not the root problem, but at least it is worth trying before doing a lot of other things.

Finally, what is your version of R and spatstat? The code for density.lpp has changed a lot recently.

Upvotes: 1

Related Questions