```
# NOT RUN {
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)
# }
# 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)
# }
# 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)
# }
# 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)
# }
# 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)
# }
```

Run the code above in your browser using DataCamp Workspace