library(spatstat)
par11 <- c(2,0.2,0.7)
w <- c(0,10,0,10)
X1.strauss <- rmh("strauss",par=par11,w=w,n.start=80,
nrep=1e5,nverb=5000)
# Conditioning on n = 80:
X2.strauss <- rmh("strauss",par=par11,w=w,n.start=80,
p=1,nrep=1e5,nverb=5000)
par12 <- c(2000,0.6,0.07)
x <- c(0.55,0.68,0.75,0.58,0.39,0.37,0.19,0.26,0.42)
y <- c(0.20,0.27,0.68,0.99,0.80,0.61,0.45,0.28,0.33)
w <- owin(poly=list(x=x,y=y))
X3.strauss <- rmh("strauss",par=par12,w=w,n.start=90,
nrep=1e5,nverb=5000)
# Pure hardcore:
par13 <- c(2,0,0.7)
w <- c(0,10,0,10)
X4.strauss <- rmh("strauss",par=par13,w=w,n.start=60,
nrep=1e5,nverb=5000,iseed=c(42,17,69))
# Another Strauss process, starting off from X3.strauss (but
# with a rectangular window):
xxx <- X3.strauss
xxx$w <- as.owin(c(0,1,0,1))
X5.strauss <- rmh("strauss",par=par12,w=w,x.start=xxx,
nrep=1e5,nverb=5000)
par21 <- c(2,0.2,0.7,0.3)
w <- c(0,10,0,10)
X1.straush <- rmh("straush",par=par21,w=w,n.start=70,
nrep=1e5,nverb=5000)
par22 <- c(80,0.36,45,2.5)
w <- c(0,250,0,250)
X2.straush <- rmh("straush",par=par22,w=w,n.start=160,
nrep=1e5,nverb=5000)
# Pure hardcore (identical to X3.strauss).
par23 <- c(2,1,1,0.7)
w <- c(0,10,0,10)
X3.straush <- rmh("straush",par=par23,w=w,n.start=60,
nrep=1e5,nverb=5000,iseed=c(42,17,69))
par3 <- c(0.8,0.1,0.5)
w <- c(0,10,0,10)
X.sftcr <- rmh("sftcr",par=par3,w=w,n.start=70,nrep=1e5,
nverb=5000)
beta <- c(0.027,0.008)
gmma <- matrix(c(0.43,0.98,0.98,0.36),2,2)
r <- matrix(c(45,45,45,45),2,2)
par4 <- list(beta=beta,gamma=gmma,r=r)
w <- c(0,250,0,250)
pm <- c(0.75,0.25)
X1.straussm <- rmh("straussm",par=par4,w=w,ntypes=2,
ptypes=pm,n.start=80,nrep=1e5,nverb=5000)
# Conditioning upon the total number of points being 80:
X2.straussm <- rmh("straussm",par=par4,w=w,ntypes=2,
ptypes=pm,n.start=80,p=1,nrep=1e5,nverb=5000)
# Conditioning upon the number of points of type 1 being 60
# and the number of points of type 2 being 20:
X3.straussm <- rmh("straussm",par=par4,w=w,ntypes=2,n.start=c(60,20),
fixall=TRUE,nrep=1e5,p=1,nverb=5000)
rhc <- matrix(c(9.1,5.0,5.0,2.5),2,2)
par5 <- list(beta=beta,gamma=gmma,r=r,rhc=rhc)
X.straushm <- rmh("straushm",par=par5,w=w,ntypes=2,
ptypes=pm,n.start=80,nrep=1e5,nverb=5000)
beta <- c(0.0027,0.08)
par6 <- list(beta=beta,gamma=gmma,r=r,rhc=rhc)
tpar1 <- c(0.02,0.004,-0.0004,0.004,-0.0004) # Coefs. for log quadratic
tpar2 <- c(-0.06,0.05) # and log linear trends.
w <- c(0,250,0,250)
pm <- c(0.75,0.25)
X1.straushm.trend <- rmh("straushm",par=par6,w=w,ntypes=2,
ptypes=pm,tpar=list(tpar1,tpar2),n.start=350,
nrep=1e5,nverb=5000,iseed=c(42,17,69))
# Identical to X1.straushm.trend; tpar given in vector form.
tpar <- c(2,2,1,tpar1,tpar2)
X2.straushm.trend <- rmh("straushm",par=par6,w=w,ntypes=2,
ptypes=pm,tpar=tpar,n.start=350,
nrep=1e5,nverb=5000,iseed=c(42,17,69))
par7 <- c(3600,0.08)
w <- c(0,1,0,1)
X.dig1 <- rmh("dig1",par=par7,w=w,n.start=300,nrep=1e5,nverb=5000)
par8 <- c(1800,3,0.02,0.04)
X.dig2 <- rmh("dig2",par=par8,w=w,n.start=300,nrep=1e5,nverb=5000)
par9 <- c(1.25,1.6,0.2,4.5)
w <- c(0,10,0,10)
X1.geyer <- rmh("geyer",par=par9,w=w,n.start=200,nrep=1e5,nverb=5000)
# Same as a Strauss process with parameters (2.25,0.16,0.7).
par10 <- c(2.25,0.4,0.7,10000)
X2.geyer <- rmh("geyer",par=par10,w=w,n.start=70,nrep=1e5,nverb=5000)
# Starting from the redwood data set, and simulating on a torus:
par11 <- c(8.1,2.2,0.08,3)
data(redwood)
X3.geyer <- rmh("geyer",par=par11,x.start=redwood,periodic=TRUE,
nrep=1e5,nverb=5000)
# As above, conditioning on n:
X4.geyer <- rmh("geyer",par=par11,x.start=redwood,periodic=TRUE,
p=1,nrep=1e5,nverb=5000)
<testonly>par11 <- c(2,0.2,0.7)
w <- c(0,10,0,10)
X1.strauss <- rmh("strauss",par=par11,w=w,n.start=80,
nrep=100,nverb=50)
# Conditioning on n = 80:
X2.strauss <- rmh("strauss",par=par11,w=w,n.start=80,
p=1,nrep=100,nverb=50)
par12 <- c(2000,0.6,0.07)
x <- c(0.55,0.68,0.75,0.58,0.39,0.37,0.19,0.26,0.42)
y <- c(0.20,0.27,0.68,0.99,0.80,0.61,0.45,0.28,0.33)
w <- owin(poly=list(x=x,y=y))
X3.strauss <- rmh("strauss",par=par12,w=w,n.start=90,
nrep=100,nverb=50)
# Pure hardcore:
par13 <- c(2,0,0.7)
w <- c(0,10,0,10)
X4.strauss <- rmh("strauss",par=par13,w=w,n.start=60,
nrep=100,nverb=50,iseed=c(42,17,69))
# Another Strauss process, starting off from X3.strauss (but
# with a rectangular window):
xxx <- X3.strauss
xxx$w <- as.owin(c(0,1,0,1))
X5.strauss <- rmh("strauss",par=par12,w=w,x.start=xxx,
nrep=100,nverb=50)
par21 <- c(2,0.2,0.7,0.3)
w <- c(0,10,0,10)
X1.straush <- rmh("straush",par=par21,w=w,n.start=70,
nrep=100,nverb=50)
par22 <- c(80,0.36,45,2.5)
w <- c(0,250,0,250)
X2.straush <- rmh("straush",par=par22,w=w,n.start=160,
nrep=100,nverb=50)
# Pure hardcore (identical to X3.strauss).
par23 <- c(2,1,1,0.7)
w <- c(0,10,0,10)
X3.straush <- rmh("straush",par=par23,w=w,n.start=60,
nrep=100,nverb=50,iseed=c(42,17,69))
par3 <- c(0.8,0.1,0.5)
w <- c(0,10,0,10)
X.sftcr <- rmh("sftcr",par=par3,w=w,n.start=70,nrep=100,
nverb=50)
beta <- c(0.027,0.008)
gmma <- matrix(c(0.43,0.98,0.98,0.36),2,2)
r <- matrix(c(45,45,45,45),2,2)
par4 <- list(beta=beta,gamma=gmma,r=r)
w <- c(0,250,0,250)
pm <- c(0.75,0.25)
X1.straussm <- rmh("straussm",par=par4,w=w,ntypes=2,
ptypes=pm,n.start=80,nrep=100,nverb=50)
# Conditioning upon the total number of points being 80:
X2.straussm <- rmh("straussm",par=par4,w=w,ntypes=2,
ptypes=pm,n.start=80,p=1,nrep=100,nverb=50)
# Conditioning upon the number of points of type 1 being 60
# and the number of points of type 2 being 20:
X3.straussm <- rmh("straussm",par=par4,w=w,ntypes=2,n.start=c(60,20),
fixall=TRUE,nrep=100,p=1,nverb=50)
rhc <- matrix(c(9.1,5.0,5.0,2.5),2,2)
par5 <- list(beta=beta,gamma=gmma,r=r,rhc=rhc)
X.straushm <- rmh("straushm",par=par5,w=w,ntypes=2,
ptypes=pm,n.start=80,nrep=100,nverb=50)
beta <- c(0.0027,0.08)
par6 <- list(beta=beta,gamma=gmma,r=r,rhc=rhc)
tpar1 <- c(0.02,0.004,-0.0004,0.004,-0.0004) # Coefs. for log quadratic
tpar2 <- c(-0.06,0.05) # and log linear trends.
w <- c(0,250,0,250)
pm <- c(0.75,0.25)
X1.straushm.trend <- rmh("straushm",par=par6,w=w,ntypes=2,
ptypes=pm,tpar=list(tpar1,tpar2),n.start=350,
nrep=100,nverb=50,iseed=c(42,17,69))
# Identical to X1.straushm.trend; tpar given in vector form.
tpar <- c(2,2,1,tpar1,tpar2)
X2.straushm.trend <- rmh("straushm",par=par6,w=w,ntypes=2,
ptypes=pm,tpar=tpar,n.start=350,
nrep=100,nverb=50,iseed=c(42,17,69))
par7 <- c(3600,0.08)
w <- c(0,1,0,1)
X.dig1 <- rmh("dig1",par=par7,w=w,n.start=300,nrep=100,nverb=50)
par8 <- c(1800,3,0.02,0.04)
X.dig2 <- rmh("dig2",par=par8,w=w,n.start=300,nrep=100,nverb=50)
par9 <- c(1.25,1.6,0.2,4.5)
w <- c(0,10,0,10)
X1.geyer <- rmh("geyer",par=par9,w=w,n.start=200,nrep=100,nverb=50)
# Same as a Strauss process with parameters (2.25,0.16,0.7).
par10 <- c(2.25,0.4,0.7,10000)
X2.geyer <- rmh("geyer",par=par10,w=w,n.start=70,nrep=100,nverb=50)
# Starting from the redwood data set, and simulating on a torus:
par11 <- c(8.1,2.2,0.08,3)
data(redwood)
X3.geyer <- rmh("geyer",par=par11,x.start=redwood,periodic=TRUE,
nrep=100,nverb=50)
# As above, conditioning on n:
X4.geyer <- rmh("geyer",par=par11,x.start=redwood,periodic=TRUE,
p=1,nrep=100,nverb=50)</testonly>
Run the code above in your browser using DataLab