[R] spatstat rmh problem

Sebastian Schutte schuttesebastian at gmail.com
Mon Sep 15 16:30:07 CEST 2014


Dear R and spatstat developers,

Thanks so much for the time and effort that you invest into this awesome 
software. I have a problem simulating from a Point Process Model in 
spatstat. In summary, the option "new.coef" should allow me to use a 
fitted model and change its beta coefficients before simulating a point 
pattern from the model via Monte Carlo simulation. Intuitively, one 
would assume that the predicted point pattern changes as one fiddles 
with the beta coefficients. However, this does not seem to work.

Please let me know what I am missing here and which screw to drive to 
actually change the simulation output.

#owin is a polygon of country boundaries, "im.pop" is a raster with 
georeferenced population counts.
#I am using a random point pattern for demonstration purposes

#Fix random seed
set.seed(12345)
#Generate artificial points
dat <- rpoint(500,win=cshape)
#Fit a (inhomogenous spatial poisson) model to the data
mod <- ppm (ppp, ~  pop ,  covariates = list (pop = im.pop))
#Simulate some points:
plot(density(rmh(mod)))
#plot(density(simulate(mod)))
#Show that this is reproducible
set.seed(12345)
#Generate artificial points
dat <- rpoint(500,win=cshape)
#Fit a (inhomogenous spatial poisson) model to the data
mod <- ppm (ppp, ~  pop ,  covariates = list (pop = im.pop))
#Simulate some points:
plot(density(rmh(mod)))
#As expected, the density is the same

#Now change the coefs and do it again:
set.seed(12345)
#Generate artificial points
dat <- rpoint(500,win=cshape)
#Fit a (inhomogenous spatial poisson) model to the data
mod <- ppm (ppp, ~  pop ,  covariates = list (pop = im.pop))
#Simulate some points:
plot(density(rmh(mod),new.coef=c(1,200)))
#Looks the same, so what am I missing?

Thanks for your help,
Sebastian



More information about the R-help mailing list