[R-sig-Geo] [FORGED] spatstat residuals.ppm with an intensity given as an image?
Rolf Turner
r.turner at auckland.ac.nz
Thu Jun 15 02:39:09 CEST 2017
On 07/06/17 22:22, Seth Flaxman wrote:
> I've got the intensity of an inhomogeneous Poisson process (fit using
> some new methods I'm working on, so not created by spatstat) as an
> image object, the observed point pattern as a ppp object, and I'd like
> to call residuals.ppm to compute residuals. Is there a simple way to
> create a fitted point process model (ppm) from an image and points so
> I can pass this directly to residuals.ppm?
Sorry for the long delay in responding.
There are two ways to do this:
[1] Fit a model using the putative intensity as an offset:
fit1 <- ppm(X ~ offset(log(lam)))
where 'lam' is the pixel image of intensity, and 'X' is the point pattern.
Then do:
res <- residuals(fit1)
[2] Fit some other model (e.g. just a constant intensity model) and use
the argument 'fittedvalues' of residuals.ppm to specify the fitted
intensity values.
fit2 <- ppm(X ~ 1, forcefit=TRUE)
res <- residuals(fit2, fittedvalues=lam[quad.ppm(fit2)])
cheers,
Rolf Turner
--
Technical Editor ANZJS
Department of Statistics
University of Auckland
Phone: +64-9-373-7599 ext. 88276
More information about the R-sig-Geo
mailing list