[R] spatstat rmh problem
Rolf Turner
r.turner at auckland.ac.nz
Tue Sep 16 08:11:48 CEST 2014
OK. Two things are going wrong.
(1) There is an error in your code. You are passing the new.coef
argument to density() and not to rmh(). The function density() has no
such argument, but has a "..." argument, so "new.coef" simply gets ignored.
You should use:
plot(density(rmh(mod,new.coef=c(1,200))))
(2) However, even when the correct call is given you still wind up with
identical densities!!!
Hmmmmm. I think this may be a bug; I'll will check with the other
authors of spatstat and report back.
cheers,
Rolf Turner
On 16/09/14 16:30, Sebastian Schutte wrote:
> Thanks so much for your comments. Sorry for not having sent a running
> example from the start. Here it is:
>
> library (spatstat)
>
> #Load example data
> data(demopat)
> #Generate a random point pattern within the polygon
> set.seed(12345)
> pdat <- rpoint(200,win=demopat$window)
> #Generate a distmap, which will serve as covariate information
> im.cdat <- as.im(distmap(pdat))
> #Now the random seed is fixed and a new set of random points is
> generated for the example
> set.seed(11111)
> pdat <- rpoint(200,win=demopat$window)
> #Fitting a model to the data
> mod <- ppm (pdat ~ im.cdat)
> #Now a point pattern is simulated via rmh from the fitted model an
> visualized as a density surface
> set.seed(22222)
> plot(density(rmh(mod)))
> #And here is the problem: When I repeat the exercise with different
> coefs, the very same patter come out. "new.coef" has no effect.
> set.seed(22222)
> plot(density(rmh(mod),new.coef=c(1,200)))
>
> What am I missing?
--
Rolf Turner
Technical Editor ANZJS
More information about the R-help
mailing list