live <- interactive()
op <- spatstat.options()
spatstat.options(rmh.nrep=1e5)
Nrep <- 1e5
X <- swedishpines
if(live) plot(X, main="Swedish Pines data")
# Poisson process
fit <- ppm(X, ~1, Poisson())
Xsim <- rmh(fit)
if(live) plot(Xsim, main="simulation from fitted Poisson model")
# Strauss process
fit <- ppm(X, ~1, Strauss(r=7))
Xsim <- rmh(fit)
if(live) plot(Xsim, main="simulation from fitted Strauss model")
## Not run:
# # Strauss process simulated on a larger window
# # then clipped to original window
# Xsim <- rmh(fit, control=list(nrep=Nrep, expand=1.1, periodic=TRUE))
# Xsim <- rmh(fit, nrep=Nrep, expand=2, periodic=TRUE)
# ## End(Not run)
## Not run:
# X <- rSSI(0.05, 100)
# # piecewise-constant pairwise interaction function
# fit <- ppm(X, ~1, PairPiece(seq(0.02, 0.1, by=0.01)))
# Xsim <- rmh(fit)
# ## End(Not run)
# marked point pattern
Y <- amacrine
## Not run:
# # marked Poisson models
# fit <- ppm(Y)
# fit <- ppm(Y,~marks)
# fit <- ppm(Y,~polynom(x,2))
# fit <- ppm(Y,~marks+polynom(x,2))
# fit <- ppm(Y,~marks*polynom(x,y,2))
# Ysim <- rmh(fit)
# ## End(Not run)
# multitype Strauss models
MS <- MultiStrauss(radii=matrix(0.07, ncol=2, nrow=2),
types = levels(Y$marks))
## Not run:
# fit <- ppm(Y ~marks, MS)
# Ysim <- rmh(fit)
# ## End(Not run)
fit <- ppm(Y ~ marks*polynom(x,y,2), MS)
Ysim <- rmh(fit)
if(live) plot(Ysim, main="simulation from fitted inhomogeneous Multitype Strauss")
spatstat.options(op)
## Not run:
# # Hybrid model
# fit <- ppm(redwood, ~1, Hybrid(A=Strauss(0.02), B=Geyer(0.1, 2)))
# Y <- rmh(fit)
# ## End(Not run)
Run the code above in your browser using DataLab