I am attempting to fit a point pattern with ppm() in spatstat, version 1.60-1, using a combination of first-order covariates (as im objects) and a second-order interaction term, in this case an Area-Interaction model.
For my data, comprising: ~300 points, 3 covariate im.objects of ~110 MB each, and the area interaction term at r = 15000 map units (meters), processing time is proving to be prohibitively long - over 72 hours at this point.
Using some of the data included in spatstat itself:
require(spatstat)
res <- vector()
for (i in seq(1, 9, 0.5)) {
start.time <- Sys.time()
ppm(swedishpines, ~1, AreaInter(r=i))
end.time <- Sys.time()
time.taken <- end.time - start.time
res[i] <- time.taken
}
plot(res)
Output:
it can be seen that the processing time increases roughly linearly. I imagine that the size of the point pattern, window, inclusion of covariates, and apparently most importantly, the value of r, heavily affect this too.
My reason for believing this is that I previously ran ppm() with a larger point pattern, similar covariates, but a much smaller value of r (~7000 instead of ~15000)
It appears to be relatively simple to parallelize the envelope() function and pool the results with the corresponding function, but I am looking for advice on how to parallelize ppm() and be able to combine the output fitted models? There doesn't seem to be a direct implementation of this task for ppm objects.
Alternatively, if someone is more familiar with the implementation of the Area Interaction model in spatstat, I'd be grateful to know if I am just chasing cars with such a large value of r, and if I would be better off trying a different approach.
