data(swedishpines)
X <- swedishpines
plot(X, main="Swedish Pines data")
# Poisson process
fit <- ppm(X, ~1, Poisson())
Xsim <- rmh(fit)
plot(Xsim, main="simulation from fitted Poisson model")
# Strauss process
fit <- ppm(X, ~1, Strauss(r=7), rbord=7)
Xsim <- rmh(fit, control=list(nrep=1e3))
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=1e3, expand=2, periodic=TRUE))
# Strauss - hard core process
fit <- ppm(X, ~1, StraussHard(r=7,hc=2), rbord=7)
Xsim <- rmh(fit, start=list(n.start=X$n), control=list(nrep=1e3))
plot(Xsim, main="simulation from fitted Strauss hard core model")
# Geyer saturation process
fit <- ppm(X, ~1, Geyer(r=7,sat=2), rbord=7)
Xsim <- rmh(fit, start=list(n.start=X$n), control=list(nrep=1e3))
plot(Xsim, main="simulation from fitted Geyer model")
# soft core interaction process
Q <- quadscheme(X, nd=50)
fit <- ppm(Q, ~1, Softcore(kappa=0.1))
Xsim <- rmh(fit, start=list(n.start=X$n), control=list(nrep=1e3))
plot(Xsim, main="simulation from fitted Soft Core model")
data(cells)
plot(cells)
# Diggle-Gratton pairwise interaction model
fit <- ppm(cells, ~1, DiggleGratton(0.05, 0.1))
Xsim <- rmh(fit, start=list(n.start=cells$n), control=list(nrep=1e3))
plot(Xsim, main="simulation from fitted Diggle-Gratton model")
X <- rSSI(0.05, 100)
plot(X, main="new data")
# piecewise-constant pairwise interaction function
fit <- ppm(X, ~1, PairPiece(seq(0.02, 0.1, by=0.01)))
Xsim <- rmh(fit, control=list(nrep=1e3))
plot(Xsim, main="simulation from fitted pairwise model")
# marked point pattern
data(amacrine)
Y <- amacrine
plot(Y, main="Amacrine data")
# marked Poisson models
fit <- ppm(Y)
Ysim <- rmh(fit)
plot(Ysim, main="simulation from ppm(Y)")
fit <- ppm(Y,~marks)
Ysim <- rmh(fit)
plot(Ysim, main="simulation from ppm(Y, ~marks)")
fit <- ppm(Y,~polynom(x,y,2))
Ysim <- rmh(fit)
plot(Ysim, main="simulation from ppm(Y, ~polynom(x,y,2))")
fit <- ppm(Y,~marks+polynom(x,y,2))
Ysim <- rmh(fit)
plot(Ysim, main="simulation from ppm(Y, ~marks+polynom(x,y,2))")
fit <- ppm(Y,~marks*polynom(x,y,2))
Ysim <- rmh(fit)
plot(Ysim, main="simulation from ppm(Y, ~marks*polynom(x,y,2))")
# 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, control=list(nrep=1e3))
plot(Ysim, main="simulation from fitted Multitype Strauss")
fit <- ppm(Y,~marks*polynom(x,y,2), MS)
Ysim <- rmh(fit, control=list(nrep=1e3))
plot(Ysim, main="simulation from fitted inhomogeneous Multitype Strauss")
Run the code above in your browser using DataLab