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")
# 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)
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)
# marked point pattern
Y <- amacrine
# 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)
# multitype Strauss models
MS <- MultiStrauss(types = levels(Y$marks),
radii=matrix(0.07, ncol=2, nrow=2))
fit <- ppm(Y, ~marks, MS)
Ysim <- rmh(fit)
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)
# 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 DataLab